diff --git a/tests/history_bench_test.go b/tests/history_bench_test.go index e1ea0d211..7182c635b 100644 --- a/tests/history_bench_test.go +++ b/tests/history_bench_test.go @@ -27,10 +27,7 @@ func BenchmarkHistory(b *testing.B) { } func benchmarkHistory(b *testing.B, numComments int64) { - m := it.MysqlDatabase() - defer m.Cleanup() - m.ImportIcingaDbSchema() - + rdb := getDatabase(b) r := it.RedisServer() defer r.Cleanup() n := it.Icinga2Node("master") @@ -39,8 +36,8 @@ func benchmarkHistory(b *testing.B, numComments int64) { err := n.Reload() require.NoError(b, err, "icinga2 should reload without error") - db, err := sqlx.Connect("mysql", m.DSN()) - require.NoError(b, err, "connecting to mysql") + db, err := sqlx.Connect(rdb.Driver(), rdb.DSN()) + require.NoError(b, err, "connecting to database") defer func() { _ = db.Close() }() redisClient := r.Open() @@ -97,7 +94,7 @@ func benchmarkHistory(b *testing.B, numComments int64) { b.Logf("current stream length: %d", lastPending) b.StartTimer() - idb := it.IcingaDbInstance(r, m) + idb := it.IcingaDbInstance(r, rdb) defer idb.Cleanup() ticker := time.NewTicker(5 * time.Millisecond) diff --git a/tests/history_test.go b/tests/history_test.go index e720f024a..eb6110233 100644 --- a/tests/history_test.go +++ b/tests/history_test.go @@ -143,7 +143,7 @@ func testHistory(t *testing.T, numNodes int) { }, 15*time.Second, 200*time.Millisecond) db, err := sqlx.Connect(rdb.Driver(), rdb.DSN()) - require.NoError(t, err, "connecting to mysql") + require.NoError(t, err, "connecting to database") t.Cleanup(func() { _ = db.Close() }) client := nodes[0].IcingaClient diff --git a/tests/sla_test.go b/tests/sla_test.go index 6fa3a0e95..597f5a05b 100644 --- a/tests/sla_test.go +++ b/tests/sla_test.go @@ -18,15 +18,14 @@ import ( ) func TestSla(t *testing.T) { - m := it.MysqlDatabaseT(t) - m.ImportIcingaDbSchema() + rdb := getDatabase(t) r := it.RedisServerT(t) i := it.Icinga2NodeT(t, "master") i.EnableIcingaDb(r) err := i.Reload() require.NoError(t, err, "icinga2 should reload without error") - it.IcingaDbInstanceT(t, r, m) + it.IcingaDbInstanceT(t, r, rdb) client := i.ApiClient() @@ -109,8 +108,8 @@ func TestSla(t *testing.T) { assert.Equal(t, 3, len(stateChanges), "there should be three hard state changes") - db, err := sqlx.Connect("mysql", m.DSN()) - require.NoError(t, err, "connecting to mysql") + db, err := sqlx.Connect(rdb.Driver(), rdb.DSN()) + require.NoError(t, err, "connecting to database") defer func() { _ = db.Close() }() type Row struct { @@ -248,8 +247,8 @@ func TestSla(t *testing.T) { End int64 `db:"downtime_end"` } - db, err := sqlx.Connect("mysql", m.DSN()) - require.NoError(t, err, "connecting to mysql") + db, err := sqlx.Connect(rdb.Driver(), rdb.DSN()) + require.NoError(t, err, "connecting to database") defer func() { _ = db.Close() }() if !o.Fixed {