@@ -10,7 +10,9 @@ import (
1010
1111 g "github.com/onsi/ginkgo/v2"
1212 o "github.com/onsi/gomega"
13+ configv1 "github.com/openshift/api/config/v1"
1314 opv1 "github.com/openshift/api/operator/v1"
15+ "github.com/openshift/library-go/pkg/config/clusteroperator/v1helpers"
1416 exutil "github.com/openshift/origin/test/extended/util"
1517 "gopkg.in/ini.v1"
1618 v1 "k8s.io/api/core/v1"
@@ -30,11 +32,43 @@ const (
3032 pollInterval = 5 * time .Second
3133)
3234
35+ // logOperatorStatus logs the current status of the storage operator for debugging
36+ func logOperatorStatus (ctx context.Context , oc * exutil.CLI ) {
37+ operator , err := oc .AdminConfigClient ().ConfigV1 ().ClusterOperators ().Get (ctx , "storage" , metav1.GetOptions {})
38+ if err != nil {
39+ e2e .Logf ("Failed to get storage operator status: %v" , err )
40+ return
41+ }
42+
43+ progressing := v1helpers .FindStatusCondition (operator .Status .Conditions , configv1 .OperatorProgressing )
44+ available := v1helpers .FindStatusCondition (operator .Status .Conditions , configv1 .OperatorAvailable )
45+ degraded := v1helpers .FindStatusCondition (operator .Status .Conditions , configv1 .OperatorDegraded )
46+
47+ progressingStatus := "Unknown"
48+ if progressing != nil {
49+ progressingStatus = fmt .Sprintf ("%s (Reason: %s, Message: %s)" , progressing .Status , progressing .Reason , progressing .Message )
50+ }
51+
52+ availableStatus := "Unknown"
53+ if available != nil {
54+ availableStatus = string (available .Status )
55+ }
56+
57+ degradedStatus := "Unknown"
58+ if degraded != nil {
59+ degradedStatus = string (degraded .Status )
60+ }
61+
62+ e2e .Logf ("Storage operator status - Progressing: %s, Available: %s, Degraded: %s" ,
63+ progressingStatus , availableStatus , degradedStatus )
64+ }
65+
3366// This is [Serial] because it modifies ClusterCSIDriver.
3467var _ = g .Describe ("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial][apigroup:operator.openshift.io] vSphere CSI Driver Configuration" , func () {
3568 defer g .GinkgoRecover ()
3669 var (
3770 oc = exutil .NewCLI (projectName )
71+ progressingTimeout = 5 * time .Minute
3872 originalDriverConfigSpec * opv1.CSIDriverConfigSpec
3973 operatorShouldProgress bool
4074 )
@@ -96,7 +130,7 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
96130 clusterCSIDriverOptions * opv1.VSphereCSIDriverConfigSpec
97131 cloudConfigOptions map [string ]string
98132 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
133+ operatorShouldProgress bool // Indicates if we expect to see storage operator change condition to Progressing=True and back to False
100134 }{
101135 {
102136 name : "use default when unset" ,
@@ -164,27 +198,46 @@ var _ = g.Describe("[sig-storage][FeatureGate:VSphereDriverConfiguration][Serial
164198 setClusterCSIDriverSnapshotOptions (ctx , oc , t .clusterCSIDriverOptions )
165199
166200 if operatorShouldProgress {
167- // Wait for Progressing=True within 10 seconds
201+
202+ e2e .Logf ("Waiting for storage operator to start progressing (Progressing=True) with timeout %v" , progressingTimeout )
203+ // Wait for Progressing=True
168204 {
169- ctxWithTimeout , cancel := context .WithTimeout (ctx , 10 * time . Second )
205+ ctxWithTimeout , cancel := context .WithTimeout (ctx , progressingTimeout )
170206 defer cancel ()
171207 err := exutil .WaitForOperatorProgressingTrue (ctxWithTimeout , oc .AdminConfigClient (), "storage" )
172- o .Expect (err ).NotTo (o .HaveOccurred ())
208+ if err != nil {
209+ logOperatorStatus (ctx , oc )
210+ o .Expect (err ).NotTo (o .HaveOccurred (), fmt .Sprintf ("Failed to wait for operator Progressing=True within %v" , progressingTimeout ))
211+ }
212+ e2e .Logf ("Storage operator is now Progressing=True" )
173213 }
174214
175- // Then wait for Progressing=False within next 10 seconds
215+ e2e .Logf ("Waiting for storage operator to stop progressing (Progressing=False) with timeout %v" , progressingTimeout )
216+ // Then wait for Progressing=False
176217 {
177- ctxWithTimeout , cancel := context .WithTimeout (ctx , 10 * time . Second )
218+ ctxWithTimeout , cancel := context .WithTimeout (ctx , progressingTimeout )
178219 defer cancel ()
220+ logOperatorStatus (ctx , oc )
221+
179222 err := exutil .WaitForOperatorProgressingFalse (ctxWithTimeout , oc .AdminConfigClient (), "storage" )
180- o .Expect (err ).NotTo (o .HaveOccurred ())
223+ if err != nil {
224+ e2e .Logf ("Timed out waiting for operator Progressing=False (timeout: %v)" , progressingTimeout )
225+ logOperatorStatus (ctx , oc )
226+ o .Expect (err ).NotTo (o .HaveOccurred (), fmt .Sprintf ("Failed to wait for operator Progressing=False within %v" , progressingTimeout ))
227+ } else {
228+ e2e .Logf ("Storage operator is now Progressing=False" )
229+ }
181230 }
182231 }
183232
233+ e2e .Logf ("Validating cloud.conf configuration matches expected snapshot options" )
184234 o .Eventually (func () error {
185235 return loadAndCheckCloudConf (ctx , oc , "Snapshot" , t .cloudConfigOptions , t .clusterCSIDriverOptions )
186236 }, pollTimeout , pollInterval ).Should (o .Succeed ())
187237
238+ if t .successfulSnapshotsCreated > 0 {
239+ e2e .Logf ("Validating snapshot creation (expecting %d successful snapshots)" , t .successfulSnapshotsCreated )
240+ }
188241 validateSnapshotCreation (ctx , oc , t .successfulSnapshotsCreated )
189242 })
190243 }
0 commit comments