Skip to content

Commit

Permalink
test: update test expectation with savepoint
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <[email protected]>
  • Loading branch information
harshit-gangal committed Oct 8, 2024
1 parent e8ada40 commit 69878ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 37 deletions.
38 changes: 2 additions & 36 deletions go/test/endtoend/transaction/twopc/twopc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1119,10 +1119,8 @@ func TestDTSavepoint(t *testing.T) {
"delete:[VARCHAR(\"dtid-1\") VARCHAR(\"PREPARE\")]",
},
"ks.redo_statement:80-": {
"insert:[VARCHAR(\"dtid-1\") INT64(1) BLOB(\"savepoint-1\")]",
"insert:[VARCHAR(\"dtid-1\") INT64(2) BLOB(\"insert into twopc_user(id, `name`) values (7, 'foo')\")]",
"delete:[VARCHAR(\"dtid-1\") INT64(1) BLOB(\"savepoint-1\")]",
"delete:[VARCHAR(\"dtid-1\") INT64(2) BLOB(\"insert into twopc_user(id, `name`) values (7, 'foo')\")]",
"insert:[VARCHAR(\"dtid-1\") INT64(1) BLOB(\"insert into twopc_user(id, `name`) values (7, 'foo')\")]",
"delete:[VARCHAR(\"dtid-1\") INT64(1) BLOB(\"insert into twopc_user(id, `name`) values (7, 'foo')\")]",
},
"ks.twopc_user:40-80": {"insert:[INT64(8) VARCHAR(\"bar\")]"},
"ks.twopc_user:80-": {"insert:[INT64(7) VARCHAR(\"foo\")]"},
Expand Down Expand Up @@ -1164,20 +1162,6 @@ func TestDTSavepoint(t *testing.T) {
"update:[VARCHAR(\"dtid-2\") VARCHAR(\"COMMIT\")]",
"delete:[VARCHAR(\"dtid-2\") VARCHAR(\"COMMIT\")]",
},
"ks.redo_state:80-": {
"insert:[VARCHAR(\"dtid-2\") VARCHAR(\"PREPARE\")]",
"delete:[VARCHAR(\"dtid-2\") VARCHAR(\"PREPARE\")]",
},
"ks.redo_statement:80-": {
"insert:[VARCHAR(\"dtid-2\") INT64(1) BLOB(\"savepoint-2\")]",
"insert:[VARCHAR(\"dtid-2\") INT64(2) BLOB(\"savepoint-3\")]",
"insert:[VARCHAR(\"dtid-2\") INT64(3) BLOB(\"update twopc_user set `name` = 'temp' where id = 7 limit 10001 /* INT64 */\")]",
"insert:[VARCHAR(\"dtid-2\") INT64(4) BLOB(\"rollback-2\")]",
"delete:[VARCHAR(\"dtid-2\") INT64(1) BLOB(\"savepoint-2\")]",
"delete:[VARCHAR(\"dtid-2\") INT64(2) BLOB(\"savepoint-3\")]",
"delete:[VARCHAR(\"dtid-2\") INT64(3) BLOB(\"update twopc_user set `name` = 'temp' where id = 7 limit 10001 /* INT64 */\")]",
"delete:[VARCHAR(\"dtid-2\") INT64(4) BLOB(\"rollback-2\")]",
},
}
assert.Equal(t, expectations, logTable,
"mismatch expected: \n got: %s, want: %s", prettyPrint(logTable), prettyPrint(expectations))
Expand All @@ -1202,20 +1186,6 @@ func TestDTSavepoint(t *testing.T) {
"update:[VARCHAR(\"dtid-3\") VARCHAR(\"COMMIT\")]",
"delete:[VARCHAR(\"dtid-3\") VARCHAR(\"COMMIT\")]",
},
"ks.redo_state:80-": {
"insert:[VARCHAR(\"dtid-3\") VARCHAR(\"PREPARE\")]",
"delete:[VARCHAR(\"dtid-3\") VARCHAR(\"PREPARE\")]",
},
"ks.redo_statement:80-": {
"insert:[VARCHAR(\"dtid-3\") INT64(1) BLOB(\"savepoint-2\")]",
"insert:[VARCHAR(\"dtid-3\") INT64(2) BLOB(\"savepoint-3\")]",
"insert:[VARCHAR(\"dtid-3\") INT64(3) BLOB(\"update twopc_user set `name` = 'temp' where id = 7 limit 10001 /* INT64 */\")]",
"insert:[VARCHAR(\"dtid-3\") INT64(4) BLOB(\"rollback-3\")]",
"delete:[VARCHAR(\"dtid-3\") INT64(1) BLOB(\"savepoint-2\")]",
"delete:[VARCHAR(\"dtid-3\") INT64(2) BLOB(\"savepoint-3\")]",
"delete:[VARCHAR(\"dtid-3\") INT64(3) BLOB(\"update twopc_user set `name` = 'temp' where id = 7 limit 10001 /* INT64 */\")]",
"delete:[VARCHAR(\"dtid-3\") INT64(4) BLOB(\"rollback-3\")]",
},
"ks.twopc_user:-40": {"insert:[INT64(10) VARCHAR(\"apa\")]"},
}
assert.Equal(t, expectations, logTable,
Expand Down Expand Up @@ -1246,11 +1216,7 @@ func TestDTSavepoint(t *testing.T) {
},
"ks.redo_statement:80-": {
"insert:[VARCHAR(\"dtid-4\") INT64(1) BLOB(\"update twopc_user set `name` = 'temp1' where id = 7 limit 10001 /* INT64 */\")]",
"insert:[VARCHAR(\"dtid-4\") INT64(2) BLOB(\"savepoint-4\")]",
"insert:[VARCHAR(\"dtid-4\") INT64(3) BLOB(\"rollback-4\")]",
"delete:[VARCHAR(\"dtid-4\") INT64(1) BLOB(\"update twopc_user set `name` = 'temp1' where id = 7 limit 10001 /* INT64 */\")]",
"delete:[VARCHAR(\"dtid-4\") INT64(2) BLOB(\"savepoint-4\")]",
"delete:[VARCHAR(\"dtid-4\") INT64(3) BLOB(\"rollback-4\")]",
},
"ks.twopc_user:80-": {"update:[INT64(7) VARCHAR(\"temp1\")]"},
}
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/endtoend/savepoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func TestSavepointInTransactionWithRelease(t *testing.T) {
diff int
}{{
tag: "Queries/Histograms/Savepoint/Count",
diff: 1,
diff: 2, // savepoint a (post-begin) and savepoint b
}, {
tag: "Queries/Histograms/Release/Count",
diff: 1,
Expand Down

0 comments on commit 69878ba

Please sign in to comment.