Skip to content

Commit 603a6ec

Browse files
Merge pull request #30336 from RomanBednar/OCPBUGS-62264
OCPBUGS-62264: vSphere snapshot options test should wait for operator to settle
2 parents b35881d + a772da4 commit 603a6ec

File tree

1 file changed

+46
-5
lines changed

1 file changed

+46
-5
lines changed

test/extended/storage/driver_configuration.go

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ const (
3434
var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial][apigroup:operator.openshift.io] vSphere CSI Driver Configuration", func() {
3535
defer g.GinkgoRecover()
3636
var (
37-
ctx = context.Background()
3837
oc = exutil.NewCLI(projectName)
3938
originalDriverConfigSpec *opv1.CSIDriverConfigSpec
39+
operatorShouldProgress bool
4040
)
4141

42-
g.BeforeEach(func() {
42+
g.BeforeEach(func(ctx g.SpecContext) {
4343
if !framework.ProviderIs("vsphere") {
4444
g.Skip("this test is only expected to work with vSphere clusters")
4545
}
@@ -51,7 +51,7 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
5151
e2e.Logf("Storing original driverConfig of ClusterCSIDriver")
5252
})
5353

54-
g.AfterEach(func() {
54+
g.AfterEach(func(ctx g.SpecContext) {
5555
if originalDriverConfigSpec == nil {
5656
return
5757
}
@@ -73,6 +73,20 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
7373
})
7474
o.Expect(err).NotTo(o.HaveOccurred(), "failed to update ClusterCSIDriver")
7575

76+
// Wait for operator to stop progressing after config restore to ensure all pod creation events complete before
77+
// test ends. This allows the pathological event matcher (newVsphereConfigurationTestsRollOutTooOftenEventMatcher
78+
// in pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_event_patterns.go) to accurately attribute
79+
// pod events to this test's time window (interval); any events emitted later would not be matched.
80+
if operatorShouldProgress {
81+
ctxWithTimeout, cancel := context.WithTimeout(ctx, 10*time.Second)
82+
defer cancel()
83+
err := exutil.WaitForOperatorProgressingTrue(ctxWithTimeout, oc.AdminConfigClient(), "storage")
84+
o.Expect(err).NotTo(o.HaveOccurred())
85+
86+
err = exutil.WaitForOperatorProgressingFalse(ctx, oc.AdminConfigClient(), "storage")
87+
o.Expect(err).NotTo(o.HaveOccurred())
88+
}
89+
7690
e2e.Logf("Successfully restored original driverConfig of ClusterCSIDriver")
7791
})
7892

@@ -81,13 +95,15 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
8195
name string
8296
clusterCSIDriverOptions *opv1.VSphereCSIDriverConfigSpec
8397
cloudConfigOptions map[string]string
84-
successfulSnapshotsCreated int // Number of snapshots that should be created successfully, 0 to skip.
98+
successfulSnapshotsCreated int // Number of snapshots that should be created successfully, 0 to skip.
99+
operatorShouldProgress bool // Indicates if we expect to see storage operator change condition to Progressing=True
85100
}{
86101
{
87102
name: "use default when unset",
88103
clusterCSIDriverOptions: nil,
89104
cloudConfigOptions: map[string]string{},
90105
successfulSnapshotsCreated: 3,
106+
operatorShouldProgress: false,
91107
},
92108
{
93109
name: "allow setting global snapshot limit",
@@ -98,6 +114,7 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
98114
"global-max-snapshots-per-block-volume": "4",
99115
},
100116
successfulSnapshotsCreated: 4,
117+
operatorShouldProgress: true,
101118
},
102119
{
103120
name: "allow setting VSAN limit",
@@ -108,6 +125,7 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
108125
"granular-max-snapshots-per-block-volume-vsan": "4",
109126
},
110127
successfulSnapshotsCreated: 0,
128+
operatorShouldProgress: true,
111129
},
112130
{
113131
name: "allow setting VVOL limit",
@@ -118,6 +136,7 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
118136
"granular-max-snapshots-per-block-volume-vvol": "4",
119137
},
120138
successfulSnapshotsCreated: 0,
139+
operatorShouldProgress: true,
121140
},
122141
{
123142
name: "allow all limits to be set at once",
@@ -132,14 +151,36 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
132151
"granular-max-snapshots-per-block-volume-vvol": "15",
133152
},
134153
successfulSnapshotsCreated: 0,
154+
operatorShouldProgress: true,
135155
},
136156
}
137157

138158
for _, t := range tests {
139159
t := t
140-
g.It(fmt.Sprintf("%s", t.name), func() {
160+
g.It(t.name, func(ctx g.SpecContext) {
161+
defer g.GinkgoRecover()
162+
operatorShouldProgress = t.operatorShouldProgress
141163

142164
setClusterCSIDriverSnapshotOptions(ctx, oc, t.clusterCSIDriverOptions)
165+
166+
if operatorShouldProgress {
167+
// Wait for Progressing=True within 10 seconds
168+
{
169+
ctxWithTimeout, cancel := context.WithTimeout(ctx, 10*time.Second)
170+
defer cancel()
171+
err := exutil.WaitForOperatorProgressingTrue(ctxWithTimeout, oc.AdminConfigClient(), "storage")
172+
o.Expect(err).NotTo(o.HaveOccurred())
173+
}
174+
175+
// Then wait for Progressing=False within next 10 seconds
176+
{
177+
ctxWithTimeout, cancel := context.WithTimeout(ctx, 10*time.Second)
178+
defer cancel()
179+
err := exutil.WaitForOperatorProgressingFalse(ctxWithTimeout, oc.AdminConfigClient(), "storage")
180+
o.Expect(err).NotTo(o.HaveOccurred())
181+
}
182+
}
183+
143184
o.Eventually(func() error {
144185
return loadAndCheckCloudConf(ctx, oc, "Snapshot", t.cloudConfigOptions, t.clusterCSIDriverOptions)
145186
}, pollTimeout, pollInterval).Should(o.Succeed())

0 commit comments

Comments
 (0)