diff --git a/test/helper.go b/test/helper.go index 4b31cc0..da9d4f3 100644 --- a/test/helper.go +++ b/test/helper.go @@ -3,12 +3,8 @@ package test import ( "context" "database/sql" - "net/url" - "strconv" - "strings" "time" - "git.anthrove.art/Anthrove/otter-space-sdk/v2/pkg/models" migrate "github.com/rubenv/sql-migrate" postgrescontainer "github.com/testcontainers/testcontainers-go/modules/postgres" "gorm.io/driver/postgres" @@ -84,41 +80,3 @@ func getGormDB(connectionString string) (*gorm.DB, error) { TranslateError: true, }) } - -func DatabaseModesFromConnectionString(ctx context.Context, pgContainer *postgrescontainer.PostgresContainer) (*models.DatabaseConfig, error) { - var err error - - connectionString, err := pgContainer.ConnectionString(ctx) - if err != nil { - return nil, err - } - - connectionStringUrl, err := url.Parse(connectionString) - if err != nil { - return nil, err - } - - split := strings.Split(connectionStringUrl.Host, ":") - host := split[0] - - port, err := strconv.Atoi(split[1]) - if err != nil { - return nil, err - } - - database := strings.TrimPrefix(connectionStringUrl.Path, "/") - - username := connectionStringUrl.User.Username() - password, _ := connectionStringUrl.User.Password() - - return &models.DatabaseConfig{ - Endpoint: host, - Username: username, - Password: password, - Database: database, - Port: port, - SSL: false, - Timezone: "Europe/Berlin", - Debug: true, - }, nil -}