From 99f08ea055df71b9a9a07f1fe7216fd73c39d391 Mon Sep 17 00:00:00 2001 From: Renan Rangel Date: Mon, 9 Sep 2024 04:40:46 -0700 Subject: [PATCH] fixing tests Signed-off-by: Renan Rangel --- go/vt/wrangler/testlib/backup_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/go/vt/wrangler/testlib/backup_test.go b/go/vt/wrangler/testlib/backup_test.go index 75c5673b5f8..44d7d1c01f3 100644 --- a/go/vt/wrangler/testlib/backup_test.go +++ b/go/vt/wrangler/testlib/backup_test.go @@ -312,12 +312,21 @@ func testBackupRestore(t *testing.T, cDetails *compressionDetails) error { assert.True(t, primary.FakeMysqlDaemon.Running) // restore primary when database already exists - // checkNoDb should return false - // so fake the necessary queries + // we expect it to wipe the current database and + // do the restore so fake the necessary queries primary.FakeMysqlDaemon.FetchSuperQueryMap = map[string]*sqltypes.Result{ "SHOW DATABASES": {Rows: [][]sqltypes.Value{{sqltypes.NewVarBinary("vt_test_keyspace")}}}, "SHOW TABLES FROM `vt_test_keyspace`": {Rows: [][]sqltypes.Value{{sqltypes.NewVarBinary("a")}}}, } + primary.FakeMysqlDaemon.ExpectedExecuteSuperQueryCurrent = 0 + primary.FakeMysqlDaemon.ExpectedExecuteSuperQueryList = []string{ + "FAKE RESET BINARY LOGS AND GTIDS", + "FAKE SET GLOBAL gtid_purged", + "STOP REPLICA", + "FAKE RESET REPLICA ALL", + "FAKE RESET BINARY LOGS AND GTIDS", + "FAKE SET GLOBAL gtid_purged", + } // Test restore with the backup timestamp require.NoError(t, primary.TM.RestoreData(ctx, logutil.NewConsoleLogger(), 0 /* waitForBackupInterval */, backupTime, time.Time{} /* restoreToTimestamp */, "", mysqlShutdownTimeout),