fix: update deployment e2e tests

Previously, we were trying to patch the deployment's ready replicas by
changing it to 0, at the same time we have 2 available replicas.
Therefore, this test fails since the ready replicas is less than the
available replicas. As a fix, we make the number of ready replicas equals to the number
of available ones.

Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
This commit is contained in:
AhmedGrati 2023-06-23 21:37:02 +01:00
parent 9325a57125
commit 89a9e480f9

View File

@ -194,6 +194,7 @@ var _ = SIGDescribe("Deployment", func() {
testDeploymentDefaultReplicas := int32(2)
testDeploymentMinimumReplicas := int32(1)
testDeploymentNoReplicas := int32(0)
testDeploymentAvailableReplicas := int32(0)
testDeploymentLabels := map[string]string{"test-deployment-static": "true"}
testDeploymentLabelsFlat := "test-deployment-static=true"
w := &cache.ListWatch{
@ -399,14 +400,14 @@ var _ = SIGDescribe("Deployment", func() {
"labels": map[string]string{"test-deployment": "patched-status"},
},
"status": map[string]interface{}{
"readyReplicas": testDeploymentNoReplicas,
"readyReplicas": testDeploymentNoReplicas,
"availableReplicas": testDeploymentAvailableReplicas,
},
})
framework.ExpectNoError(err, "failed to Marshal Deployment JSON patch")
// This test is broken, patching fails with:
// Deployment.apps "test-deployment" is invalid: status.availableReplicas: Invalid value: 2: cannot be greater than readyReplicas
// https://github.com/kubernetes/kubernetes/issues/113259
_, _ = dc.Resource(deploymentResource).Namespace(testNamespaceName).Patch(ctx, testDeploymentName, types.StrategicMergePatchType, []byte(deploymentStatusPatch), metav1.PatchOptions{}, "status")
_, err = dc.Resource(deploymentResource).Namespace(testNamespaceName).Patch(ctx, testDeploymentName, types.StrategicMergePatchType, []byte(deploymentStatusPatch), metav1.PatchOptions{}, "status")
framework.ExpectNoError(err)
ctxUntil, cancel = context.WithTimeout(ctx, 30*time.Second)
defer cancel()