Change:
[X] Test approval issue: [X] Test PR: 15 Oct 2022 [X] Two weeks soak end date: 28 Oct 2022 [X] Test promotion PR: According to this APIsnoop query, there are still one remaining Namespace endpoint which is untested. replaceCoreV1NamespaceFinalize Note: The test also removes the fake finalize from before calling the finalize action on the test namespace a second time. This will allow the test framework to clean up all namespaces when the e2e finishes, else the test namespace will be stuck in the state. Using a number of existing e2e test practices a new has been created for one Namespace endpoint. The e2e logs for this test are listed below. This query shows that the Finalize endpoint is hit within a short period of running this e2e test If a test with these calls gets merged, test coverage will go up by 1 point This test is also created with the goal of conformance promotion. /sig testing /sig architecture /area conformance
/triage accepted
/reopen
Reopened this issue. <detailsIn response to : /reopen Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details

Discussion:
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" <ins> utilrand "k8s.io/apimachinery/pkg/util/rand" </ins> "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/apimachinery/pkg/util/wait" clientscheme "k8s.io/client-go/kubernetes/scheme"

framework.ExpectEqual(updatedNamespace.ObjectMeta.Labels[ns], "updated", "Failed to update namespace %q. Current Labels: %#v", ns, updatedNamespace.Labels) framework.Logf("Namespace %q now has labels, %#v", ns, updatedNamespace.Labels) }) <ins> ginkgo.It("should apply a finalizer to a Namespace", func() { fakeFinalizer := v1.FinalizerName("e2e.example.com/fakeFinalizer") var updatedNamespace *v1.Namespace nsName := "e2e-ns-" + utilrand.String(5) ginkgo.By(fmt.Sprintf("Creating namespace %q", nsName)) testNamespace, err := f.CreateNamespace(nsName, nil) framework.ExpectNoError(err, "failed creating Namespace") ns := testNamespace.ObjectMeta.Name nsClient := f.ClientSet.CoreV1().Namespaces() framework.Logf("Namespace %q has %#v", testNamespace.Name, testNamespace.Spec.Finalizers) ginkgo.By(fmt.Sprintf("Adding e2e finalizer to namespace %q", ns)) err = retry.RetryOnConflict(retry.DefaultRetry, func() error { updateNamespace, err := nsClient.Get(context.TODO(), ns, metav1.GetOptions{}) framework.ExpectNoError(err, "Unable to get Namespace %q", ns) updateNamespace.Spec.Finalizers = append(updateNamespace.Spec.Finalizers, fakeFinalizer) updatedNamespace, err = nsClient.Finalize(context.TODO(), updateNamespace, metav1.UpdateOptions{}) return err }) framework.ExpectNoError(err, "failed to add finalizer to the namespace: %q", ns) var foundFinalizer bool for _, item := range updatedNamespace.Spec.Finalizers { if item == fakeFinalizer { foundFinalizer = true break } } framework.ExpectEqual(foundFinalizer, true, "Finalizer %q was not found. Namespace %q has %#v", fakeFinalizer, updatedNamespace.Spec.Finalizers) framework.Logf("Namespace %q has %#v", updatedNamespace.Name, updatedNamespace.Spec.Finalizers) ginkgo.By(fmt.Sprintf("Removing e2e finalizer from namespace %q", ns)) err = retry.RetryOnConflict(retry.DefaultRetry, func() error { updatedNamespace, err = nsClient.Get(context.TODO(), ns, metav1.GetOptions{}) framework.ExpectNoError(err, "Unable to get namespace %q", ns) var finalizerList []v1.FinalizerName for _, item := range updatedNamespace.Spec.Finalizers { if item != fakeFinalizer { finalizerList = append(finalizerList, item) } } updatedNamespace.Spec.Finalizers = finalizerList updatedNamespace, err = nsClient.Finalize(context.TODO(), updatedNamespace, metav1.UpdateOptions{}) return err }) framework.ExpectNoError(err, "failed to remove finalizer from namespace: %q", ns) foundFinalizer = false for _, item := range updatedNamespace.Spec.Finalizers { if item == fakeFinalizer { foundFinalizer = true break } } framework.ExpectEqual(foundFinalizer, false, "Finalizer %q was found. Namespace %q has %#v", fakeFinalizer, updatedNamespace.Spec.Finalizers) framework.Logf("Namespace %q has %#v", updatedNamespace.Name, updatedNamespace.Spec.Finalizers) }) </ins> }) func unstructuredToNamespace(obj *unstructured.Unstructured) (*v1.Namespace, error) {