mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
Merge pull request #111848 from ii/create-namespace-replace-test
Write CoreV1NamespaceReplace Test +1 Endpoint
This commit is contained in:
commit
3528d6f38e
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user