diff --git a/test/util/cluster/cluster.go b/test/util/cluster/cluster.go index e2db853d1..7bd0b8e9a 100644 --- a/test/util/cluster/cluster.go +++ b/test/util/cluster/cluster.go @@ -11,6 +11,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes" + "k8s.io/utils/pointer" runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" sriovv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1" @@ -282,6 +283,13 @@ func GetNodeSecureBootState(clients *testclient.ClientSet, nodeName, namespace s return false, err } + defer func() { + err = clients.Pods(namespace).Delete(context.Background(), created.Name, metav1.DeleteOptions{GracePeriodSeconds: pointer.Int64Ptr(0)}) + if err != nil { + err = fmt.Errorf("failed to remove the check secure boot status pod for node %s: %v", nodeName, err) + } + }() + var runningPod *corev1.Pod err = wait.PollImmediate(time.Second, 3*time.Minute, func() (bool, error) { runningPod, err = clients.Pods(namespace).Get(context.Background(), created.Name, metav1.GetOptions{})