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-23.1: roachtest: allow opting out of post validation(s) #99398

Merged
Merged
Show file tree
Hide file tree
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
19 changes: 19 additions & 0 deletions pkg/cmd/roachtest/registry/test_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,29 @@ type TestSpec struct {
// cannot be run with encryption enabled.
EncryptionSupport EncryptionSupport

// SkipPostValidations is a bit-set of post-validations that should be skipped
// after the test completes. This is useful for tests that are known to be
// incompatible with some validations. By default, tests will run all
// validations.
SkipPostValidations PostValidation

// Run is the test function.
Run func(ctx context.Context, t test.Test, c cluster.Cluster)
}

// PostValidation is a type of post-validation that runs after a test completes.
type PostValidation int

const (
// PostValidationReplicaDivergence detects replica divergence (i.e. ranges in
// which replicas have arrived at the same log position with different
// states).
PostValidationReplicaDivergence PostValidation = 1 << iota
// PostValidationInvalidDescriptors checks if there exists any descriptors in
// the crdb_internal.invalid_objects virtual table.
PostValidationInvalidDescriptors
)

// MatchType is the type of match a file has to a TestFilter.
type MatchType int

Expand Down
8 changes: 6 additions & 2 deletions pkg/cmd/roachtest/test_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -1099,10 +1099,14 @@ func (r *testRunner) teardownTest(
if db != nil {
defer db.Close()
t.L().Printf("running validation checks on node %d (<10m)", node)
c.FailOnInvalidDescriptors(ctx, db, t)
if t.spec.SkipPostValidations&registry.PostValidationInvalidDescriptors == 0 {
c.FailOnInvalidDescriptors(ctx, db, t)
}
// Detect replica divergence (i.e. ranges in which replicas have arrived
// at the same log position with different states).
c.FailOnReplicaDivergence(ctx, db, t)
if t.spec.SkipPostValidations&registry.PostValidationReplicaDivergence == 0 {
c.FailOnReplicaDivergence(ctx, db, t)
}
} else {
t.L().Printf("no live node found, skipping validation checks")
}
Expand Down
22 changes: 12 additions & 10 deletions pkg/cmd/roachtest/tests/loss_of_quorum_recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,23 @@ func registerLOQRecovery(r registry.Registry) {
} {
testSpec := s
r.Add(registry.TestSpec{
Name: s.testName(""),
Owner: registry.OwnerReplication,
Tags: []string{`default`},
Cluster: spec,
NonReleaseBlocker: true,
Name: s.testName(""),
Owner: registry.OwnerReplication,
Tags: []string{`default`},
Cluster: spec,
SkipPostValidations: registry.PostValidationInvalidDescriptors,
NonReleaseBlocker: true,
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
runRecoverLossOfQuorum(ctx, t, c, testSpec)
},
})
r.Add(registry.TestSpec{
Name: s.testName("half-online"),
Owner: registry.OwnerReplication,
Tags: []string{`default`},
Cluster: spec,
NonReleaseBlocker: true,
Name: s.testName("half-online"),
Owner: registry.OwnerReplication,
Tags: []string{`default`},
Cluster: spec,
SkipPostValidations: registry.PostValidationInvalidDescriptors,
NonReleaseBlocker: true,
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
runHalfOnlineRecoverLossOfQuorum(ctx, t, c, testSpec)
},
Expand Down