|
15 | 15 | package scenarios |
16 | 16 |
|
17 | 17 | import ( |
18 | | - "path/filepath" |
19 | 18 | "testing" |
20 | | - "time" |
21 | 19 |
|
22 | | - "github.com/stretchr/testify/require" |
23 | | - |
24 | | - "go.etcd.io/etcd/api/v3/version" |
25 | | - "go.etcd.io/etcd/client/pkg/v3/fileutil" |
26 | | - "go.etcd.io/etcd/server/v3/etcdserver" |
27 | 20 | "go.etcd.io/etcd/tests/v3/framework/e2e" |
28 | 21 | "go.etcd.io/etcd/tests/v3/robustness/client" |
29 | 22 | "go.etcd.io/etcd/tests/v3/robustness/failpoint" |
30 | | - "go.etcd.io/etcd/tests/v3/robustness/options" |
31 | | - "go.etcd.io/etcd/tests/v3/robustness/random" |
32 | 23 | "go.etcd.io/etcd/tests/v3/robustness/traffic" |
33 | 24 | ) |
34 | 25 |
|
@@ -70,175 +61,22 @@ type TestScenario struct { |
70 | 61 | Watch client.WatchConfig |
71 | 62 | } |
72 | 63 |
|
73 | | -func Exploratory(_ *testing.T) []TestScenario { |
74 | | - randomizableOptions := []e2e.EPClusterOption{ |
75 | | - options.WithClusterOptionGroups( |
76 | | - options.ClusterOptions{options.WithTickMs(29), options.WithElectionMs(271)}, |
77 | | - options.ClusterOptions{options.WithTickMs(101), options.WithElectionMs(521)}, |
78 | | - options.ClusterOptions{options.WithTickMs(100), options.WithElectionMs(2000)}), |
79 | | - } |
80 | | - |
81 | | - mixedVersionOptionChoices := []random.ChoiceWeight[options.ClusterOptions]{ |
82 | | - // 60% with all members of current version |
83 | | - {Choice: options.ClusterOptions{options.WithVersion(e2e.CurrentVersion)}, Weight: 60}, |
84 | | - // 10% with 2 members of current version, 1 member last version, leader is current version |
85 | | - {Choice: options.ClusterOptions{options.WithVersion(e2e.MinorityLastVersion), options.WithInitialLeaderIndex(0)}, Weight: 10}, |
86 | | - // 10% with 2 members of current version, 1 member last version, leader is last version |
87 | | - {Choice: options.ClusterOptions{options.WithVersion(e2e.MinorityLastVersion), options.WithInitialLeaderIndex(2)}, Weight: 10}, |
88 | | - // 10% with 2 members of last version, 1 member current version, leader is last version |
89 | | - {Choice: options.ClusterOptions{options.WithVersion(e2e.QuorumLastVersion), options.WithInitialLeaderIndex(0)}, Weight: 10}, |
90 | | - // 10% with 2 members of last version, 1 member current version, leader is current version |
91 | | - {Choice: options.ClusterOptions{options.WithVersion(e2e.QuorumLastVersion), options.WithInitialLeaderIndex(2)}, Weight: 10}, |
92 | | - } |
93 | | - mixedVersionOption := options.WithClusterOptionGroups(random.PickRandom[options.ClusterOptions](mixedVersionOptionChoices)) |
94 | | - |
95 | | - baseOptions := []e2e.EPClusterOption{ |
96 | | - options.WithSnapshotCount(50, 100, 1000), |
97 | | - options.WithSubsetOptions(randomizableOptions...), |
98 | | - e2e.WithGoFailEnabled(true), |
99 | | - // Set low minimal compaction batch limit to allow for triggering multi batch compaction failpoints. |
100 | | - options.WithCompactionBatchLimit(10, 100, 1000), |
101 | | - e2e.WithWatchProcessNotifyInterval(100 * time.Millisecond), |
102 | | - } |
103 | | - |
104 | | - if e2e.CouldSetSnapshotCatchupEntries(e2e.BinPath.Etcd) { |
105 | | - baseOptions = append(baseOptions, options.WithSnapshotCatchUpEntries(100, etcdserver.DefaultSnapshotCatchUpEntries)) |
106 | | - } |
107 | | - scenarios := []TestScenario{} |
108 | | - for _, tp := range trafficProfiles { |
109 | | - name := filepath.Join(tp.Name, "ClusterOfSize1") |
110 | | - clusterOfSize1Options := baseOptions |
111 | | - clusterOfSize1Options = append(clusterOfSize1Options, e2e.WithClusterSize(1)) |
112 | | - scenarios = append(scenarios, TestScenario{ |
113 | | - Name: name, |
114 | | - Traffic: tp.Traffic, |
115 | | - Profile: tp.Profile, |
116 | | - Cluster: *e2e.NewConfig(clusterOfSize1Options...), |
117 | | - }) |
118 | | - } |
119 | | - |
120 | | - for _, tp := range trafficProfiles { |
121 | | - name := filepath.Join(tp.Name, "ClusterOfSize3") |
122 | | - clusterOfSize3Options := baseOptions |
123 | | - clusterOfSize3Options = append(clusterOfSize3Options, e2e.WithIsPeerTLS(true)) |
124 | | - clusterOfSize3Options = append(clusterOfSize3Options, e2e.WithPeerProxy(true)) |
125 | | - if fileutil.Exist(e2e.BinPath.EtcdLastRelease) { |
126 | | - clusterOfSize3Options = append(clusterOfSize3Options, mixedVersionOption) |
127 | | - } |
128 | | - scenarios = append(scenarios, TestScenario{ |
129 | | - Name: name, |
130 | | - Traffic: tp.Traffic, |
131 | | - Profile: tp.Profile, |
132 | | - Cluster: *e2e.NewConfig(clusterOfSize3Options...), |
133 | | - }) |
134 | | - } |
135 | | - if e2e.BinPath.LazyFSAvailable() { |
136 | | - newScenarios := scenarios |
137 | | - for _, s := range scenarios { |
138 | | - // LazyFS increases the load on CPU, so we run it with more lightweight case. |
139 | | - if s.Profile.MinimalQPS <= 100 && s.Cluster.ClusterSize == 1 { |
140 | | - lazyfsCluster := s.Cluster |
141 | | - lazyfsCluster.LazyFSEnabled = true |
142 | | - newScenarios = append(newScenarios, TestScenario{ |
143 | | - Name: filepath.Join(s.Name, "LazyFS"), |
144 | | - Failpoint: s.Failpoint, |
145 | | - Cluster: lazyfsCluster, |
146 | | - Traffic: s.Traffic, |
147 | | - Profile: s.Profile.WithoutCompaction(), |
148 | | - Watch: s.Watch, |
149 | | - }) |
150 | | - } |
151 | | - } |
152 | | - scenarios = newScenarios |
153 | | - } |
| 64 | +func Exploratory(_ *testing.T) (scenarios []TestScenario) { |
154 | 65 | return scenarios |
155 | 66 | } |
156 | 67 |
|
157 | | -func Regression(t *testing.T) []TestScenario { |
158 | | - v, err := e2e.GetVersionFromBinary(e2e.BinPath.Etcd) |
159 | | - require.NoErrorf(t, err, "Failed checking etcd version binary, binary: %q", e2e.BinPath.Etcd) |
160 | | - |
161 | | - scenarios := []TestScenario{} |
162 | | - scenarios = append(scenarios, TestScenario{ |
163 | | - Name: "Issue14370", |
164 | | - Failpoint: failpoint.RaftBeforeSavePanic, |
165 | | - Profile: traffic.LowTraffic, |
166 | | - Traffic: traffic.EtcdPutDeleteLease, |
167 | | - Cluster: *e2e.NewConfig( |
168 | | - e2e.WithClusterSize(1), |
169 | | - e2e.WithGoFailEnabled(true), |
170 | | - ), |
171 | | - }) |
172 | | - scenarios = append(scenarios, TestScenario{ |
173 | | - Name: "Issue14685", |
174 | | - Failpoint: failpoint.DefragBeforeCopyPanic, |
175 | | - Profile: traffic.LowTraffic, |
176 | | - Traffic: traffic.EtcdPutDeleteLease, |
177 | | - Cluster: *e2e.NewConfig( |
178 | | - e2e.WithClusterSize(1), |
179 | | - e2e.WithGoFailEnabled(true), |
180 | | - ), |
181 | | - }) |
182 | | - scenarios = append(scenarios, TestScenario{ |
183 | | - Name: "Issue13766", |
184 | | - Failpoint: failpoint.KillFailpoint, |
185 | | - Profile: traffic.HighTrafficProfile, |
186 | | - Traffic: traffic.EtcdPut, |
187 | | - Cluster: *e2e.NewConfig( |
188 | | - e2e.WithSnapshotCount(100), |
189 | | - ), |
190 | | - }) |
191 | | - scenarios = append(scenarios, TestScenario{ |
192 | | - Name: "Issue15220", |
193 | | - Watch: client.WatchConfig{ |
194 | | - RequestProgress: true, |
195 | | - }, |
196 | | - Profile: traffic.LowTraffic, |
197 | | - Traffic: traffic.EtcdPutDeleteLease, |
198 | | - Failpoint: failpoint.KillFailpoint, |
199 | | - Cluster: *e2e.NewConfig( |
200 | | - e2e.WithClusterSize(1), |
201 | | - ), |
202 | | - }) |
203 | | - scenarios = append(scenarios, TestScenario{ |
204 | | - Name: "Issue17529", |
205 | | - Profile: traffic.HighTrafficProfile, |
206 | | - Traffic: traffic.Kubernetes, |
207 | | - Failpoint: failpoint.SleepBeforeSendWatchResponse, |
208 | | - Cluster: *e2e.NewConfig( |
209 | | - e2e.WithClusterSize(1), |
210 | | - e2e.WithGoFailEnabled(true), |
211 | | - options.WithSnapshotCount(100), |
212 | | - ), |
213 | | - }) |
214 | | - |
215 | | - scenarios = append(scenarios, TestScenario{ |
216 | | - Name: "Issue17780", |
217 | | - Profile: traffic.LowTraffic.WithoutCompaction(), |
218 | | - Failpoint: failpoint.BatchCompactBeforeSetFinishedCompactPanic, |
219 | | - Traffic: traffic.Kubernetes, |
220 | | - Cluster: *e2e.NewConfig( |
221 | | - e2e.WithClusterSize(1), |
222 | | - e2e.WithCompactionBatchLimit(300), |
223 | | - e2e.WithSnapshotCount(1000), |
224 | | - e2e.WithGoFailEnabled(true), |
225 | | - ), |
226 | | - }) |
227 | | - if v.Compare(version.V3_5) >= 0 { |
228 | | - opts := []e2e.EPClusterOption{ |
229 | | - e2e.WithSnapshotCount(100), |
230 | | - e2e.WithPeerProxy(true), |
231 | | - e2e.WithIsPeerTLS(true), |
232 | | - } |
233 | | - if e2e.CouldSetSnapshotCatchupEntries(e2e.BinPath.Etcd) { |
234 | | - opts = append(opts, e2e.WithSnapshotCatchUpEntries(100)) |
235 | | - } |
| 68 | +func Regression(t *testing.T) (scenarios []TestScenario) { |
| 69 | + for i := 0; i < 20; i++ { |
236 | 70 | scenarios = append(scenarios, TestScenario{ |
237 | | - Name: "Issue15271", |
238 | | - Failpoint: failpoint.BlackholeUntilSnapshot, |
239 | | - Profile: traffic.HighTrafficProfile, |
240 | | - Traffic: traffic.EtcdPut, |
241 | | - Cluster: *e2e.NewConfig(opts...), |
| 71 | + Name: "Issue19179", |
| 72 | + Profile: traffic.LowTraffic.WithoutCompaction(), |
| 73 | + Failpoint: failpoint.BatchCompactBeforeSetFinishedCompactPanic, |
| 74 | + Traffic: traffic.Kubernetes, |
| 75 | + Cluster: *e2e.NewConfig( |
| 76 | + e2e.WithClusterSize(1), |
| 77 | + e2e.WithCompactionBatchLimit(100), |
| 78 | + e2e.WithGoFailEnabled(true), |
| 79 | + ), |
242 | 80 | }) |
243 | 81 | } |
244 | 82 | return scenarios |
|
0 commit comments