Skip to content

Commit 3ae3365

Browse files
craig[bot]DarrylWongkev-cao
committed
147349: roachtest: use failure injection library for disk stalls r=herkolategan a=DarrylWong This change switches the roachtestutil disk staller to using the failureinjection library instead. We keep the roachtestutil disk staller interface for now, as it still provides some additional cluster spec validation, but will be replaced completely in the future. Informs: #138970 Release note: none 148242: crosscluster: do not panic on poorly formatted inline certs r=jeffswenson,stevendanna a=kev-cao Previously, when parsing inline SSL certificates in an external connection, if the certificate was not formatted correctly we would run into a panic from a nil pointer. This fixes the parser to properly surface an error instead of crashing. Epic: CRDB-50820 Fixes: #145949 Release note: CockroachDB now raises an error when encountering improper inline SSL credentials instead of panicking. Co-authored-by: DarrylWong <[email protected]> Co-authored-by: Kevin Cao <[email protected]>
3 parents 244c9dc + 65fe8d6 + 3e0d065 commit 3ae3365

25 files changed

+462
-229
lines changed

pkg/cmd/roachtest/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ go_library(
4848
"//pkg/roachprod/cloud",
4949
"//pkg/roachprod/config",
5050
"//pkg/roachprod/errors",
51+
"//pkg/roachprod/failureinjection/failures",
5152
"//pkg/roachprod/install",
5253
"//pkg/roachprod/logger",
5354
"//pkg/roachprod/prometheus",

pkg/cmd/roachtest/cluster.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import (
4242
"github.com/cockroachdb/cockroach/pkg/roachprod"
4343
"github.com/cockroachdb/cockroach/pkg/roachprod/cloud"
4444
"github.com/cockroachdb/cockroach/pkg/roachprod/config"
45+
"github.com/cockroachdb/cockroach/pkg/roachprod/failureinjection/failures"
4546
"github.com/cockroachdb/cockroach/pkg/roachprod/install"
4647
"github.com/cockroachdb/cockroach/pkg/roachprod/logger"
4748
"github.com/cockroachdb/cockroach/pkg/roachprod/prometheus"
@@ -3311,3 +3312,20 @@ func (c *clusterImpl) RegisterClusterHook(
33113312
panic(fmt.Sprintf("unknown test hook type %v", hookType))
33123313
}
33133314
}
3315+
3316+
// GetFailer returns a *failures.Failer for the given failure mode name. Used
3317+
// for conducting failure injection on a cluster.
3318+
func (c *clusterImpl) GetFailer(
3319+
l *logger.Logger,
3320+
nodes option.NodeListOption,
3321+
failureModeName string,
3322+
opts ...failures.ClusterOptionFunc,
3323+
) (*failures.Failer, error) {
3324+
fr := failures.GetFailureRegistry()
3325+
clusterOpts := append(opts, failures.Secure(c.IsSecure()))
3326+
failer, err := fr.GetFailer(c.MakeNodes(nodes), failureModeName, l, clusterOpts...)
3327+
if err != nil {
3328+
return nil, err
3329+
}
3330+
return failer, err
3331+
}

pkg/cmd/roachtest/cluster/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ go_library(
1515
"//pkg/cmd/roachtest/option",
1616
"//pkg/cmd/roachtest/spec",
1717
"//pkg/roachprod",
18+
"//pkg/roachprod/failureinjection/failures",
1819
"//pkg/roachprod/install",
1920
"//pkg/roachprod/logger",
2021
"//pkg/roachprod/prometheus",

pkg/cmd/roachtest/cluster/cluster_interface.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
1616
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/spec"
1717
"github.com/cockroachdb/cockroach/pkg/roachprod"
18+
"github.com/cockroachdb/cockroach/pkg/roachprod/failureinjection/failures"
1819
"github.com/cockroachdb/cockroach/pkg/roachprod/install"
1920
"github.com/cockroachdb/cockroach/pkg/roachprod/logger"
2021
"github.com/cockroachdb/cockroach/pkg/roachprod/prometheus"
@@ -215,4 +216,6 @@ type Cluster interface {
215216
GetPreemptedVMs(ctx context.Context, l *logger.Logger) ([]vm.PreemptedVM, error)
216217

217218
RegisterClusterHook(hookName string, hookType option.ClusterHookType, timeout time.Duration, hook func(context.Context) error)
219+
220+
GetFailer(l *logger.Logger, nodes option.NodeListOption, failureModeName string, opts ...failures.ClusterOptionFunc) (*failures.Failer, error)
218221
}

pkg/cmd/roachtest/clusterstats/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ go_library(
2121
# Required for generated mocks
2222
"//pkg/roachprod", #keep
2323
# Required for generated mocks
24+
"//pkg/roachprod/failureinjection/failures", #keep
2425
"//pkg/roachprod/install", #keep
2526
"//pkg/roachprod/logger",
2627
"//pkg/roachprod/prometheus",

pkg/cmd/roachtest/clusterstats/mock_cluster_generated_test.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)