Skip to content

Commit

Permalink
test: added e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <[email protected]>
  • Loading branch information
harshit-gangal committed May 9, 2024
1 parent 360af06 commit d143f2a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions go/test/endtoend/vtgate/queries/timeout/timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,26 @@ func TestQueryTimeoutWithTables(t *testing.T) {
assert.Contains(t, err.Error(), "context deadline exceeded")
assert.Contains(t, err.Error(), "(errno 1317) (sqlstate 70100)")
}

// TestQueryTimeoutWithShardTargeting tests the query timeout with shard targeting.
func TestQueryTimeoutWithShardTargeting(t *testing.T) {
mcmp, closer := start(t)
defer closer()

queries := []string{
"insert /*vt+ QUERY_TIMEOUT_MS=1 */ into t1(id1, id2) values (1,2)",
"update /*vt+ QUERY_TIMEOUT_MS=1 */ t1 set id2 = 5",
"delete /*vt+ QUERY_TIMEOUT_MS=1 */ from t1 where id2 = 5",
"select /*vt+ QUERY_TIMEOUT_MS=1 */ 1 from t1 where sleep(100)",
}

// shard targeting to -80 shard.
utils.Exec(t, mcmp.VtConn, "use `ks_misc/-80`")

for _, query := range queries {
t.Run(query, func(t *testing.T) {
_, err := utils.ExecAllowError(t, mcmp.VtConn, query)
assert.ErrorContains(t, err, "context deadline exceeded (errno 1317) (sqlstate 70100)")
})
}
}
2 changes: 1 addition & 1 deletion go/vt/vtgate/engine/cached_size.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d143f2a

Please sign in to comment.