Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Renan Rangel <[email protected]>
  • Loading branch information
rvrangel committed Sep 9, 2024
1 parent e62ae95 commit 99f08ea
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions go/vt/wrangler/testlib/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 99f08ea

Please sign in to comment.