Fix the overlapping e2e test for deployments

Fix the test to correctly expect the older deployment to be marked as
overlapping since that has the newest selector that overlaps.
This commit is contained in:
Michail Kargakis 2017-01-05 13:49:34 +01:00
parent 5dc96b5238
commit 43159a48f3

View File

@ -1194,27 +1194,27 @@ func testOverlappingDeployment(f *framework.Framework) {
podLabels = map[string]string{"name": nginxImageName}
By(fmt.Sprintf("Creating deployment %q", deploymentName))
d = newDeployment(deploymentName, replicas, podLabels, nginxImageName, nginxImage, extensions.RollingUpdateDeploymentStrategyType, nil)
deployLater, err := c.Extensions().Deployments(ns).Create(d)
thirdDeployment, err := c.Extensions().Deployments(ns).Create(d)
Expect(err).NotTo(HaveOccurred(), "Failed creating the third deployment")
// Wait for it to be updated to revision 1
err = framework.WaitForDeploymentRevisionAndImage(c, ns, deployLater.Name, "1", nginxImage)
err = framework.WaitForDeploymentRevisionAndImage(c, ns, thirdDeployment.Name, "1", nginxImage)
Expect(err).NotTo(HaveOccurred(), "The third deployment failed to update to revision 1")
// Update the second deployment's selector to make it overlap with the third deployment
By(fmt.Sprintf("Updating deployment %q selector to make it overlap with existing one", deployOverlapping.Name))
deployOverlapping, err = framework.UpdateDeploymentWithRetries(c, ns, deployOverlapping.Name, func(update *extensions.Deployment) {
update.Spec.Selector = deployLater.Spec.Selector
update.Spec.Template.Labels = deployLater.Spec.Template.Labels
update.Spec.Selector = thirdDeployment.Spec.Selector
update.Spec.Template.Labels = thirdDeployment.Spec.Template.Labels
update.Spec.Template.Spec.Containers[0].Image = redisImage
})
Expect(err).NotTo(HaveOccurred())
// Wait for overlapping annotation updated to both deployments
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, "")
By("Waiting for the second deployment to have the overlapping annotation")
err = framework.WaitForOverlappingAnnotationMatch(c, ns, deployOverlapping.Name, thirdDeployment.Name)
Expect(err).NotTo(HaveOccurred(), "Failed to update the second deployment's overlapping annotation")
err = framework.WaitForOverlappingAnnotationMatch(c, ns, thirdDeployment.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