Skip to content

Commit 7d0a08c

Browse files
authored
fix(tests): vault healthcheck improvements (#18)
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
1 parent 11677b7 commit 7d0a08c

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

internal/credentials/vault/keyval_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,15 @@ func newVaultInstance(t *testing.T) *vaultInstance {
203203
Env: map[string]string{
204204
"VAULT_DEV_ROOT_TOKEN_ID": defaultToken,
205205
},
206-
WaitingFor: wait.ForListeningPort("8200/tcp"),
206+
WaitingFor: wait.ForHTTP("/v1/sys/health").WithPort("8200/tcp"),
207207
}
208208

209209
instance, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
210210
ContainerRequest: req,
211211
Started: true,
212212
})
213213

214-
assert.NoError(t, err)
215-
214+
require.NoError(t, err)
216215
return &vaultInstance{instance}
217216
}
218217

@@ -242,9 +241,7 @@ func (s *testSuite) SetupTest() {
242241
}
243242

244243
func (s *testSuite) TearDownTest() {
245-
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
246-
defer cancel()
247-
assert.NoError(s.T(), s.vault.instance.Terminate(ctx))
244+
assert.NoError(s.T(), s.vault.instance.Terminate(context.Background()))
248245
}
249246

250247
// Run the tests

0 commit comments

Comments
 (0)