Skip to content

Commit ccc533d

Browse files
committed
roachtest: add PostValidationAll
Minor refactoring to simplify the expression of "exclude all post-validation" checks. Epic: none Release note: None
1 parent e8afcff commit ccc533d

File tree

3 files changed

+32
-23
lines changed

3 files changed

+32
-23
lines changed

pkg/cmd/roachtest/registry/test_spec.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,12 @@ func (ts *TestSpec) GetPostProcessWorkloadMetricsFunction() func(string, *roacht
226226
}
227227

228228
// PostValidation is a type of post-validation that runs after a test completes.
229+
// By default, all validations are run unless TestSpec.SkipPostValidations is set to a bitwise OR
230+
// of the validations to skip.
231+
//
232+
// E.g., SkipPostValidations : PostValidationReplicaDivergence | PostValidationInvalidDescriptors
233+
// would skip the replica divergence and invalid descriptors validations and run the rest.
234+
// SkipPostValidations: PostValidationAll would skip _all_ validations.
229235
type PostValidation int
230236

231237
const (
@@ -241,6 +247,8 @@ const (
241247
// In its current state it is no longer functional.
242248
// See: https://github.com/cockroachdb/cockroach/issues/137329 for details.
243249
PostValidationNoDeadNodes
250+
// PostValidationAll is a bitwise OR of all post-validations to skip.
251+
PostValidationAll = PostValidationReplicaDivergence | PostValidationInvalidDescriptors | PostValidationNoDeadNodes
244252
)
245253

246254
// PromSub replaces all non prometheus friendly chars with "_". Note,

pkg/cmd/roachtest/test_runner.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,10 +1445,13 @@ func (r *testRunner) runTest(
14451445
// We still want to run the post-test assertions even if the test timed out as it
14461446
// might provide useful information about the health of the nodes. Any assertion failures
14471447
// will be recorded against, and eventually fail, the test.
1448-
if err := r.postTestAssertions(ctx, t, c, 10*time.Minute); err != nil {
1449-
l.Printf("error during post test assertions: %v; see test-post-assertions.log for details", err)
1448+
if t.spec.SkipPostValidations != registry.PostValidationAll {
1449+
if err := r.postTestAssertions(ctx, t, c, 10*time.Minute); err != nil {
1450+
l.Printf("error during post test assertions: %v; see test-post-assertions.log for details", err)
1451+
}
1452+
} else {
1453+
l.Printf("skipping all post test assertions due to `PostValidationAll`")
14501454
}
1451-
14521455
} else {
14531456
l.Printf("skipping post test assertions as test failed")
14541457
}

pkg/cmd/roachtest/tests/loss_of_quorum_recovery.go

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,31 +66,29 @@ func registerLOQRecovery(r registry.Registry) {
6666
} {
6767
testSpec := s
6868
r.Add(registry.TestSpec{
69-
Name: s.testName(""),
70-
Owner: registry.OwnerKV,
71-
Benchmark: true,
72-
CompatibleClouds: registry.AllExceptAWS,
73-
Suites: registry.Suites(registry.Nightly),
74-
Cluster: spec,
75-
Leases: registry.MetamorphicLeases,
76-
SkipPostValidations: registry.PostValidationReplicaDivergence |
77-
registry.PostValidationInvalidDescriptors | registry.PostValidationNoDeadNodes,
78-
NonReleaseBlocker: true,
69+
Name: s.testName(""),
70+
Owner: registry.OwnerKV,
71+
Benchmark: true,
72+
CompatibleClouds: registry.AllExceptAWS,
73+
Suites: registry.Suites(registry.Nightly),
74+
Cluster: spec,
75+
Leases: registry.MetamorphicLeases,
76+
SkipPostValidations: registry.PostValidationAll,
77+
NonReleaseBlocker: true,
7978
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
8079
runRecoverLossOfQuorum(ctx, t, c, testSpec)
8180
},
8281
})
8382
r.Add(registry.TestSpec{
84-
Name: s.testName("half-online"),
85-
Owner: registry.OwnerKV,
86-
Benchmark: true,
87-
CompatibleClouds: registry.AllExceptAWS,
88-
Suites: registry.Suites(registry.Nightly),
89-
Cluster: spec,
90-
Leases: registry.MetamorphicLeases,
91-
SkipPostValidations: registry.PostValidationReplicaDivergence |
92-
registry.PostValidationInvalidDescriptors | registry.PostValidationNoDeadNodes,
93-
NonReleaseBlocker: true,
83+
Name: s.testName("half-online"),
84+
Owner: registry.OwnerKV,
85+
Benchmark: true,
86+
CompatibleClouds: registry.AllExceptAWS,
87+
Suites: registry.Suites(registry.Nightly),
88+
Cluster: spec,
89+
Leases: registry.MetamorphicLeases,
90+
SkipPostValidations: registry.PostValidationAll,
91+
NonReleaseBlocker: true,
9492
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
9593
runHalfOnlineRecoverLossOfQuorum(ctx, t, c, testSpec)
9694
},

0 commit comments

Comments
 (0)