Skip to content

Commit 7ffb8c0

Browse files
committed
Add robustness test scenario for issue #20221 (fix #20229)
Signed-off-by: Chun-Hung Tseng <henrytseng@google.com>
1 parent 9916aa2 commit 7ffb8c0

File tree

2 files changed

+73
-5
lines changed

2 files changed

+73
-5
lines changed

tests/robustness/Makefile

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ test-robustness-issue19179: /tmp/etcd-v3.5.17-failpoints/bin
7575
GO_TEST_FLAGS='-v -run=TestRobustnessRegression/Issue19179 -count 200 -failfast --bin-dir=/tmp/etcd-v3.5.17-failpoints/bin' $(TOPLEVEL_MAKE) test-robustness && \
7676
echo "Failed to reproduce" || echo "Successful reproduction"
7777

78+
.PHONY: test-robustness-issue20221-fix20229-resumable
79+
test-robustness-issue20221-fix20229-resumable: /tmp/etcd-bc47e771-failpoints/bin
80+
GO_TEST_FLAGS='-v --run=TestRobustnessRegression/Issue20221_fix20229_resumable --count 100 --failfast --bin-dir=/tmp/etcd-bc47e771-failpoints/bin' $(TOPLEVEL_MAKE) test-robustness && \
81+
echo "Failed to reproduce" || echo "Successful reproduction"
82+
83+
.PHONY: test-robustness-issue20221-fix20229-bookmarkable
84+
test-robustness-issue20221-fix20229-bookmarkable: /tmp/etcd-bc47e771-patch-failpoints/bin
85+
GO_TEST_FLAGS='-v --run=TestRobustnessRegression/Issue20221_fix20229_bookmarkable --count 100 --failfast --bin-dir=/tmp/etcd-bc47e771-patch-failpoints/bin' $(TOPLEVEL_MAKE) test-robustness && \
86+
echo "Failed to reproduce" || echo "Successful reproduction"
87+
7888
# Etcd API usage by Kubernetes
7989

8090
.PHONY: k8s-coverage
@@ -120,11 +130,37 @@ $(GOPATH)/bin/gofail: $(REPOSITORY_ROOT)/tools/mod/go.mod $(REPOSITORY_ROOT)/too
120130
$(MAKE) gofail-enable; \
121131
$(MAKE) build;
122132

123-
/tmp/etcd-v3.6.0-failpoints/bin: $(GOPATH)/bin/gofail
124-
rm -rf /tmp/etcd-v3.6.0-failpoints/
125-
mkdir -p /tmp/etcd-v3.6.0-failpoints/
126-
cd /tmp/etcd-v3.6.0-failpoints/; \
127-
git clone --depth 1 --branch main https://github.com/etcd-io/etcd.git .; \
133+
# Please keep the version in the target name to enable the autocomplete feature for the Makefile.
134+
/tmp/etcd-v3.6.0-failpoints/bin:
135+
/tmp/etcd-v3.6.%-failpoints/bin: $(GOPATH)/bin/gofail
136+
rm -rf /tmp/etcd-v3.6.$*-failpoints/
137+
mkdir -p /tmp/etcd-v3.6.$*-failpoints/
138+
cd /tmp/etcd-v3.6.$*-failpoints/; \
139+
git clone --depth 1 --branch v3.6.$* https://github.com/etcd-io/etcd.git .; \
140+
$(MAKE) gofail-enable; \
141+
$(MAKE) build;
142+
143+
/tmp/etcd-bc47e771-failpoints/bin: $(GOPATH)/bin/gofail
144+
rm -rf /tmp/etcd-bc47e771-failpoints/
145+
mkdir -p /tmp/etcd-bc47e771-failpoints/
146+
cd /tmp/etcd-bc47e771-failpoints/; \
147+
git init; \
148+
git remote add origin https://github.com/etcd-io/etcd.git; \
149+
git fetch --depth 1 origin bc47e7711664ec5557c5ae528d0d02175ea6e166; \
150+
git checkout FETCH_HEAD; \
151+
$(MAKE) gofail-enable; \
152+
$(MAKE) build;
153+
154+
/tmp/etcd-bc47e771-patch-failpoints/bin: $(GOPATH)/bin/gofail
155+
rm -rf /tmp/etcd-bc47e771-patch-failpoints/
156+
mkdir -p /tmp/etcd-bc47e771-patch-failpoints/
157+
cd /tmp/etcd-bc47e771-patch-failpoints/; \
158+
git init; \
159+
git remote add origin https://github.com/etcd-io/etcd.git; \
160+
git fetch --depth 1 origin bc47e7711664ec5557c5ae528d0d02175ea6e166; \
161+
git checkout FETCH_HEAD; \
162+
cp -r $(REPOSITORY_ROOT)/tests/robustness/patches/closeWatchStream .; \
163+
patch -l server/etcdserver/api/v3rpc/watch.go ./closeWatchStream/watch.patch; \
128164
$(MAKE) gofail-enable; \
129165
$(MAKE) build;
130166

tests/robustness/scenarios/scenarios.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,38 @@ func Regression(t *testing.T) []TestScenario {
271271
e2e.WithGoFailEnabled(true),
272272
),
273273
})
274+
scenarios = append(scenarios, TestScenario{
275+
Name: "Issue20221_fix20229_resumable",
276+
Failpoint: failpoint.BlackholeUntilSnapshot,
277+
Watch: client.WatchConfig{
278+
RequestProgress: true,
279+
},
280+
Profile: traffic.HighTrafficProfile,
281+
Traffic: traffic.EtcdPut,
282+
Cluster: *e2e.NewConfig(
283+
e2e.WithSnapshotCount(10),
284+
e2e.WithPeerProxy(true),
285+
e2e.WithIsPeerTLS(true),
286+
e2e.WithWatchProcessNotifyInterval(10*time.Millisecond),
287+
e2e.WithSnapshotCatchUpEntries(10),
288+
),
289+
})
290+
scenarios = append(scenarios, TestScenario{
291+
Name: "Issue20221_fix20229_bookmarkable",
292+
Failpoint: failpoint.BlackholeAndForceWatchReconnect,
293+
Watch: client.WatchConfig{
294+
RequestProgress: true,
295+
},
296+
Profile: traffic.HighTrafficProfile,
297+
Traffic: traffic.EtcdPut,
298+
Cluster: *e2e.NewConfig(
299+
e2e.WithSnapshotCount(10),
300+
e2e.WithPeerProxy(true),
301+
e2e.WithIsPeerTLS(true),
302+
e2e.WithWatchProcessNotifyInterval(10*time.Millisecond),
303+
e2e.WithSnapshotCatchUpEntries(10),
304+
),
305+
})
274306
if v.Compare(version.V3_5) >= 0 {
275307
opts := []e2e.EPClusterOption{
276308
e2e.WithSnapshotCount(100),

0 commit comments

Comments
 (0)