diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index e7b560af7..26801fd58 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -96,8 +96,6 @@ jobs: docker exec $CONTAINER_ID cat /var/lib/postgresql/data/postgresql.conf | grep max_connections - name: Restart PostgreSQL Container run: docker restart $(docker ps --filter "publish=5432" --format "{{.ID}}") - - name: Migrate DB - run: cd ./backend/src && go run main.go --only-migrate - name: Run Tests with Coverage run: cd ./backend/ && go test -bench=. -benchmem -race -coverprofile=coverage.txt ./... - name: Print Coverage diff --git a/backend/src/main.go b/backend/src/main.go index a165ca95d..9ace36db9 100644 --- a/backend/src/main.go +++ b/backend/src/main.go @@ -1,7 +1,6 @@ package main import ( - "flag" "fmt" "path/filepath" @@ -19,12 +18,7 @@ import ( // @host 127.0.0.1:8080 // @BasePath /api/v1 func main() { - onlyMigrate := flag.Bool("only-migrate", false, "Specify if you want to only perform the database migration") - configPath := flag.String("config", filepath.Join("..", "..", "config"), "Specify the path to the config directory") - - flag.Parse() - - config, err := config.GetConfiguration(*configPath) + config, err := config.GetConfiguration(filepath.Join("..", "..", "config")) if err != nil { panic(fmt.Sprintf("Error getting configuration: %s", err.Error())) } @@ -34,10 +28,6 @@ func main() { panic(fmt.Sprintf("Error configuring database: %s", err.Error())) } - if *onlyMigrate { - return - } - err = database.ConnPooling(db) if err != nil { panic(err) diff --git a/backend/tests/api/helpers/database.go b/backend/tests/api/helpers/database.go index 2f03ecaaa..dd51598e0 100644 --- a/backend/tests/api/helpers/database.go +++ b/backend/tests/api/helpers/database.go @@ -14,10 +14,10 @@ var ( once sync.Once ) -func RootConn(dbConfig config.DatabaseSettings) { +func RootConn(dbSettings config.DatabaseSettings) { once.Do(func() { var err error - rootConn, err = database.EstablishConn(dbConfig.WithoutDb()) + rootConn, err = database.EstablishConn(dbSettings.WithoutDb()) if err != nil { panic(err) } diff --git a/backend/tests/api/helpers/helpers_test.go b/backend/tests/api/helpers/utilities_test.go similarity index 100% rename from backend/tests/api/helpers/helpers_test.go rename to backend/tests/api/helpers/utilities_test.go