Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test stability #1823

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions e2e/fixtures/fdb_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,10 @@ func (fdbCluster *FdbCluster) waitForReconciliationToGeneration(

if reconciled {
log.Printf(
"reconciled name=%s, namespace=%s",
"reconciled name=%s, namespace=%s, generation:%d",
fdbCluster.cluster.Name,
fdbCluster.cluster.Namespace,
fdbCluster.cluster.Generation,
)
return true
}
Expand Down Expand Up @@ -314,17 +315,10 @@ func (fdbCluster *FdbCluster) WaitUntilWithForceReconcile(pollTimeInSeconds int,
// ForceReconcile will add an annotation with the current timestamp on the FoundationDBCluster resource to make sure
// the operator reconciliation loop is triggered. This is used to speed up some test cases.
func (fdbCluster *FdbCluster) ForceReconcile() {
log.Println("ForceReconcile")
log.Printf("Status Generations=%s",
ToJSON(fdbCluster.cluster.Status.Generations))
log.Printf(
"MedataData Generations=%s",
ToJSON(
fdbv1beta2.ClusterGenerationStatus{
Reconciled: fdbCluster.cluster.ObjectMeta.Generation,
},
),
)
log.Printf("ForceReconcile: Status Generations=%s, Metadata Generation=%d",
ToJSON(fdbCluster.cluster.Status.Generations),
fdbCluster.cluster.ObjectMeta.Generation)

fdbCluster.factory.DumpState(fdbCluster)
patch := client.MergeFrom(fdbCluster.cluster.DeepCopy())
if fdbCluster.cluster.Annotations == nil {
Expand Down
4 changes: 4 additions & 0 deletions e2e/test_operator/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,10 @@ var _ = Describe("Operator", Label("e2e", "pr"), func() {
BeforeEach(func() {
currentGeneration := fdbCluster.GetCluster().Generation
Expect(fdbCluster.SetProcessGroupPrefix(prefix)).NotTo(HaveOccurred())
// Make sure that the operator started the migration.
Eventually(func() int64 {
return fdbCluster.GetCluster().Status.Generations.Reconciled
}).Should(BeZero())
Expect(fdbCluster.WaitForReconciliation(fixtures.MinimumGenerationOption(currentGeneration+1), fixtures.SoftReconcileOption(false)))
})

Expand Down
4 changes: 4 additions & 0 deletions e2e/test_operator_migrations/operator_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ var _ = Describe("Operator Migrations", Label("e2e", "pr"), func() {

currentGeneration := fdbCluster.GetCluster().Generation
Expect(fdbCluster.SetProcessGroupPrefix(prefix)).NotTo(HaveOccurred())
// Make sure that the operator started the migration.
Eventually(func() int64 {
return fdbCluster.GetCluster().Status.Generations.Reconciled
}).Should(BeZero())
Expect(fdbCluster.WaitForReconciliation(fixtures.MinimumGenerationOption(currentGeneration+1), fixtures.SoftReconcileOption(false)))
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ var _ = Describe("Operator Upgrades", Label("e2e", "pr"), func() {
"with locality based exclusions",
func(beforeVersion string, targetVersion string) {
performUpgrade(beforeVersion, targetVersion, &fixtures.ClusterConfig{
DebugSymbols: false,
UseMaintenanceMode: true,
DebugSymbols: false,
UseLocalityBasedExclusions: true,
}, func(cluster *fixtures.FdbCluster) {
Expect(cluster.GetCluster().UseLocalitiesForExclusion()).To(BeTrue())
})
Expand Down
12 changes: 7 additions & 5 deletions e2e/test_operator_velocity/operator_velocity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const (
// If we have a minimum uptime of 60 seconds we should target 240 seconds as the worst case.
// In most cases the initial/first restart will be faster.
// TODO (johscheuer): Change this back once https://github.com/FoundationDB/fdb-kubernetes-operator/issues/1361 is fixed.
normalKnobRolloutTimeoutSeconds = 420 // 240
normalKnobRolloutTimeoutSeconds = 600 // 240
)

var (
Expand All @@ -67,7 +67,7 @@ func CheckKnobRollout(
startTime := time.Now()
timeoutTime := startTime.Add(time.Duration(knobRolloutTimeoutSeconds) * time.Second)

Eventually(func() bool {
Eventually(func(g Gomega) bool {
commandLines := fdbCluster.GetPrimary().GetCommandlineForProcessesPerClass()
var generalProcessCounts, storageProcessCounts, totalGeneralProcessCount, totalStorageProcessCount int

Expand Down Expand Up @@ -101,11 +101,13 @@ func CheckKnobRollout(
time.Since(startTime).Seconds(),
)

return generalProcessCounts == totalGeneralProcessCount &&
storageProcessCounts == totalStorageProcessCount
g.Expect(generalProcessCounts).To(BeNumerically("==", totalGeneralProcessCount))
g.Expect(storageProcessCounts).To(BeNumerically("==", totalStorageProcessCount))

return true
}).WithTimeout(time.Until(timeoutTime)).WithPolling(15 * time.Second).Should(BeTrue())

log.Println("Knob rollout took", time.Since(startTime).Seconds(), "seconds")
log.Println("Knob rollout took", time.Since(startTime).String())
}

func countMatchingCommandLines(
Expand Down
Loading