Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-20.0] fix flaky test TestQueryTimeoutWithShardTargeting (#16150) #16179

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions go/test/endtoend/vtgate/queries/timeout/timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,18 @@ func TestQueryTimeoutWithShardTargeting(t *testing.T) {
// insert some data
utils.Exec(t, mcmp.VtConn, "insert into t1(id1, id2) values (1,2),(3,4),(4,5),(5,6)")

// insert
_, err := utils.ExecAllowError(t, mcmp.VtConn, "insert /*vt+ QUERY_TIMEOUT_MS=1 */ into t1(id1, id2) values (6,sleep(5))")
assert.ErrorContains(t, err, "context deadline exceeded (errno 1317) (sqlstate 70100)")

// update
_, err = utils.ExecAllowError(t, mcmp.VtConn, "update /*vt+ QUERY_TIMEOUT_MS=1 */ t1 set id2 = sleep(5)")
assert.ErrorContains(t, err, "context deadline exceeded (errno 1317) (sqlstate 70100)")

// delete
_, err = utils.ExecAllowError(t, mcmp.VtConn, "delete /*vt+ QUERY_TIMEOUT_MS=1 */ from t1 where id2 = sleep(5)")
assert.ErrorContains(t, err, "context deadline exceeded (errno 1317) (sqlstate 70100)")
queries := []string{
"insert /*vt+ QUERY_TIMEOUT_MS=1 */ into t1(id1, id2) values (6,sleep(5))",
"update /*vt+ QUERY_TIMEOUT_MS=1 */ t1 set id2 = sleep(5)",
"delete /*vt+ QUERY_TIMEOUT_MS=1 */ from t1 where id2 = sleep(5)",
"select /*vt+ QUERY_TIMEOUT_MS=1 */ 1 from t1 where id2 = 5 and sleep(100)",
}

// select
_, err = utils.ExecAllowError(t, mcmp.VtConn, "select /*vt+ QUERY_TIMEOUT_MS=1 */ 1 from t1 where id2 = 5 and sleep(100)")
assert.ErrorContains(t, err, "context deadline exceeded (errno 1317) (sqlstate 70100)")
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")
assert.ErrorContains(t, err, "(errno 1317) (sqlstate 70100)")
})
}
}
Loading