Merge pull request #111848 from ii/create-namespace-replace-test

Write CoreV1NamespaceReplace Test +1 Endpoint
This commit is contained in:
Kubernetes Prow Robot 2022-08-25 23:34:26 -07:00 committed by GitHub
commit 3528d6f38e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -355,6 +355,26 @@ var _ = SIGDescribe("Namespaces [Serial]", func() {
framework.ExpectEqual(statusUpdated.Status.Conditions[len(statusUpdated.Status.Conditions)-1].Message, "Updated by an e2e test", "The Message returned was %v", statusUpdated.Status.Conditions[0].Message)
framework.Logf("Status.Condition: %#v", statusUpdated.Status.Conditions[len(statusUpdated.Status.Conditions)-1])
})
ginkgo.It("should apply an update to a Namespace", func() {
var err error
var updatedNamespace *v1.Namespace
ns := f.Namespace.Name
cs := f.ClientSet
ginkgo.By(fmt.Sprintf("Updating Namespace %q", ns))
err = retry.RetryOnConflict(retry.DefaultRetry, func() error {
updatedNamespace, err = cs.CoreV1().Namespaces().Get(context.TODO(), ns, metav1.GetOptions{})
framework.ExpectNoError(err, "Unable to get Namespace %q", ns)
updatedNamespace.Labels[ns] = "updated"
updatedNamespace, err = cs.CoreV1().Namespaces().Update(context.TODO(), updatedNamespace, metav1.UpdateOptions{})
return err
})
framework.ExpectNoError(err, "failed to update Namespace: %q", ns)
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)
})
})
func unstructuredToNamespace(obj *unstructured.Unstructured) (*v1.Namespace, error) {