зеркало из https://github.com/getsops/sops.git
Fix flakey test run on OSX
On OSX newer versions of docker treat the host 'localhost' differently than '127.0.0.1'. Using resource.GetHostPort for url building will return an OS appropriate hostname
This commit is contained in:
Родитель
6130ffe35c
Коммит
a98768b3b6
|
@ -25,7 +25,8 @@ func TestMain(m *testing.M) {
|
|||
logger.Fatalf("Could not start resource: %s", err)
|
||||
}
|
||||
|
||||
os.Setenv("VAULT_ADDR", fmt.Sprintf("http://127.0.0.1:%v", resource.GetPort("8200/tcp")))
|
||||
vaultAddr := fmt.Sprintf("http://%s", resource.GetHostPort("8200/tcp"))
|
||||
os.Setenv("VAULT_ADDR", vaultAddr)
|
||||
os.Setenv("VAULT_TOKEN", "secret")
|
||||
// exponential backoff-retry, because the application in the container might not be ready to accept connections yet
|
||||
if err := pool.Retry(func() error {
|
||||
|
@ -45,7 +46,7 @@ func TestMain(m *testing.M) {
|
|||
logger.Fatalf("Could not connect to docker: %s", err)
|
||||
}
|
||||
|
||||
key := NewMasterKey(fmt.Sprintf("http://127.0.0.1:%v", resource.GetPort("8200/tcp")), "sops", "main")
|
||||
key := NewMasterKey(vaultAddr, "sops", "main")
|
||||
err = key.createVaultTransitAndKey()
|
||||
if err != nil {
|
||||
logger.Fatal(err)
|
||||
|
|
Загрузка…
Ссылка в новой задаче