Skip to content

Commit 425545d

Browse files
author
Per Goncalves da Silva
committed
test
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
1 parent 13de323 commit 425545d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

test/e2e/steps/hooks.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ type scenarioContext struct {
3737
extensionObjects []client.Object
3838
}
3939

40-
// SaveClusterExtensionObjects collects all resources related to the ClusterExtension container in
40+
// GatherClusterExtensionObjects collects all resources related to the ClusterExtension container in
4141
// either their Helm release Secret or ClusterExtensionRevision depending on the applier being used
4242
// and saves them into the context.
43-
func (s *scenarioContext) SaveClusterExtensionObjects() error {
43+
func (s *scenarioContext) GatherClusterExtensionObjects() error {
4444
objs, err := listExtensionResources(s.clusterExtensionName)
4545
if err != nil {
4646
return fmt.Errorf("failed to load extension resources into context: %w", err)
@@ -49,8 +49,8 @@ func (s *scenarioContext) SaveClusterExtensionObjects() error {
4949
return nil
5050
}
5151

52-
// GetClusterExtensionObjects returns the ClusterExtension objects currently save into the context.
53-
// Will always return nil until SaveClusterExtensionObjects is called
52+
// GetClusterExtensionObjects returns the ClusterExtension objects currently saved into the context.
53+
// Will always return nil until GatherClusterExtensionObjects is called
5454
func (s *scenarioContext) GetClusterExtensionObjects() []client.Object {
5555
return s.extensionObjects
5656
}

test/e2e/steps/steps.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ func ClusterExtensionIsRolledOut(ctx context.Context) error {
293293
}, timeout, tick)
294294

295295
// Save ClusterExtension resources to test context for posterior checks
296-
if err := sc.SaveClusterExtensionObjects(); err != nil {
296+
if err := sc.GatherClusterExtensionObjects(); err != nil {
297297
return err
298298
}
299299
return nil
@@ -310,13 +310,13 @@ func ClusterExtensionResourcesCreatedAndAreLabeled(ctx context.Context) error {
310310
kind := obj.GetObjectKind().GroupVersionKind().Kind
311311
clusterObj, err := getResource(kind, obj.GetName(), obj.GetNamespace())
312312
if err != nil {
313-
logger.V(1).Info("error getting resource name=%q namespace=%q kind=%q: %v", obj.GetName(), obj.GetNamespace(), kind, err)
313+
logger.V(1).Error(err, "error getting resource", "name", obj.GetName(), "namespace", obj.GetNamespace(), "kind", kind)
314314
return false
315315
}
316316

317317
labels := clusterObj.GetLabels()
318318
if labels == nil {
319-
logger.V(1).Info("resource name=%q namespace=%q kind=%q has no labels", obj.GetName(), obj.GetNamespace(), kind)
319+
logger.V(1).Info("no labels found for resource", "name", obj.GetName(), "namespace", obj.GetNamespace(), "kind", kind)
320320
return false
321321
}
322322

@@ -325,7 +325,7 @@ func ClusterExtensionResourcesCreatedAndAreLabeled(ctx context.Context) error {
325325
"olm.operatorframework.io/owner-name": sc.clusterExtensionName,
326326
} {
327327
if labels[key] != expectedValue {
328-
logger.V(1).Info("resource name=%q namespace=%q kind=%q expected label %q to equal %q but got %q", obj.GetName(), obj.GetNamespace(), kind, key, expectedValue, labels["olm.operatorframework.io/owner-kind"])
328+
logger.V(1).Info("invalid resource label value", "name", obj.GetName(), "namespace", obj.GetNamespace(), "kind", kind, "label", key, "expected", expectedValue, "actual", labels["olm.operatorframework.io/owner-kind"])
329329
return false
330330
}
331331
}

0 commit comments

Comments
 (0)