[wip] add run tests

This commit is contained in:
Simon Vieille 2024-03-20 14:18:07 +01:00
commit 0b598ef0b2
Signed by untrusted user: deblan
GPG key ID: 579388D585F70417
2 changed files with 17 additions and 9 deletions

View file

@ -49,14 +49,21 @@ func TestAppRun(t *testing.T) {
db, _ := sql.Open(databaseConfig.Type, databaseConfig.Dsn)
schema, _ := config.LoadSchemaConfigFromFile("../tests/schema.yml")
app := App{}
app.Run(db, schema, faker.NewFakeManager(), databaseConfig)
dsns := []string{
"mysql://tcp(service-mysql)/test",
// "postgres://postgres@tcp(service-postgres)/test",
}
var count int
row := db.QueryRow("SELECT COUNT(*) FROM `table_truncate1`")
row.Scan(&count)
for dns := range dsns {
app := App{}
app.Run(db, schema, faker.NewFakeManager(), databaseConfig)
if count != 0 {
t.Fatalf("TestAppRuny: table_truncate1 check failed")
var count int
row := db.QueryRow("SELECT COUNT(*) FROM table_truncate1")
row.Scan(&count)
if count != 0 {
t.Fatalf("TestAppRuny: table_truncate1 check failed")
}
}
}