You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2020/02/21 23:38:27 UTC
[camel-k] 02/03: Fix #1257: add e2e test for CBR in knative
This is an automated email from the ASF dual-hosted git repository.
nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit c548eea0ad603ba8874551550d6d14221ab134ab
Author: Nicola Ferraro <ni...@gmail.com>
AuthorDate: Fri Feb 21 10:12:56 2020 +0100
Fix #1257: add e2e test for CBR in knative
---
e2e/files/knative1.groovy | 10 ++++++++--
e2e/files/{knative1.groovy => knative3.groovy} | 6 ++----
e2e/knative_test.go | 10 +++++++++-
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/e2e/files/knative1.groovy b/e2e/files/knative1.groovy
index d49be14..a089525 100644
--- a/e2e/files/knative1.groovy
+++ b/e2e/files/knative1.groovy
@@ -17,5 +17,11 @@
from('timer:tick')
.setBody().constant("")
- .to('knative:endpoint/knative2')
- .log('Received: ${body}')
+ .choice()
+ .when().simple('${random(0, 2)} == 0')
+ .to('knative:endpoint/knative2')
+ .log('Received from 2: ${body}')
+ .otherwise()
+ .to('knative:endpoint/knative3')
+ .log('Received from 3: ${body}')
+ .end()
diff --git a/e2e/files/knative1.groovy b/e2e/files/knative3.groovy
similarity index 88%
copy from e2e/files/knative1.groovy
copy to e2e/files/knative3.groovy
index d49be14..5603298 100644
--- a/e2e/files/knative1.groovy
+++ b/e2e/files/knative3.groovy
@@ -15,7 +15,5 @@
* limitations under the License.
*/
-from('timer:tick')
- .setBody().constant("")
- .to('knative:endpoint/knative2')
- .log('Received: ${body}')
+from('knative:endpoint/knative3')
+ .setBody().constant("Hello from knative3")
diff --git a/e2e/knative_test.go b/e2e/knative_test.go
index 0b4dbf7..564ca4a 100644
--- a/e2e/knative_test.go
+++ b/e2e/knative_test.go
@@ -35,9 +35,17 @@ func TestRunServiceCombo(t *testing.T) {
Expect(kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).Should(BeNil())
Expect(kamel("run", "-n", ns, "files/knative2.groovy").Execute()).Should(BeNil())
Eventually(integrationPodPhase(ns, "knative2"), 10*time.Minute).Should(Equal(v1.PodRunning))
+ Expect(kamel("run", "-n", ns, "files/knative3.groovy").Execute()).Should(BeNil())
+ Eventually(integrationPodPhase(ns, "knative3"), 10*time.Minute).Should(Equal(v1.PodRunning))
Expect(kamel("run", "-n", ns, "files/knative1.groovy").Execute()).Should(BeNil())
Eventually(integrationPodPhase(ns, "knative1"), 10*time.Minute).Should(Equal(v1.PodRunning))
- Eventually(integrationLogs(ns, "knative1"), 5*time.Minute).Should(ContainSubstring("Received: Hello from knative2"))
+ // Correct logs
+ Eventually(integrationLogs(ns, "knative1"), 5*time.Minute).Should(ContainSubstring("Received from 2: Hello from knative2"))
+ Eventually(integrationLogs(ns, "knative1"), 5*time.Minute).Should(ContainSubstring("Received from 3: Hello from knative3"))
+ // Incorrect logs
+ Consistently(integrationLogs(ns, "knative1"), 10*time.Second).ShouldNot(ContainSubstring("Received from 2: Hello from knative3"))
+ Consistently(integrationLogs(ns, "knative1"), 10*time.Second).ShouldNot(ContainSubstring("Received from 3: Hello from knative2"))
+ // Cleanup
Expect(kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
})
}