Skip to content

Commit

Permalink
roachtest: ignore injected error in sqlsmith in some cases
Browse files Browse the repository at this point in the history
We enable vectorized panic injection in `sqlsmith` roachtest, and we
generally don't expect it to be propagated all the way as "internal
error". However, sqlsmith itself issues some queries (like fetching all
DB regions) which might hit this injected error which will result in
a panic during `smither.Generate` call - we want to ignore such cases.

Release note: None
  • Loading branch information
yuzefovich committed Apr 5, 2024
1 parent 9be9728 commit 2882a66
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions pkg/cmd/roachtest/tests/sqlsmith.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,24 @@ WITH into_db = 'defaultdb', unsafe_restore_incompatible_version;
logStmt(stmt)
t.Fatalf("error: %s\nstmt:\n%s;", err, stmt)
}
} else if strings.Contains(es, "Empty statement returned by generate") ||
stmt == "" {
// Either were unable to generate a statement or
// we panicked making one.
t.Fatalf("Failed generating a query %s", err)
} else {
if strings.Contains(es, "Empty statement returned by generate") {
// We were unable to generate a statement - this is
// never expected.
t.Fatalf("Failed generating a query %s", err)
}
if stmt == "" {
// We panicked when generating a statement.
//
// The panic might be expected if it was a vectorized
// panic that was injected when sqlsmith itself issued a
// query to generate another query (for example, in
// getDatabaseRegions).
expectedError := strings.Contains(es, "injected panic in ")
if !expectedError {
t.Fatalf("Panicked when generating a query %s", err)
}
}
}
// Ignore other errors because they happen so
// frequently (due to sqlsmith not crafting
Expand Down

0 comments on commit 2882a66

Please sign in to comment.