Skip to content

Commit 5f789b1

Browse files
authored
Improve the logging of the HA upgrade tests and disable a test for the global synchronization mode (#2385)
1 parent 6237936 commit 5f789b1

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

e2e/fixtures/ha_fdb_cluster.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ package fixtures
2222

2323
import (
2424
"fmt"
25+
"log"
26+
"math/rand"
2527
"strings"
28+
"time"
2629

2730
fdbv1beta2 "github.com/FoundationDB/fdb-kubernetes-operator/v2/api/v1beta2"
2831
chaosmesh "github.com/FoundationDB/fdb-kubernetes-operator/v2/e2e/chaos-mesh/api/v1alpha1"
@@ -226,8 +229,15 @@ func (haFDBCluster *HaFdbCluster) UpgradeClusterWithTimeout(
226229
waitForReconciliation bool,
227230
timeout int,
228231
) error {
232+
startTime := time.Now()
229233
expectedGenerations := map[string]int64{}
230-
for _, cluster := range haFDBCluster.GetAllClusters() {
234+
clusters := haFDBCluster.GetAllClusters()
235+
// Randomize the order of the clusters slice.
236+
rand.Shuffle(len(clusters), func(i, j int) {
237+
clusters[i], clusters[j] = clusters[j], clusters[i]
238+
})
239+
240+
for _, cluster := range clusters {
231241
curCluster := cluster.GetCluster()
232242

233243
generation := curCluster.ObjectMeta.Generation
@@ -249,8 +259,12 @@ func (haFDBCluster *HaFdbCluster) UpgradeClusterWithTimeout(
249259
return nil
250260
}
251261

262+
defer func() {
263+
log.Println("upgrade took:", time.Since(startTime).String())
264+
}()
265+
252266
g := new(errgroup.Group)
253-
for _, cluster := range haFDBCluster.GetAllClusters() {
267+
for _, cluster := range clusters {
254268
singleCluster := cluster // https://golang.org/doc/faq#closures_and_goroutines
255269
g.Go(func() error {
256270
return singleCluster.WaitForReconciliation(

e2e/test_operator_ha_upgrades/operator_ha_upgrade_test.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,15 @@ var _ = Describe("Operator HA Upgrades", Label("e2e", "pr"), func() {
461461
coordinatorMap[pod.UID] = pod
462462
}
463463

464+
log.Println(
465+
"Cluster",
466+
cluster.Name(),
467+
"is running at version",
468+
cluster.GetCluster().GetRunningVersion(),
469+
"target version is",
470+
targetVersion,
471+
)
464472
if cluster.GetCluster().GetRunningVersion() == targetVersion {
465-
log.Println(
466-
"Cluster",
467-
cluster.Name(),
468-
"is running at version",
469-
targetVersion,
470-
)
471473
continue
472474
}
473475

@@ -479,11 +481,12 @@ var _ = Describe("Operator HA Upgrades", Label("e2e", "pr"), func() {
479481
return true
480482
}
481483

482-
randomCluster := factory.RandomPickOneCluster(clusters)
483484
// Make sure we are not deleting coordinator Pods
484485
var randomPod *corev1.Pod
485486
g.Eventually(func() bool {
486-
randomPod = factory.ChooseRandomPod(randomCluster.GetPods())
487+
randomPod = factory.ChooseRandomPod(
488+
factory.RandomPickOneCluster(clusters).GetPods(),
489+
)
487490
_, ok := coordinatorMap[randomPod.UID]
488491
if ok {
489492
log.Println("Skipping pod:", randomPod.Name, "as it is a coordinator")
@@ -615,6 +618,13 @@ var _ = Describe("Operator HA Upgrades", Label("e2e", "pr"), func() {
615618
)
616619
}
617620

621+
// TODO (johscheuer): https://github.com/FoundationDB/fdb-kubernetes-operator/issues/2383
622+
if factory.GetSynchronizationMode() == fdbv1beta2.SynchronizationModeGlobal {
623+
Skip(
624+
"Test is currently disabled with the global mode because of flakiness, see: https://github.com/FoundationDB/fdb-kubernetes-operator/issues/2383",
625+
)
626+
}
627+
618628
clusterConfig := fixtures.DefaultClusterConfigWithHaMode(
619629
fixtures.HaFourZoneSingleSat,
620630
false,

0 commit comments

Comments
 (0)