From 66f64d92f1ceafff7dc93f9d4b52d51b714bcc2f Mon Sep 17 00:00:00 2001 From: Jakub Buczak Date: Wed, 18 Mar 2026 14:09:15 +0100 Subject: [PATCH 1/2] Enhance error handling in WaitforPhaseChange and fix variable name in NewTestCaseEnv * Updated WaitforPhaseChange to log an error if the phase transition is not observed within the timeout. * Corrected the variable name check in NewTestCaseEnv to use the provided name instead of an uninitialized envName. * Changed Kind from "ClusterManager" to "ClusterMaster" in ClusterMaster struct. --- test/testenv/appframework_utils.go | 4 +++- test/testenv/testcaseenv.go | 4 +--- test/testenv/util.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/testenv/appframework_utils.go b/test/testenv/appframework_utils.go index a60554bd6..a66695345 100644 --- a/test/testenv/appframework_utils.go +++ b/test/testenv/appframework_utils.go @@ -430,7 +430,9 @@ func GenerateAppFrameworkSpec(ctx context.Context, testenvInstance *TestCaseEnv, // WaitforPhaseChange Wait for timeout or when phase change is seen on a CR for any particular app // Deprecated: Use WaitForAppPhaseChange instead for better timeout control func WaitforPhaseChange(ctx context.Context, deployment *Deployment, testenvInstance *TestCaseEnv, name string, crKind string, appSourceName string, appList []string) { - _ = WaitForAppPhaseChange(ctx, deployment, testenvInstance, name, crKind, appSourceName, appList, 2*time.Minute) + if err := WaitForAppPhaseChange(ctx, deployment, testenvInstance, name, crKind, appSourceName, appList, 2*time.Minute); err != nil { + testenvInstance.Log.Info("WaitforPhaseChange did not observe a phase transition within timeout", "cr", name, "kind", crKind, "appSource", appSourceName, "error", err) + } } // WaitForAppPhaseChange waits for any app in the list to change from PhaseInstall to another phase diff --git a/test/testenv/testcaseenv.go b/test/testenv/testcaseenv.go index 4e0ccb3c4..5399e56b4 100644 --- a/test/testenv/testcaseenv.go +++ b/test/testenv/testcaseenv.go @@ -72,10 +72,8 @@ func NewDefaultTestCaseEnv(kubeClient client.Client, name string) (*TestCaseEnv, // NewTestCaseEnv creates a new test environment to run tests againsts func NewTestCaseEnv(kubeClient client.Client, name string, operatorImage string, splunkImage string, licenseFilePath string) (*TestCaseEnv, error) { - var envName string - // The name are used in various resource label and there is a 63 char limit. Do our part to make sure we do not exceed that limit - if len(envName) > 24 { + if len(name) > 24 { return nil, fmt.Errorf("name %s has exceeded 24 chars", name) } diff --git a/test/testenv/util.go b/test/testenv/util.go index 90460849b..dbd849450 100644 --- a/test/testenv/util.go +++ b/test/testenv/util.go @@ -328,7 +328,7 @@ func newClusterMasterWithGivenIndexes(name, ns, licenseManagerName, ansibleConfi new := enterpriseApiV3.ClusterMaster{ TypeMeta: metav1.TypeMeta{ - Kind: "ClusterManager", + Kind: "ClusterMaster", }, ObjectMeta: metav1.ObjectMeta{ Name: name, From b4113e1a9482ac2c8539dfa7859fe83a288b16fb Mon Sep 17 00:00:00 2001 From: Jakub Buczak Date: Fri, 20 Mar 2026 09:43:08 +0100 Subject: [PATCH 2/2] Update error logging in WaitforPhaseChange to use Error level for timeout observations --- test/testenv/appframework_utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testenv/appframework_utils.go b/test/testenv/appframework_utils.go index a66695345..a1806d657 100644 --- a/test/testenv/appframework_utils.go +++ b/test/testenv/appframework_utils.go @@ -431,7 +431,7 @@ func GenerateAppFrameworkSpec(ctx context.Context, testenvInstance *TestCaseEnv, // Deprecated: Use WaitForAppPhaseChange instead for better timeout control func WaitforPhaseChange(ctx context.Context, deployment *Deployment, testenvInstance *TestCaseEnv, name string, crKind string, appSourceName string, appList []string) { if err := WaitForAppPhaseChange(ctx, deployment, testenvInstance, name, crKind, appSourceName, appList, 2*time.Minute); err != nil { - testenvInstance.Log.Info("WaitforPhaseChange did not observe a phase transition within timeout", "cr", name, "kind", crKind, "appSource", appSourceName, "error", err) + testenvInstance.Log.Error(err, "WaitforPhaseChange did not observe a phase transition within timeout", "cr", name, "kind", crKind, "appSource", appSourceName) } }