test: simplify setup

This commit is contained in:
Tine 2024-02-06 23:37:06 +01:00
parent 229b7bf53e
commit 93650d7d5a
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw

View file

@ -19,17 +19,8 @@ import (
) )
func setupPostgres(ctx context.Context, t *testing.T) *postgres.PostgresContainer { func setupPostgres(ctx context.Context, t *testing.T) *postgres.PostgresContainer {
dbName := "users"
dbUser := "user"
dbPassword := "password"
postgresContainer, err := postgres.RunContainer(ctx, postgresContainer, err := postgres.RunContainer(ctx,
testcontainers.WithImage("docker.io/postgres:15.2-alpine"), testcontainers.WithImage("docker.io/postgres:15.2-alpine"),
postgres.WithDatabase(dbName),
postgres.WithUsername(dbUser),
postgres.WithPassword(dbPassword),
testcontainers.WithWaitStrategy( testcontainers.WithWaitStrategy(
wait.ForLog("database system is ready to accept connections"). wait.ForLog("database system is ready to accept connections").
WithOccurrence(2). WithOccurrence(2).