Skip to content

Commit

Permalink
Merge #102187
Browse files Browse the repository at this point in the history
102187: sql/tests: deflake TestErrorDuringExtendedProtocolCommit (again) r=rafiss a=rafiss

This fixes a race condition with how the error gets injected.

fixes #101217
Release note: None

Co-authored-by: Rafi Shamim <[email protected]>
  • Loading branch information
craig[bot] and rafiss committed Apr 28, 2023
2 parents 8807140 + 3fda043 commit 3b1bc87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sql/tests/autocommit_extended_protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ func TestErrorDuringExtendedProtocolCommit(t *testing.T) {
},
BeforeAutoCommit: func(ctx context.Context, stmt string) error {
if shouldErrorOnAutoCommit.Get() {
shouldErrorOnAutoCommit.Set(false)
// Only inject the error if we're in the same trace as the one we
// saw when executing our test query. This is so we know that this
// autocommit corresponds to our test qyery rather than an internal
// query.
if traceID == tracing.SpanFromContext(ctx).TraceID() {
shouldErrorOnAutoCommit.Set(false)
return errors.New("injected error")
}
}
Expand Down

0 comments on commit 3b1bc87

Please sign in to comment.