Skip to content

Commit

Permalink
Update PostgreSQL image and add run configuration
Browse files Browse the repository at this point in the history
Switch PostgreSQL container image to non-alpine version for better compatibility. Increase context timeout to 60 seconds for reliable container initialization. Add configuration for running tests in Go environment.
  • Loading branch information
mukulmantosh committed Sep 24, 2024
1 parent 09029ee commit 5697663
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .run/Run Tests.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="GoTestRunConfiguration" factoryName="Go Test">
<module name="Go_Food_Delivery" />
<working_directory value="$PROJECT_DIR$/pkg/tests" />
<parameters value="--count=1" />
<root_directory value="$PROJECT_DIR$" />
<kind value="DIRECTORY" />
<package value="Go_Food_Delivery/pkg/tests" />
<directory value="$PROJECT_DIR$/pkg/tests" />
<filePath value="$PROJECT_DIR$" />
<framework value="gotest" />
<method v="2" />
</configuration>
</component>
4 changes: 2 additions & 2 deletions pkg/tests/database/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

var (
pgContainer testcontainers.Container
containerImage string = "postgres:16.3-alpine"
containerImage string = "postgres:16.3"
dbHost string
dbPort string
dbName string = "test-db"
Expand All @@ -26,7 +26,7 @@ var (

// Initialize the PostgreSQL container
func setup() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()

pgContainer, err = postgres.Run(ctx, containerImage,
Expand Down

0 comments on commit 5697663

Please sign in to comment.