mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-10 17:32:29 -04:00
Allow consul repo override via env (#9500)
This commit is contained in:
parent
faf2958cde
commit
dc76fa6fe8
1 changed files with 9 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue