This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 367730beb E2e test for route annotations
367730beb is described below
commit 367730beb675a023926f94444847fdac374786d5
Author: Lucie Krejcirova <[email protected]>
AuthorDate: Tue Nov 7 09:02:36 2023 +0100
E2e test for route annotations
---
e2e/common/traits/route_test.go | 14 ++++++++++++++
e2e/support/test_support.go | 26 ++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/e2e/common/traits/route_test.go b/e2e/common/traits/route_test.go
index 22e6d82f8..ee90e16ac 100644
--- a/e2e/common/traits/route_test.go
+++ b/e2e/common/traits/route_test.go
@@ -199,6 +199,20 @@ func TestRunRoutes(t *testing.T) {
Eventually(httpRequest(url, true),
TestTimeoutShort).Should(Equal("Hello " + code))
Expect(Kamel("delete", "--all", "-n",
ns).Execute()).Should(BeNil())
})
+
+ t.Run("Route annotations added", func(t *testing.T) {
+ Expect(KamelRunWithID(operatorID, ns,
"files/PlatformHttpServer.java",
+ "-t",
"route.annotations.'haproxy.router.openshift.io/balance'=roundrobin").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, integrationName),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ route := RouteFull(ns, integrationName)()
+ Eventually(route, TestTimeoutMedium).ShouldNot(BeNil())
+ // must wait a little time after route is created, before an
http request,
+ // otherwise the route is unavailable and the http request will
fail
+ time.Sleep(waitBeforeHttpRequest)
+ var annotations = route.ObjectMeta.Annotations
+
Expect(annotations["haproxy.router.openshift.io/balance"]).To(Equal("roundrobin"))
+ Expect(Kamel("delete", "--all", "-n",
ns).Execute()).Should(BeNil())
+ })
Expect(TestClient().Delete(TestContext, &secret)).To(Succeed())
}
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 59f0644fa..023908860 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -893,6 +893,32 @@ func Route(ns string, name string) func() *routev1.Route {
}
}
+func RouteFull(ns string, name string) func() *routev1.Route {
+ return func() *routev1.Route {
+ answer := routev1.Route{
+ TypeMeta: metav1.TypeMeta{
+ Kind: "Route",
+ APIVersion:
servingv1.SchemeGroupVersion.String(),
+ },
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: ns,
+ Name: name,
+ },
+ }
+ key := ctrl.ObjectKey{
+ Namespace: ns,
+ Name: name,
+ }
+ err := TestClient().Get(TestContext, key, &answer)
+ if err != nil && k8serrors.IsNotFound(err) {
+ return nil
+ } else if err != nil {
+ failTest(err)
+ }
+ return &answer
+ }
+}
+
func RouteStatus(ns string, name string) func() string {
return func() string {
route := Route(ns, name)()