Skip to content

Commit 1a2126d

Browse files
committed
fix: fail tests instead of skipping when database unavailable
Change tests to fail rather than skip when databases are not available. This ensures CI properly reports failures when database connectivity issues occur. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 693c335 commit 1a2126d

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

internal/endtoend/endtoend_test.go

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -179,37 +179,27 @@ func TestReplay(t *testing.T) {
179179
"managed-db": {
180180
Mutate: func(t *testing.T, path string) func(*config.Config) {
181181
return func(c *config.Config) {
182-
// Only add servers that are available
183-
var servers []config.Server
184-
if postgresURI != "" {
185-
servers = append(servers, config.Server{
182+
// Add all servers - tests will fail if database isn't available
183+
c.Servers = []config.Server{
184+
{
186185
Name: "postgres",
187186
Engine: config.EnginePostgreSQL,
188187
URI: postgresURI,
189-
})
190-
}
191-
if mysqlURI != "" {
192-
servers = append(servers, config.Server{
188+
},
189+
{
193190
Name: "mysql",
194191
Engine: config.EngineMySQL,
195192
URI: mysqlURI,
196-
})
193+
},
197194
}
198-
c.Servers = servers
199195

200196
for i := range c.SQL {
201197
switch c.SQL[i].Engine {
202198
case config.EnginePostgreSQL:
203-
if postgresURI == "" {
204-
t.Skipf("PostgreSQL not available")
205-
}
206199
c.SQL[i].Database = &config.Database{
207200
Managed: true,
208201
}
209202
case config.EngineMySQL:
210-
if mysqlURI == "" {
211-
t.Skipf("MySQL not available")
212-
}
213203
c.SQL[i].Database = &config.Database{
214204
Managed: true,
215205
}
@@ -224,8 +214,8 @@ func TestReplay(t *testing.T) {
224214
}
225215
},
226216
Enabled: func() bool {
227-
// Enable if at least one database is available
228-
return postgresURI != "" || mysqlURI != ""
217+
// Always enabled - tests will fail if databases aren't available
218+
return true
229219
},
230220
},
231221
}

internal/sqltest/local/mysql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func MySQL(t *testing.T, migrations []string) string {
4040
}
4141
dburi = u
4242
} else {
43-
t.Skip("MYSQL_SERVER_URI is empty and neither Docker nor native installation is available")
43+
t.Fatal("MYSQL_SERVER_URI is empty and neither Docker nor native installation is available")
4444
}
4545
}
4646

internal/sqltest/local/postgres.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func postgreSQL(t *testing.T, migrations []string, rw bool) string {
5050
}
5151
dburi = u
5252
} else {
53-
t.Skip("POSTGRESQL_SERVER_URI is empty and neither Docker nor native installation is available")
53+
t.Fatal("POSTGRESQL_SERVER_URI is empty and neither Docker nor native installation is available")
5454
}
5555
}
5656

0 commit comments

Comments
 (0)