mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #14885 from serathius/linearizability-recreate-cluster
Linearizability recreate cluster
This commit is contained in:
commit
5baf8377bb
2
.github/workflows/linearizability.yaml
vendored
2
.github/workflows/linearizability.yaml
vendored
@ -13,7 +13,7 @@ jobs:
|
|||||||
make build
|
make build
|
||||||
mkdir -p /tmp/linearizability
|
mkdir -p /tmp/linearizability
|
||||||
cat server/etcdserver/raft.fail.go
|
cat server/etcdserver/raft.fail.go
|
||||||
EXPECT_DEBUG=true GO_TEST_FLAGS=-v RESULTS_DIR=/tmp/linearizability make test-linearizability
|
EXPECT_DEBUG=true GO_TEST_FLAGS='-v --count 60 --failfast --run TestLinearizability' RESULTS_DIR=/tmp/linearizability make test-linearizability
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
|
@ -34,8 +34,6 @@ const (
|
|||||||
minimalQPS = 100.0
|
minimalQPS = 100.0
|
||||||
// maximalQPS limits number of requests send to etcd to avoid linearizability analysis taking too long.
|
// maximalQPS limits number of requests send to etcd to avoid linearizability analysis taking too long.
|
||||||
maximalQPS = 200.0
|
maximalQPS = 200.0
|
||||||
// failpointTriggersCount
|
|
||||||
failpointTriggersCount = 60
|
|
||||||
// waitBetweenFailpointTriggers
|
// waitBetweenFailpointTriggers
|
||||||
waitBetweenFailpointTriggers = time.Second
|
waitBetweenFailpointTriggers = time.Second
|
||||||
)
|
)
|
||||||
@ -77,7 +75,8 @@ func TestLinearizability(t *testing.T) {
|
|||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
failpoint := FailpointConfig{
|
failpoint := FailpointConfig{
|
||||||
failpoint: tc.failpoint,
|
failpoint: tc.failpoint,
|
||||||
count: failpointTriggersCount,
|
count: 1,
|
||||||
|
retries: 3,
|
||||||
waitBetweenTriggers: waitBetweenFailpointTriggers,
|
waitBetweenTriggers: waitBetweenFailpointTriggers,
|
||||||
}
|
}
|
||||||
traffic := trafficConfig{
|
traffic := trafficConfig{
|
||||||
@ -117,8 +116,8 @@ func triggerFailpoints(ctx context.Context, t *testing.T, clus *e2e.EtcdProcessC
|
|||||||
var err error
|
var err error
|
||||||
successes := 0
|
successes := 0
|
||||||
failures := 0
|
failures := 0
|
||||||
time.Sleep(config.waitBetweenTriggers)
|
for successes < config.count && failures < config.retries {
|
||||||
for successes < config.count && failures < config.count {
|
time.Sleep(config.waitBetweenTriggers)
|
||||||
err = config.failpoint.Trigger(t, ctx, clus)
|
err = config.failpoint.Trigger(t, ctx, clus)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Logf("Failed to trigger failpoint %q, err: %v\n", config.failpoint.Name(), err)
|
t.Logf("Failed to trigger failpoint %q, err: %v\n", config.failpoint.Name(), err)
|
||||||
@ -126,17 +125,18 @@ func triggerFailpoints(ctx context.Context, t *testing.T, clus *e2e.EtcdProcessC
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
successes++
|
successes++
|
||||||
time.Sleep(config.waitBetweenTriggers)
|
|
||||||
}
|
}
|
||||||
if successes < config.count || failures >= config.count {
|
if successes < config.count || failures >= config.retries {
|
||||||
return fmt.Errorf("failed to trigger failpoints enough times, err: %v", err)
|
return fmt.Errorf("failed to trigger failpoints enough times, err: %v", err)
|
||||||
}
|
}
|
||||||
|
time.Sleep(config.waitBetweenTriggers)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type FailpointConfig struct {
|
type FailpointConfig struct {
|
||||||
failpoint Failpoint
|
failpoint Failpoint
|
||||||
count int
|
count int
|
||||||
|
retries int
|
||||||
waitBetweenTriggers time.Duration
|
waitBetweenTriggers time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user