Skip to content

Commit d51fb89

Browse files
authored
Improve e2e test suite retries (#2387)
1 parent 19919b0 commit d51fb89

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

e2e/fixtures/fdb_cluster.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,7 @@ func (fdbCluster *FdbCluster) SetKillProcesses(allowKill bool, wait bool) {
12451245
// set to true only this condition is allowed.
12461246
func (fdbCluster *FdbCluster) AllProcessGroupsHaveCondition(
12471247
condition fdbv1beta2.ProcessGroupConditionType,
1248+
ignoreMissing bool,
12481249
) bool {
12491250
cluster := fdbCluster.GetCluster()
12501251

@@ -1253,6 +1254,10 @@ func (fdbCluster *FdbCluster) AllProcessGroupsHaveCondition(
12531254
continue
12541255
}
12551256

1257+
if processGroup.GetConditionTime(fdbv1beta2.MissingProcesses) != nil && ignoreMissing {
1258+
continue
1259+
}
1260+
12561261
if len(processGroup.ProcessGroupConditions) != 1 {
12571262
return false
12581263
}
@@ -1851,13 +1856,15 @@ func (fdbCluster *FdbCluster) WriteKeyValue(
18511856
keyValue KeyValue,
18521857
timeout int,
18531858
) {
1854-
_, stderr, err := fdbCluster.RunFdbCliCommandInOperatorWithoutRetry(
1855-
fmt.Sprintf("writemode on; set %s %s", keyValue.GetKey(), keyValue.GetValue()),
1856-
false,
1857-
timeout,
1858-
)
1859+
gomega.Eventually(func(g gomega.Gomega) {
1860+
_, stderr, err := fdbCluster.RunFdbCliCommandInOperatorWithoutRetry(
1861+
fmt.Sprintf("writemode on; set %s %s", keyValue.GetKey(), keyValue.GetValue()),
1862+
false,
1863+
timeout,
1864+
)
18591865

1860-
gomega.Expect(err).NotTo(gomega.HaveOccurred(), stderr)
1866+
g.Expect(err).NotTo(gomega.HaveOccurred(), stderr)
1867+
}).WithTimeout(2 * time.Minute).WithPolling(2 * time.Second).Should(gomega.Succeed())
18611868
}
18621869

18631870
// WriteKeyValuesWithTimeout writes multiples key values into FDB with the specified timeout.

e2e/test_operator_ha_upgrades/operator_ha_upgrade_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,19 @@ func clusterSetup(beforeVersion string, enableOperatorPodChaos bool) {
116116
// are at "IncorrectCommandLine" state (which means that they have the new binaries and have
117117
// the new configuration but are not restarted).
118118
//
119-
// Note: we tried doing this by polling for "UpgradeRequeued" event on primary/remote/primary-satellite data centers,
119+
// Note: we tried doing this by polling for "UpgradeRequeued" event on primary/remote/primary-satellite data centers,
120120
// but we found that that approach is not very reliable.
121121
func verifyBouncingIsBlocked() {
122-
Eventually(func(g Gomega) bool {
122+
Eventually(func(g Gomega) {
123123
for _, cluster := range fdbCluster.GetAllClusters() {
124124
if strings.HasSuffix(cluster.Name(), fixtures.RemoteSatelliteID) {
125125
continue
126126
}
127127

128-
g.Expect(cluster.AllProcessGroupsHaveCondition(fdbv1beta2.IncorrectCommandLine)).
129-
To(BeTrue())
128+
g.Expect(cluster.AllProcessGroupsHaveCondition(fdbv1beta2.IncorrectCommandLine, true)).
129+
To(BeTrue(), fmt.Sprintf("all process groups in cluster %s should have the incorrect command line condition", cluster.Name()))
130130
}
131-
132-
return true
133-
}).WithTimeout(10 * time.Minute).WithPolling(5 * time.Second).MustPassRepeatedly(30).Should(BeTrue())
131+
}).WithTimeout(10 * time.Minute).WithPolling(5 * time.Second).MustPassRepeatedly(30).Should(Succeed())
134132
}
135133

136134
var _ = AfterSuite(func() {
@@ -335,7 +333,7 @@ var _ = Describe("Operator HA Upgrades", Label("e2e", "pr"), func() {
335333

336334
// It should block the restart of the processes until the rest of the cluster is upgraded.
337335
Eventually(func() bool {
338-
return primary.AllProcessGroupsHaveCondition(fdbv1beta2.IncorrectCommandLine)
336+
return primary.AllProcessGroupsHaveCondition(fdbv1beta2.IncorrectCommandLine, true)
339337
}).WithTimeout(10 * time.Minute).WithPolling(5 * time.Second).MustPassRepeatedly(30).Should(BeTrue())
340338

341339
Expect(fdbCluster.UpgradeCluster(targetVersion, false)).NotTo(HaveOccurred())

e2e/test_operator_upgrades/operator_upgrades_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ var _ = Describe("Operator Upgrades", Label("e2e", "pr"), func() {
217217

218218
// Wait until all process groups are in the staging phase and the new binaries are available.
219219
Eventually(func() bool {
220-
return fdbCluster.AllProcessGroupsHaveCondition(fdbv1beta2.IncorrectCommandLine)
220+
return fdbCluster.AllProcessGroupsHaveCondition(
221+
fdbv1beta2.IncorrectCommandLine,
222+
true,
223+
)
221224
}).WithTimeout(10 * time.Minute).WithPolling(2 * time.Second).Should(BeTrue())
222225

223226
// Restart the fdbserver process to pickup the new configuration and run with the newer version.

0 commit comments

Comments
 (0)