This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/master by this push:
new f256c15 chore(e2e): Add test case to Integration scaling e2e tests
f256c15 is described below
commit f256c15c783f3bec5c0b110b2297c0cf2640ab36
Author: Antonin Stefanutti <[email protected]>
AuthorDate: Mon Feb 22 09:29:07 2021 +0100
chore(e2e): Add test case to Integration scaling e2e tests
---
e2e/common/scale_test.go | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/e2e/common/scale_test.go b/e2e/common/scale_test.go
index cc77db1..7944c64 100644
--- a/e2e/common/scale_test.go
+++ b/e2e/common/scale_test.go
@@ -60,7 +60,7 @@ func TestIntegrationScale(t *testing.T) {
assert.Nil(t, err)
// Patch the integration scale subresource
- patch := "{\"spec\":{\"replicas\":2}}"
+ patch := "{\"spec\":{\"replicas\":3}}"
_, err = scaleClient.Scales(ns).Patch(TestContext,
camelv1.SchemeGroupVersion.WithResource("integrations"), name,
types.MergePatchType, []byte(patch), metav1.PatchOptions{})
if err != nil {
t.Fatal(err)
@@ -68,12 +68,12 @@ func TestIntegrationScale(t *testing.T) {
// Check the Integration scale subresource Spec field
Eventually(IntegrationSpecReplicas(ns, name),
TestTimeoutShort).
- Should(gstruct.PointTo(BeNumerically("==", 2)))
+ Should(gstruct.PointTo(BeNumerically("==", 3)))
// Then check it cascades into the Deployment scale
- Eventually(IntegrationPods(ns, name),
TestTimeoutMedium).Should(HaveLen(2))
+ Eventually(IntegrationPods(ns, name),
TestTimeoutMedium).Should(HaveLen(3))
// Finally check it cascades into the Integration scale
subresource Status field
Eventually(IntegrationStatusReplicas(ns, name),
TestTimeoutShort).
- Should(gstruct.PointTo(BeNumerically("==", 2)))
+ Should(gstruct.PointTo(BeNumerically("==", 3)))
})
t.Run("Scale integration with Camel K client", func(t
*testing.T) {
@@ -85,11 +85,11 @@ func TestIntegrationScale(t *testing.T) {
// Getter
integrationScale, err :=
camel.CamelV1().Integrations(ns).GetScale(TestContext, name,
metav1.GetOptions{})
Expect(integrationScale).ShouldNot(BeNil())
-
Expect(integrationScale.Spec.Replicas).Should(BeNumerically("==", 2))
-
Expect(integrationScale.Status.Replicas).Should(BeNumerically("==", 2))
+
Expect(integrationScale.Spec.Replicas).Should(BeNumerically("==", 3))
+
Expect(integrationScale.Status.Replicas).Should(BeNumerically("==", 3))
// Setter
- integrationScale.Spec.Replicas = 1
+ integrationScale.Spec.Replicas = 2
integrationScale, err =
camel.CamelV1().Integrations(ns).UpdateScale(TestContext, name,
integrationScale, metav1.UpdateOptions{})
if err != nil {
t.Fatal(err)
@@ -97,15 +97,28 @@ func TestIntegrationScale(t *testing.T) {
// Check the Integration scale subresource Spec field
Eventually(IntegrationSpecReplicas(ns, name),
TestTimeoutShort).
- Should(gstruct.PointTo(BeNumerically("==", 1)))
+ Should(gstruct.PointTo(BeNumerically("==", 2)))
// Then check it cascades into the Deployment scale
+ Eventually(IntegrationPods(ns, name),
TestTimeoutMedium).Should(HaveLen(2))
+ // Finally check it cascades into the Integration scale
subresource Status field
+ Eventually(IntegrationStatusReplicas(ns, name),
TestTimeoutShort).
+ Should(gstruct.PointTo(BeNumerically("==", 2)))
+ })
+
+ t.Run("Update integration scale spec", func(t *testing.T) {
+ Expect(UpdateIntegration(ns, name, func(it
*camelv1.Integration) {
+ replicas := int32(1)
+ it.Spec.Replicas = &replicas
+ })).Should(BeNil())
+
+ // Check it cascades into the Deployment scale
Eventually(IntegrationPods(ns, name),
TestTimeoutMedium).Should(HaveLen(1))
// Finally check it cascades into the Integration scale
subresource Status field
Eventually(IntegrationStatusReplicas(ns, name),
TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 1)))
})
- // Cleanup
- Expect(Kamel("delete", "--all", "-n",
ns).Execute()).Should(BeNil())
+ // Clean up
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(BeNil())
})
}