Skip to content

Commit

Permalink
tests: Add reproduce etcd-io#13766 scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
serathius committed Jan 13, 2023
1 parent 6315f1c commit 4476f83
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linearizability-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
make build
mkdir -p /tmp/linearizability
cat server/etcdserver/raft.fail.go
EXPECT_DEBUG=true GO_TEST_FLAGS='-v --count 500 --failfast --run TestLinearizability --timeout=170m' RESULTS_DIR=/tmp/linearizability make test-linearizability
EXPECT_DEBUG=true GO_TEST_FLAGS='-v --count 400 --failfast --run TestLinearizability --timeout=170m' RESULTS_DIR=/tmp/linearizability make test-linearizability
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: always()
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linearizability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
make build
mkdir -p /tmp/linearizability
cat server/etcdserver/raft.fail.go
EXPECT_DEBUG=true GO_TEST_FLAGS='-v --count 60 --failfast --run TestLinearizability' RESULTS_DIR=/tmp/linearizability make test-linearizability
EXPECT_DEBUG=true GO_TEST_FLAGS='-v --count 40 --failfast --run TestLinearizability' RESULTS_DIR=/tmp/linearizability make test-linearizability
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: always()
with:
Expand Down
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,60 @@ gofail-disable: install-gofail
install-gofail:
cd tools/mod; go install go.etcd.io/gofail@${GOFAIL_VERSION}

# Reproduce historical issues

.PHONY: reproduce-issue14370
reproduce-issue14370: ./bin/etcd-v3.5.4-failpoints
cp ./bin/etcd-v3.5.4-failpoints ./bin/etcd
GO_TEST_FLAGS='-v --run=TestLinearizability/Issue14370 --count 100 --failfast' make test-linearizability

.PHONY: reproduce-issue13766
reproduce-issue13766: ./bin/etcd-v3.5.2-failpoints
cp ./bin/etcd-v3.5.2-failpoints ./bin/etcd
GO_TEST_FLAGS='-v --run=TestLinearizability/Issue13766 --count 100 --failfast' make test-linearizability

.PHONY: reproduce-issue14685
reproduce-issue14685: ./bin/etcd-v3.5.5-failpoints
cp ./bin/etcd-v3.5.5-failpoints ./bin/etcd
GO_TEST_FLAGS='-v --run=TestLinearizability/Issue14685 --count 100 --failfast' make test-linearizability

./bin/etcd-v3.6.0-failpoints:
rm -rf /tmp/etcd-release-v3.6.0/
mkdir -p /tmp/etcd-release-v3.6.0/
cd /tmp/etcd-release-v3.6.0/; \
git clone --depth 1 --branch main https://github.com/etcd-io/etcd.git .; \
make gofail-enable; \
make build;
mkdir -p ./bin
cp /tmp/etcd-release-v3.6.0/bin/etcd ./bin/etcd-v3.6.0-failpoints

./bin/etcd-v3.5.2-failpoints:
./bin/etcd-v3.5.4-failpoints:
./bin/etcd-v3.5.6-failpoints:
./bin/etcd-v3.5.%-failpoints:
rm -rf /tmp/etcd-release-v3.5.$*/
mkdir -p /tmp/etcd-release-v3.5.$*/
cd /tmp/etcd-release-v3.5.$*/; \
git clone --depth 1 --branch v3.5.$* https://github.com/etcd-io/etcd.git .; \
go get go.etcd.io/gofail@${GOFAIL_VERSION}; \
(cd server; go get go.etcd.io/gofail@${GOFAIL_VERSION}); \
(cd etcdctl; go get go.etcd.io/gofail@${GOFAIL_VERSION}); \
(cd etcdutl; go get go.etcd.io/gofail@${GOFAIL_VERSION}); \
FAILPOINTS=true ./build;
mkdir -p ./bin
cp /tmp/etcd-release-v3.5.$*/bin/etcd $@

./bin/etcd-v3.4.23-failpoints:
./bin/etcd-v3.4.%-failpoints:
rm -rf /tmp/etcd-release-v3.4.$*/
mkdir -p /tmp/etcd-release-v3.4.$*/
cd /tmp/etcd-release-v3.4.$*/; \
git clone --depth 1 --branch v3.4.$* https://github.com/etcd-io/etcd.git .; \
go get go.etcd.io/gofail@${GOFAIL_VERSION}; \
FAILPOINTS=true ./build;
mkdir -p ./bin
cp /tmp/etcd-release-v3.4.$*/bin/etcd $@

# Cleanup

clean:
Expand Down
15 changes: 12 additions & 3 deletions tests/linearizability/linearizability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import (

const (
// minimalQPS is used to validate if enough traffic is send to make tests accurate.
minimalQPS = 100.0
minimalQPS = 200.0
// maximalQPS limits number of requests send to etcd to avoid linearizability analysis taking too long.
maximalQPS = 200.0
maximalQPS = 1000.0
// waitBetweenFailpointTriggers
waitBetweenFailpointTriggers = time.Second
)
Expand All @@ -54,6 +54,7 @@ func TestLinearizability(t *testing.T) {
failpoint: RandomFailpoint,
config: *e2e.NewConfig(
e2e.WithClusterSize(1),
e2e.WithSnapshotCount(100),
e2e.WithPeerProxy(true),
e2e.WithGoFailEnabled(true),
e2e.WithCompactionBatchLimit(100), // required for compactBeforeCommitBatch and compactAfterCommitBatch failpoints
Expand All @@ -63,6 +64,7 @@ func TestLinearizability(t *testing.T) {
name: "ClusterOfSize3",
failpoint: RandomFailpoint,
config: *e2e.NewConfig(
e2e.WithSnapshotCount(100),
e2e.WithPeerProxy(true),
e2e.WithGoFailEnabled(true),
e2e.WithCompactionBatchLimit(100), // required for compactBeforeCommitBatch and compactAfterCommitBatch failpoints
Expand All @@ -84,6 +86,13 @@ func TestLinearizability(t *testing.T) {
e2e.WithGoFailEnabled(true),
),
},
{
name: "Issue13766",
failpoint: KillFailpoint,
config: *e2e.NewConfig(
e2e.WithSnapshotCount(100),
),
},
}
for _, tc := range tcs {
t.Run(tc.name, func(t *testing.T) {
Expand All @@ -101,7 +110,7 @@ func TestLinearizability(t *testing.T) {
}, trafficConfig{
minimalQPS: minimalQPS,
maximalQPS: maximalQPS,
clientCount: 8,
clientCount: 12,
traffic: DefaultTraffic,
})
longestHistory, remainingEvents := pickLongestHistory(events)
Expand Down

0 comments on commit 4476f83

Please sign in to comment.