Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Priya Bibra <[email protected]>
  • Loading branch information
pbibra committed Jul 21, 2023
1 parent 99775b7 commit 632cd3c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions go/test/endtoend/recovery/unshardedrecovery/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ var (
"--serving_state_grace_period", "1s"}
recoveryKS1 = "recovery_ks1"
recoveryKS2 = "recovery_ks2"
recoveryKS3 = "recovery_ks3"
vtInsertTest = `create table vt_insert_test (
id bigint auto_increment,
msg varchar(64),
Expand Down Expand Up @@ -208,10 +209,17 @@ func TestRecoveryImpl(t *testing.T) {
require.Equal(t, len(backups), 1)
assert.Contains(t, backups[0], replica1.Alias)

err = localCluster.VtctlclientProcess.ApplyVSchema(keyspaceName, vSchema)
assert.NoError(t, err)

output, err := localCluster.VtctlclientProcess.ExecuteCommandWithOutput("GetVSchema", keyspaceName)
assert.NoError(t, err)
assert.Contains(t, output, "vt_insert_test")

// restore with latest backup
recovery.RestoreTablet(t, localCluster, replica2, recoveryKS1, "0", keyspaceName, commonTabletArg, time.Time{})

output, err := localCluster.VtctlclientProcess.ExecuteCommandWithOutput("GetSrvVSchema", cell)
output, err = localCluster.VtctlclientProcess.ExecuteCommandWithOutput("GetSrvVSchema", cell)
assert.NoError(t, err)
assert.Contains(t, output, keyspaceName)
assert.Contains(t, output, recoveryKS1)
Expand All @@ -237,13 +245,6 @@ func TestRecoveryImpl(t *testing.T) {
assert.NoError(t, err)
cluster.VerifyRowsInTablet(t, replica1, keyspaceName, 2)

err = localCluster.VtctlclientProcess.ApplyVSchema(keyspaceName, vSchema)
assert.NoError(t, err)

output, err = localCluster.VtctlclientProcess.ExecuteCommandWithOutput("GetVSchema", keyspaceName)
assert.NoError(t, err)
assert.Contains(t, output, "vt_insert_test")

// update the original row in primary
_, err = primary.VttabletProcess.QueryTablet("update vt_insert_test set msg = 'msgx1' where id = 1", keyspaceName, true)
assert.NoError(t, err)
Expand Down Expand Up @@ -291,8 +292,8 @@ func TestRecoveryImpl(t *testing.T) {
assert.NoError(t, err)

// restore to second backup
recovery.RestoreTablet(t, localCluster, replica4, recoveryKS2, "0", keyspaceName, commonTabletArg, backupTime)
output, err = localCluster.VtctlclientProcess.ExecuteCommandWithOutput("GetVSchema", recoveryKS2)
recovery.RestoreTablet(t, localCluster, replica4, recoveryKS3, "0", keyspaceName, commonTabletArg, backupTime)
output, err = localCluster.VtctlclientProcess.ExecuteCommandWithOutput("GetVSchema", recoveryKS3)
assert.NoError(t, err)
assert.Contains(t, output, "vt_insert_test")

Expand Down

0 comments on commit 632cd3c

Please sign in to comment.