Trap failure to create Vault instance in tests

When the Docker service isn't running, the test suite can't create a
Vault instance. Trap this failure earlier in the test program to
preclude panicking after tests relying on Vault have failed.

Signed-off-by: Steven E. Harris <seh@panix.com>
This commit is contained in:
Steven E. Harris 2022-02-13 15:51:22 -05:00
parent e437cb83c2
commit e665bccf89
No known key found for this signature in database
GPG Key ID: BB5463D8C93E1666
1 changed files with 4 additions and 1 deletions

View File

@ -121,8 +121,11 @@ func runInContext(registerControllers func(*testenv.Environment), run func() err
panic(fmt.Sprintf("Failed to create k8s client: %v", err))
}
// Create a vault test instance
// Create a Vault test instance.
pool, resource, err := createVaultTestInstance()
if err != nil {
panic(fmt.Sprintf("Failed to create Vault instance: %v", err))
}
defer func() {
pool.Purge(resource)
}()