mirror of
https://github.com/gofiber/storage.git
synced 2025-10-04 16:22:52 +08:00
chore: use cleanup function
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/testcontainers/testcontainers-go"
|
||||
"github.com/testcontainers/testcontainers-go/modules/clickhouse"
|
||||
)
|
||||
|
||||
@@ -39,14 +40,10 @@ func getTestConnection(t testing.TB, cfg Config) (*Storage, error) {
|
||||
clickhouse.WithPassword(clickhousePass),
|
||||
clickhouse.WithDatabase(clickhouseDB),
|
||||
)
|
||||
testcontainers.CleanupContainer(t, c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
if c != nil {
|
||||
require.NoError(t, c.Terminate(ctx))
|
||||
}
|
||||
})
|
||||
|
||||
hostPort, err := c.ConnectionHost(ctx)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user