Skip to content
Open
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
20 changes: 20 additions & 0 deletions test/extended/storage/driver_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
})
o.Expect(err).NotTo(o.HaveOccurred(), "failed to update ClusterCSIDriver")

// Wait for operator to start progressing after config restore and settle in Progressing=False to ensure all
// pod creation events complete before test ends.
// This allows the pathological event matcher (newVsphereConfigurationTestsRollOutTooOftenEventMatcher in
// pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_event_patterns.go) to accurately attribute
// pod events to this test's time window (interval); any events emitted later would not be matched.
waitForStorageOperatorToSettle(ctx, oc)

e2e.Logf("Successfully restored original driverConfig of ClusterCSIDriver")
})

Expand Down Expand Up @@ -140,6 +147,7 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
g.It(fmt.Sprintf("%s", t.name), func() {

setClusterCSIDriverSnapshotOptions(ctx, oc, t.clusterCSIDriverOptions)

o.Eventually(func() error {
return loadAndCheckCloudConf(ctx, oc, "Snapshot", t.cloudConfigOptions, t.clusterCSIDriverOptions)
}, pollTimeout, pollInterval).Should(o.Succeed())
Expand All @@ -150,6 +158,16 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
})
})

// Wait for storage operator to settle after a configuration change.
// This should be called right after a configuration change when we expect rollout of new pods.
func waitForStorageOperatorToSettle(ctx context.Context, oc *exutil.CLI) {
e2e.Logf("Waiting for storage operator to be Progressing=True")
o.Eventually(exutil.WaitForOperatorProgressingTrue(ctx, oc.AdminConfigClient(), "storage")).WithTimeout(time.Second * 10).Should(o.Succeed())

e2e.Logf("Observing storage operator is settled in Progressing=False")
o.Consistently(exutil.WaitForOperatorProgressingFalse(ctx, oc.AdminConfigClient(), "storage")).WithTimeout(time.Second * 10).Should(o.Succeed())
}

func setClusterCSIDriverSnapshotOptions(ctx context.Context, oc *exutil.CLI, clusterCSIDriverOptions *opv1.VSphereCSIDriverConfigSpec) {
e2e.Logf("updating ClusterCSIDriver driver config to: %+v", clusterCSIDriverOptions)

Expand All @@ -165,6 +183,8 @@ func setClusterCSIDriverSnapshotOptions(ctx context.Context, oc *exutil.CLI, clu
return err
}

waitForStorageOperatorToSettle(ctx, oc)

return nil
})
o.Expect(err).NotTo(o.HaveOccurred(), "failed to update ClusterCSIDriver")
Expand Down