Skip to content

Commit cd1aa92

Browse files
committed
Fix robustness test logs by identifing failpoint availability on temporary cluster before creating subtest
Signed-off-by: Marek Siarkowicz <[email protected]>
1 parent 2b32307 commit cd1aa92

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

tests/robustness/main_test.go

+25-8
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,39 @@ func TestMain(m *testing.M) {
5353
func TestRobustnessExploratory(t *testing.T) {
5454
testRunner.BeforeTest(t)
5555
for _, s := range scenarios.Exploratory(t) {
56-
t.Run(s.Name, func(t *testing.T) {
56+
ctx := context.Background()
57+
s.Failpoint = randomFailpointForConfig(ctx, t, s.Profile, s.Cluster)
58+
t.Run(s.Name+"/"+s.Failpoint.Name(), func(t *testing.T) {
5759
lg := zaptest.NewLogger(t)
5860
s.Cluster.Logger = lg
59-
ctx := context.Background()
6061
c, err := e2e.NewEtcdProcessCluster(ctx, t, e2e.WithConfig(&s.Cluster))
61-
require.NoError(t, err)
62+
if err != nil {
63+
t.Fatal(err)
64+
}
6265
defer forcestopCluster(c)
63-
s.Failpoint, err = failpoint.PickRandom(c, s.Profile)
64-
require.NoError(t, err)
65-
t.Run(s.Failpoint.Name(), func(t *testing.T) {
66-
testRobustness(ctx, t, lg, s, c)
67-
})
66+
testRobustness(ctx, t, lg, s, c)
6867
})
6968
}
7069
}
7170

71+
// TODO: Implement lightweight a way to generate list of failpoints without needing to start a cluster
72+
func randomFailpointForConfig(ctx context.Context, t *testing.T, profile traffic.Profile, config e2e.EtcdProcessClusterConfig) failpoint.Failpoint {
73+
config.Logger = zap.NewNop()
74+
c, err := e2e.NewEtcdProcessCluster(ctx, t, e2e.WithConfig(&config))
75+
if err != nil {
76+
t.Fatal(err)
77+
}
78+
f, err := failpoint.PickRandom(c, profile)
79+
if err != nil {
80+
t.Fatal(err)
81+
}
82+
err = forcestopCluster(c)
83+
if err != nil {
84+
t.Fatal(err)
85+
}
86+
return f
87+
}
88+
7289
func TestRobustnessRegression(t *testing.T) {
7390
testRunner.BeforeTest(t)
7491
for _, s := range scenarios.Regression(t) {

0 commit comments

Comments
 (0)