From dc76fa6fe84c7ed8de2e237e41cc9980e6fcb956 Mon Sep 17 00:00:00 2001 From: Freddy Date: Thu, 16 Jul 2020 08:48:12 -0600 Subject: [PATCH] Allow consul repo override via env (#9500) --- helper/testhelpers/consul/consulhelper.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/helper/testhelpers/consul/consulhelper.go b/helper/testhelpers/consul/consulhelper.go index 049d71dd19..37638e3dc0 100644 --- a/helper/testhelpers/consul/consulhelper.go +++ b/helper/testhelpers/consul/consulhelper.go @@ -9,6 +9,7 @@ import ( consulapi "github.com/hashicorp/consul/api" "github.com/hashicorp/vault/helper/testhelpers/docker" "github.com/ory/dockertest" + dc "github.com/ory/dockertest/docker" ) // PrepareTestContainer creates a Consul docker container. If version is empty, @@ -46,6 +47,14 @@ func PrepareTestContainer(t *testing.T, version string) (cleanup func(), retAddr Tag: version, Cmd: []string{"agent", "-dev", "-client", "0.0.0.0", "-hcl", config}, } + consulRepo := os.Getenv("CONSUL_DOCKER_REPO") + if consulRepo != "" { + dockerOptions.Repository = consulRepo + dockerOptions.Auth = dc.AuthConfiguration{ + Username: os.Getenv("CONSUL_DOCKER_USERNAME"), + Password: os.Getenv("CONSUL_DOCKER_PASSWORD"), + } + } resource, err := pool.RunWithOptions(dockerOptions) if err != nil { t.Fatalf("Could not start local Consul %s docker container: %s", version, err)