Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 89ec79c

Browse files
committedMar 26, 2025·
fix: testcontainer's container config
1 parent 5aad502 commit 89ec79c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed
 

‎adapter/repository/mysql/testcontainer.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ func SetupMySQLContainer(t *testing.T) *MySQLContainerConfig {
7272
Image: "mysql:8.0",
7373
ExposedPorts: []string{mysqlPort},
7474
Env: map[string]string{
75-
"MYSQL_ROOT_PASSWORD": "root",
76-
"MYSQL_DATABASE": "test_db",
77-
"MYSQL_USER": "test_user",
78-
"MYSQL_PASSWORD": "test_password",
75+
"MYSQL_ROOT_PASSWORD": "mysqlroot",
76+
"MYSQL_DATABASE": "go_hexagonal",
77+
"MYSQL_USER": "user",
78+
"MYSQL_PASSWORD": "mysqlroot",
7979
},
8080
Mounts: []testcontainers.ContainerMount{
8181
testcontainers.BindMount(initScriptPath, "/docker-entrypoint-initdb.d/init.sql"),
@@ -113,12 +113,12 @@ func SetupMySQLContainer(t *testing.T) *MySQLContainerConfig {
113113

114114
// Create config
115115
config := &MySQLContainerConfig{
116-
DatabaseName: "test_db",
117-
User: "test_user",
118-
Password: "test_password",
116+
DatabaseName: "go_hexagonal",
117+
User: "user",
118+
Password: "mysqlroot",
119119
Host: host,
120120
Port: port.Port(),
121-
DSN: fmt.Sprintf("test_user:test_password@tcp(%s:%s)/test_db?charset=utf8mb4&parseTime=true&loc=Local", host, port.Port()),
121+
DSN: fmt.Sprintf("user:mysqlroot@tcp(%s:%s)/go_hexagonal?charset=utf8mb4&parseTime=true&loc=Local", host, port.Port()),
122122
Database: "test_db",
123123
CharSet: "utf8mb4",
124124
ParseTime: true,

‎adapter/repository/postgre/testcontainer.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ func SetupPostgreSQLContainer(t *testing.T) *PostgreSQLContainerConfig {
9494
Image: "postgres:13-alpine",
9595
ExposedPorts: []string{postgresPort},
9696
Env: map[string]string{
97-
"POSTGRES_USER": "test_user",
98-
"POSTGRES_PASSWORD": "test_password",
99-
"POSTGRES_DB": "test_db",
97+
"POSTGRES_USER": "postgres",
98+
"POSTGRES_PASSWORD": "123456",
99+
"POSTGRES_DB": "postgres",
100100
},
101101
Mounts: []testcontainers.ContainerMount{
102102
testcontainers.BindMount(initScriptPath, "/docker-entrypoint-initdb.d/init.sql"),
@@ -139,7 +139,7 @@ func SetupPostgreSQLContainer(t *testing.T) *PostgreSQLContainerConfig {
139139
Password: "test_password",
140140
Host: host,
141141
Port: port.Port(),
142-
DSN: fmt.Sprintf("host=%s port=%s user=test_user password=test_password dbname=test_db sslmode=disable", host, port.Port()),
142+
DSN: fmt.Sprintf("host=%s port=%s user=postgres password=123456 dbname=postgres sslmode=disable", host, port.Port()),
143143
Database: "test_db",
144144
SSLMode: "disable",
145145
TimeZone: "UTC",

0 commit comments

Comments
 (0)
Please sign in to comment.