Skip to content

Commit d5b275f

Browse files
authored
test: mark test case resources with label (#1645)
Signed-off-by: Roman Sysoev <[email protected]>
1 parent 23ec2a1 commit d5b275f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/e2e/internal/framework/framework.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package framework
1919
import (
2020
"context"
2121
"fmt"
22+
"maps"
2223
"time"
2324

2425
. "github.com/onsi/ginkgo/v2"
@@ -165,6 +166,13 @@ func (f *Framework) Delete(ctx context.Context, objs ...client.Object) error {
165166
// Returns an error if the creation of any resource
166167
func (f *Framework) CreateWithDeferredDeletion(ctx context.Context, objs ...client.Object) error {
167168
for _, obj := range objs {
169+
labels := obj.GetLabels()
170+
if labels == nil {
171+
labels = make(map[string]string)
172+
}
173+
maps.Copy(labels, map[string]string{NamespaceLabel: f.namespacePrefix})
174+
obj.SetLabels(labels)
175+
168176
err := f.client.Create(ctx, obj)
169177
if err != nil {
170178
return err

0 commit comments

Comments
 (0)