Skip to content

Commit 1006dbe

Browse files
committed
[tmp] e2e: Log CSV status if OSSM deployment failed
1 parent 7cc8b51 commit 1006dbe

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

test/e2e/gateway_api_upgrade_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func TestOSSMOperatorUpgradeViaIntermediateVersions(t *testing.T) {
8989
}
9090
t.Log("Checking for the OSSM operator deployment...")
9191
if err := assertOSSMOperatorWithConfig(t, initialOSSMVersion, 2*time.Second, 2*time.Minute); err != nil {
92+
logClusterServiceVersion(t, openshiftOperatorsNamespace, initialOSSMVersion)
9293
t.Fatalf("Failed to find expected Istio operator: %v", err)
9394
}
9495
t.Log("Checking for the Istio CR...")

test/e2e/util_gatewayapi_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,23 @@ func assertInstallPlan(t *testing.T, namespace, csvName string) error {
697697
return err
698698
}
699699

700+
// logClusterServiceVersion logs the status of the given cluster service version.
701+
func logClusterServiceVersion(t *testing.T, namespace, csvName string) error {
702+
t.Helper()
703+
704+
csv := &operatorsv1alpha1.ClusterServiceVersion{}
705+
nsName := types.NamespacedName{Namespace: namespace, Name: csvName}
706+
707+
return wait.PollUntilContextTimeout(context.Background(), 2*time.Second, 2*time.Minute, false, func(context context.Context) (bool, error) {
708+
if err := kclient.Get(context, nsName, csv); err != nil {
709+
t.Logf("Failed to get cluster service version %q: %v, retrying...", nsName.Name, err)
710+
return false, nil
711+
}
712+
t.Logf("Found cluster service version %q:\n%s", nsName.Name, util.ToYaml(csv.Status))
713+
return true, nil
714+
})
715+
}
716+
700717
// assertOSSMOperator checks if the OSSM operator gets successfully installed
701718
// and returns an error if not. It uses configurable parameters such as the expected OSSM version, polling interval, and timeout.
702719
func assertOSSMOperator(t *testing.T) error {

0 commit comments

Comments
 (0)