fix flaky e2e test (#1791)

Signed-off-by: Yue Wang <seiwy2010@gmail.com>
This commit is contained in:
Yue Wang
2021-06-13 16:20:01 +09:00
committed by GitHub
parent 889e38e984
commit fbb0cddb30
4 changed files with 28 additions and 10 deletions

View File

@@ -77,7 +77,9 @@ var _ = Describe("Application Normal tests", func() {
var newApp v1beta1.Application
Expect(common.ReadYamlToObject("testdata/app/"+source, &newApp)).Should(BeNil())
newApp.Namespace = namespaceName
Expect(k8sClient.Create(ctx, &newApp)).Should(Succeed())
Eventually(func() error {
return k8sClient.Create(ctx, newApp.DeepCopy())
}, 10*time.Second, 500*time.Millisecond).Should(Succeed())
By("Get Application latest status")
Eventually(

View File

@@ -196,7 +196,9 @@ var _ = Describe("Test application of the specified definition version", func()
}
By("Create application")
Expect(k8sClient.Create(ctx, &app)).Should(Succeed())
Eventually(func() error {
return k8sClient.Create(ctx, app.DeepCopy())
}, 10*time.Second, 500*time.Millisecond).Should(Succeed())
By("Verify the workload(deployment) is created successfully")
webServiceDeploy := &appsv1.Deployment{}
@@ -408,7 +410,9 @@ var _ = Describe("Test application of the specified definition version", func()
}
By("Create application")
Expect(k8sClient.Create(ctx, &app)).Should(Succeed())
Eventually(func() error {
return k8sClient.Create(ctx, app.DeepCopy())
}, 10*time.Second, 500*time.Millisecond).Should(Succeed())
By("Verify the workload(deployment) is created successfully by Helm")
deploy := &appsv1.Deployment{}
@@ -563,7 +567,9 @@ var _ = Describe("Test application of the specified definition version", func()
}
By("Create application")
Expect(k8sClient.Create(ctx, &app)).Should(Succeed())
Eventually(func() error {
return k8sClient.Create(ctx, app.DeepCopy())
}, 10*time.Second, 500*time.Millisecond).Should(Succeed())
By("Verify the workload(job) is created successfully")
job := &batchv1.Job{}

View File

@@ -167,7 +167,9 @@ var _ = Describe("Test application containing helm module", func() {
},
}
By("Create application")
Expect(k8sClient.Create(ctx, &app)).Should(Succeed())
Eventually(func() error {
return k8sClient.Create(ctx, app.DeepCopy())
}, 10*time.Second, 500*time.Millisecond).Should(Succeed())
By("Verify the workload(deployment) is created successfully by Helm")
deploy := &appsv1.Deployment{}
@@ -301,7 +303,9 @@ var _ = Describe("Test application containing helm module", func() {
},
}
By("Create application")
Expect(k8sClient.Create(ctx, &appTest)).Should(Succeed())
Eventually(func() error {
return k8sClient.Create(ctx, appTest.DeepCopy())
}, 10*time.Second, 500*time.Millisecond).Should(Succeed())
By("Verify the workload(deployment) is created successfully by Helm")
deploy := &appsv1.Deployment{}
@@ -353,7 +357,9 @@ var _ = Describe("Test application containing helm module", func() {
},
}
By("Create application")
Expect(k8sClient.Create(ctx, &newApp)).Should(Succeed())
Eventually(func() error {
return k8sClient.Create(ctx, newApp.DeepCopy())
}, 10*time.Second, 500*time.Millisecond).Should(Succeed())
By("Verify the workload(deployment) is created successfully by Helm")
deploy := &appsv1.Deployment{}
@@ -375,6 +381,6 @@ var _ = Describe("Test application containing helm module", func() {
return errors.New("json schema is not found in the ConfigMap")
}
return nil
}, 60*time.Second, 5*time.Second).Should(Succeed())
}, 60*time.Second, 500*time.Millisecond).Should(Succeed())
})
})

View File

@@ -197,7 +197,9 @@ spec:
},
}
By("Create application")
Expect(k8sClient.Create(ctx, &app)).Should(Succeed())
Eventually(func() error {
return k8sClient.Create(ctx, app.DeepCopy())
}, 10*time.Second, 500*time.Millisecond).Should(Succeed())
By("Verify the workload(deployment) is created successfully")
deploy := &appsv1.Deployment{}
@@ -325,7 +327,9 @@ spec:
},
}
By("Create application")
Expect(k8sClient.Create(ctx, &appTest)).Should(Succeed())
Eventually(func() error {
return k8sClient.Create(ctx, appTest.DeepCopy())
}, 10*time.Second, 500*time.Millisecond).Should(Succeed())
By("Verify the workload(deployment) is created successfully")
deploy := &appsv1.Deployment{}