From 7015dae352fe8db119e210d2893555a845851f84 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 27 Oct 2023 15:17:54 +0300 Subject: [PATCH] test/e2e: cleanup feature annotations Delete NFD-managed feature annotations at test setup and teardown --- test/e2e/node_feature_discovery_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/e2e/node_feature_discovery_test.go b/test/e2e/node_feature_discovery_test.go index 29cee182f..62c61ddea 100644 --- a/test/e2e/node_feature_discovery_test.go +++ b/test/e2e/node_feature_discovery_test.go @@ -66,6 +66,12 @@ func cleanupNode(ctx context.Context, cs clientset.Interface) { nfdLabels[name] = struct{}{} } } + nfdAnnotations := map[string]struct{}{} + for _, name := range strings.Split(node.Annotations[nfdv1alpha1.FeatureAnnotationsTrackingAnnotation], ",") { + if strings.Contains(name, "/") { + nfdAnnotations[name] = struct{}{} + } + } nfdERs := map[string]struct{}{} for _, name := range strings.Split(node.Annotations[nfdv1alpha1.ExtendedResourceAnnotation], ",") { if strings.Contains(name, "/") { @@ -84,7 +90,8 @@ func cleanupNode(ctx context.Context, cs clientset.Interface) { // Remove annotations for key := range node.Annotations { - if strings.HasPrefix(key, nfdv1alpha1.AnnotationNs) { + _, ok := nfdAnnotations[key] + if ok || strings.HasPrefix(key, nfdv1alpha1.AnnotationNs) || strings.HasPrefix(key, nfdv1alpha1.FeatureAnnotationNs) { delete(node.Annotations, key) update = true }