fix unstable appcontext test (#1312)

This commit is contained in:
wyike
2021-03-26 15:46:01 +08:00
committed by GitHub
parent 74a82e0397
commit 0e9a3ceb3b
+39 -9
View File
@@ -221,9 +221,19 @@ var _ = Describe("Test applicationContext reconcile", func() {
}, time.Second*60, time.Millisecond*300).Should(BeNil())
By("Test revision have both workload and trait , switch AppContext to revision2")
Expect(k8sClient.Get(ctx, key, appContext)).Should(BeNil())
appContext.Spec.ApplicationRevisionName = arName2
Expect(k8sClient.Update(ctx, appContext)).Should(Succeed())
Eventually(func() error {
updateContext := new(v1alpha2.ApplicationContext)
err := k8sClient.Get(ctx, key, updateContext)
if err != nil {
return err
}
updateContext.Spec.ApplicationRevisionName = arName2
err = k8sClient.Update(ctx, updateContext)
if err != nil {
return err
}
return nil
}, time.Second*60, time.Microsecond*300).Should(BeNil())
Eventually(func() error {
appCtx := new(v1alpha2.ApplicationContext)
err := k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: appContextName}, appCtx)
@@ -276,9 +286,19 @@ var _ = Describe("Test applicationContext reconcile", func() {
Expect(k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: arName1}, ar1)).Should(BeNil())
ar1.Spec.ApplicationConfiguration = util.Object2RawExtension(ac1)
Expect(k8sClient.Update(ctx, ar1)).Should(Succeed())
Expect(k8sClient.Get(ctx, key, appContext)).Should(BeNil())
appContext.Spec.ApplicationRevisionName = arName1
Expect(k8sClient.Update(ctx, appContext)).Should(Succeed())
Eventually(func() error {
updateContext := new(v1alpha2.ApplicationContext)
err := k8sClient.Get(ctx, key, updateContext)
if err != nil {
return err
}
updateContext.Spec.ApplicationRevisionName = arName1
err = k8sClient.Update(ctx, updateContext)
if err != nil {
return err
}
return nil
}, time.Second*60, time.Microsecond*300).Should(BeNil())
Eventually(func() error {
mt := new(v1alpha2.ManualScalerTrait)
err := k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: traitName1}, mt)
@@ -297,9 +317,19 @@ var _ = Describe("Test applicationContext reconcile", func() {
ac2.Spec.Components[0].Traits = []v1alpha2.ComponentTrait{}
ar1.Spec.ApplicationConfiguration = util.Object2RawExtension(ac2)
Expect(k8sClient.Update(ctx, ar2)).Should(BeNil())
Expect(k8sClient.Get(ctx, key, appContext)).Should(BeNil())
appContext.Spec.ApplicationRevisionName = arName2
Expect(k8sClient.Update(ctx, appContext)).Should(Succeed())
Eventually(func() error {
updateContext := new(v1alpha2.ApplicationContext)
err := k8sClient.Get(ctx, key, updateContext)
if err != nil {
return err
}
updateContext.Spec.ApplicationRevisionName = arName2
err = k8sClient.Update(ctx, updateContext)
if err != nil {
return err
}
return nil
}, time.Second*60, time.Microsecond*300).Should(BeNil())
Eventually(func() error {
mt := new(v1alpha2.ManualScalerTrait)
return k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: traitName2}, mt)