Terminate tests containers on defer instead of waiting

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
bcmmbaga 2024-12-27 18:06:12 +03:00
parent 80d1bed9ce
commit 3f30eb7692
No known key found for this signature in database
GPG Key ID: 511EED5C928AD547

View File

@ -40,9 +40,8 @@ func CreateMysqlTestContainer() (func(), error) {
}
cleanup := func() {
timeout := 10 * time.Second
if err = container.Stop(ctx, &timeout); err != nil {
log.WithContext(ctx).Warnf("failed to stop container: %s", err)
if err = container.Terminate(ctx); err != nil {
log.WithContext(ctx).Warnf("failed to terminate container: %s", err)
}
}
@ -72,9 +71,8 @@ func CreatePostgresTestContainer() (func(), error) {
}
cleanup := func() {
timeout := 10 * time.Second
if err = container.Stop(ctx, &timeout); err != nil {
log.WithContext(ctx).Warnf("failed to stop container: %s", err)
if err = container.Terminate(ctx); err != nil {
log.WithContext(ctx).Warnf("failed to terminate container: %s", err)
}
}