From a581062c7a21ada851b2d13f6fda89aad50b2e26 Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Wed, 18 Jan 2023 13:40:41 +0100 Subject: [PATCH] tests: Fix linearizability nightly Signed-off-by: Marek Siarkowicz --- .../workflows/linearizability-nightly.yaml | 1 + tests/linearizability/linearizability_test.go | 39 ++++++++++++++----- tests/linearizability/model/history.go | 2 +- tests/linearizability/traffic.go | 5 +-- 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/.github/workflows/linearizability-nightly.yaml b/.github/workflows/linearizability-nightly.yaml index 2d331008c..109c3a72b 100644 --- a/.github/workflows/linearizability-nightly.yaml +++ b/.github/workflows/linearizability-nightly.yaml @@ -1,4 +1,5 @@ name: Linearizability Nightly +permissions: read-all on: # schedules always run against the main branch, hence we have to create separate jobs # with individual checkout actions for each of the active release branches diff --git a/tests/linearizability/linearizability_test.go b/tests/linearizability/linearizability_test.go index 179c81bd8..0728bba8c 100644 --- a/tests/linearizability/linearizability_test.go +++ b/tests/linearizability/linearizability_test.go @@ -42,17 +42,17 @@ const ( ) var ( - DefaultTrafficConfig = trafficConfig{ + LowTrafficAllRequests = trafficConfig{ minimalQPS: 100, maximalQPS: 200, clientCount: 8, - traffic: DefaultTraffic, + traffic: readWriteSingleKey{keyCount: 4, leaseTTL: DefaultLeaseTTL, writes: []opChance{{operation: model.Put, chance: 50}, {operation: model.Delete, chance: 10}, {operation: model.PutWithLease, chance: 10}, {operation: model.LeaseRevoke, chance: 10}, {operation: model.Txn, chance: 20}}}, } - HighTrafficConfig = trafficConfig{ + HighTrafficPut = trafficConfig{ minimalQPS: 200, maximalQPS: 1000, clientCount: 12, - traffic: DefaultTraffic, + traffic: readWriteSingleKey{keyCount: 4, leaseTTL: DefaultLeaseTTL, writes: []opChance{{operation: model.Put, chance: 100}}}, } ) @@ -67,7 +67,6 @@ func TestLinearizability(t *testing.T) { { name: "ClusterOfSize1", failpoint: RandomFailpoint, - traffic: &HighTrafficConfig, config: *e2e.NewConfig( e2e.WithClusterSize(1), e2e.WithSnapshotCount(100), @@ -79,7 +78,29 @@ func TestLinearizability(t *testing.T) { { name: "ClusterOfSize3", failpoint: RandomFailpoint, - traffic: &HighTrafficConfig, + config: *e2e.NewConfig( + e2e.WithSnapshotCount(100), + e2e.WithPeerProxy(true), + e2e.WithGoFailEnabled(true), + e2e.WithCompactionBatchLimit(100), // required for compactBeforeCommitBatch and compactAfterCommitBatch failpoints + ), + }, + { + name: "HighTrafficClusterOfSize1", + failpoint: RandomFailpoint, + traffic: &HighTrafficPut, + config: *e2e.NewConfig( + e2e.WithClusterSize(1), + e2e.WithSnapshotCount(100), + e2e.WithPeerProxy(true), + e2e.WithGoFailEnabled(true), + e2e.WithCompactionBatchLimit(100), // required for compactBeforeCommitBatch and compactAfterCommitBatch failpoints + ), + }, + { + name: "HighTrafficClusterOfSize3", + failpoint: RandomFailpoint, + traffic: &HighTrafficPut, config: *e2e.NewConfig( e2e.WithSnapshotCount(100), e2e.WithPeerProxy(true), @@ -106,7 +127,7 @@ func TestLinearizability(t *testing.T) { { name: "Issue13766", failpoint: KillFailpoint, - traffic: &HighTrafficConfig, + traffic: &HighTrafficPut, config: *e2e.NewConfig( e2e.WithSnapshotCount(100), ), @@ -114,7 +135,7 @@ func TestLinearizability(t *testing.T) { } for _, tc := range tcs { if tc.traffic == nil { - tc.traffic = &DefaultTrafficConfig + tc.traffic = &LowTrafficAllRequests } t.Run(tc.name, func(t *testing.T) { @@ -348,7 +369,7 @@ func checkOperationsAndPersistResults(t *testing.T, operations []porcupine.Opera t.Error(err) } - linearizable, info := porcupine.CheckOperationsVerbose(model.Etcd, operations, time.Minute) + linearizable, info := porcupine.CheckOperationsVerbose(model.Etcd, operations, 5*time.Minute) if linearizable == porcupine.Illegal { t.Error("Model is not linearizable") } diff --git a/tests/linearizability/model/history.go b/tests/linearizability/model/history.go index 688bbc762..71a8676eb 100644 --- a/tests/linearizability/model/history.go +++ b/tests/linearizability/model/history.go @@ -293,7 +293,7 @@ func (h History) Operations() []porcupine.Operation { // Failed requests don't have a known return time. // Simulate Infinity by using last observed time. for _, op := range h.failed { - op.Return = maxTime + 1 + op.Return = maxTime + time.Second.Nanoseconds() operations = append(operations, op) } return operations diff --git a/tests/linearizability/traffic.go b/tests/linearizability/traffic.go index 761480251..86a540db8 100644 --- a/tests/linearizability/traffic.go +++ b/tests/linearizability/traffic.go @@ -28,9 +28,8 @@ import ( ) var ( - DefaultLeaseTTL int64 = 7200 - RequestTimeout = 40 * time.Millisecond - DefaultTraffic Traffic = readWriteSingleKey{keyCount: 4, leaseTTL: DefaultLeaseTTL, writes: []opChance{{operation: model.Put, chance: 50}, {operation: model.Delete, chance: 10}, {operation: model.PutWithLease, chance: 10}, {operation: model.LeaseRevoke, chance: 10}, {operation: model.Txn, chance: 20}}} + DefaultLeaseTTL int64 = 7200 + RequestTimeout = 40 * time.Millisecond ) type Traffic interface {