diff --git a/hack/make-rules/test-cmd.sh b/hack/make-rules/test-cmd.sh index dab33477e7..1af9ae739c 100755 --- a/hack/make-rules/test-cmd.sh +++ b/hack/make-rules/test-cmd.sh @@ -2249,6 +2249,13 @@ __EOF__ kubectl get rs nginx-618515232 -o yaml | grep "deployment.kubernetes.io/revision-history: 1,3" # Check that trying to watch the status of a superseded revision returns an error ! kubectl rollout status deployment/nginx --revision=3 + cat hack/testdata/deployment-revision1.yaml | $SED "s/name: nginx$/name: nginx2/" | kubectl create -f - "${kube_flags[@]}" + # Newest deployment should be marked as overlapping + kubectl get deployment nginx2 -o yaml "${kube_flags[@]}" | grep "deployment.kubernetes.io/error-selector-overlapping-with" + # Oldest deployment should not be marked as overlapping + ! kubectl get deployment nginx -o yaml "${kube_flags[@]}" | grep "deployment.kubernetes.io/error-selector-overlapping-with" + # Deletion of both deployments should not be blocked + kubectl delete deployment nginx2 "${kube_flags[@]}" # Clean up kubectl delete deployment nginx "${kube_flags[@]}" diff --git a/test/e2e/deployment.go b/test/e2e/deployment.go index 82c6307470..02e2756fec 100644 --- a/test/e2e/deployment.go +++ b/test/e2e/deployment.go @@ -1255,11 +1255,11 @@ func testOverlappingDeployment(f *framework.Framework) { Expect(err).NotTo(HaveOccurred(), "Failed creating the second deployment") // Wait for overlapping annotation updated to both deployments - By("Waiting for both deployments to have overlapping annotations") - err = framework.WaitForOverlappingAnnotationMatch(c, ns, deploy.Name, deployOverlapping.Name) - Expect(err).NotTo(HaveOccurred(), "Failed to update the first deployment's overlapping annotation") + By("Waiting for the overlapping deployment to have overlapping annotation") err = framework.WaitForOverlappingAnnotationMatch(c, ns, deployOverlapping.Name, deploy.Name) Expect(err).NotTo(HaveOccurred(), "Failed to update the second deployment's overlapping annotation") + err = framework.WaitForOverlappingAnnotationMatch(c, ns, deploy.Name, "") + Expect(err).NotTo(HaveOccurred(), "The deployment that holds the oldest selector shouldn't have the overlapping annotation") // Only the first deployment is synced By("Checking only the first overlapping deployment is synced") @@ -1311,11 +1311,11 @@ func testOverlappingDeployment(f *framework.Framework) { Expect(err).NotTo(HaveOccurred()) // Wait for overlapping annotation updated to both deployments - By("Waiting for both deployments to have overlapping annotations") - err = framework.WaitForOverlappingAnnotationMatch(c, ns, deployOverlapping.Name, deployLater.Name) - Expect(err).NotTo(HaveOccurred(), "Failed to update the second deployment's overlapping annotation") + By("Waiting for the third deployment to have the overlapping annotation") err = framework.WaitForOverlappingAnnotationMatch(c, ns, deployLater.Name, deployOverlapping.Name) Expect(err).NotTo(HaveOccurred(), "Failed to update the third deployment's overlapping annotation") + err = framework.WaitForOverlappingAnnotationMatch(c, ns, deployOverlapping.Name, "") + Expect(err).NotTo(HaveOccurred(), "The deployment that holds the oldest selector shouldn't have the overlapping annotation") // The second deployment shouldn't be synced By("Checking the second deployment is not synced")