From 89a9e480f9b8be3b1e183ccf2a0b58cbca022877 Mon Sep 17 00:00:00 2001 From: AhmedGrati Date: Fri, 23 Jun 2023 21:37:02 +0100 Subject: [PATCH] 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 --- test/e2e/apps/deployment.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/e2e/apps/deployment.go b/test/e2e/apps/deployment.go index 624b1aa7c4e..03711b4a48b 100644 --- a/test/e2e/apps/deployment.go +++ b/test/e2e/apps/deployment.go @@ -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()