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
commit 161b1de9a5fb3f6acbdb44a47617b494459190d2 Author: Antonin Stefanutti <[email protected]> AuthorDate: Fri Mar 19 09:50:13 2021 +0100 test: Only run node toleration e2e test on multi-nodes cluster --- e2e/common/traits/toleration_test.go | 14 ++++++++------ e2e/support/test_support.go | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/e2e/common/traits/toleration_test.go b/e2e/common/traits/toleration_test.go index 50a5386..0dafc01 100644 --- a/e2e/common/traits/toleration_test.go +++ b/e2e/common/traits/toleration_test.go @@ -45,7 +45,7 @@ func TestTolerationTrait(t *testing.T) { "-t", "toleration.enabled=true", "-t", "toleration.taints=camel.apache.org/master:NoExecute:300", ).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(v1.PodRunning)) Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) @@ -67,7 +67,7 @@ func TestTolerationTrait(t *testing.T) { "-t", "toleration.enabled=true", "-t", "toleration.taints=camel.apache.org/master=test:NoExecute:300", ).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(v1.PodRunning)) Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) @@ -83,8 +83,11 @@ func TestTolerationTrait(t *testing.T) { }) t.Run("Run Java with master node toleration", func(t *testing.T) { + if len(Nodes()()) == 1 { + t.Skip("Skip master node toleration test on single-node cluster") + } + name := "java3" - Expect(Kamel("install", "-n", ns).Execute()).To(Succeed()) Expect(Kamel("run", "-n", ns, "files/Java.java", "--name", name, // Use the affinity trait to force the scheduling of the Integration pod onto a master node @@ -110,9 +113,8 @@ func TestTolerationTrait(t *testing.T) { })) // Check the Integration pod is running on a master node - node := Node(pod.Spec.NodeName)() - Expect(node).NotTo(BeNil()) - Expect(node).To(PointTo(MatchFields(IgnoreExtras, Fields{ + Expect(Node(pod.Spec.NodeName)).NotTo(BeNil()) + Expect(Node(pod.Spec.NodeName)).To(PointTo(MatchFields(IgnoreExtras, Fields{ "Spec": MatchFields(IgnoreExtras, Fields{ "Taints": ContainElement(v1.Taint{ Key: "node-role.kubernetes.io/master", diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go index dd7365c..b296bec 100644 --- a/e2e/support/test_support.go +++ b/e2e/support/test_support.go @@ -382,6 +382,22 @@ func Lease(ns string, name string) func() *coordination.Lease { } } +func Nodes() func() []corev1.Node { + return func() []corev1.Node { + nodes := &corev1.NodeList{ + TypeMeta: metav1.TypeMeta{ + Kind: "NodeList", + APIVersion: corev1.SchemeGroupVersion.String(), + }, + } + err := TestClient().List(TestContext, nodes) + if err != nil { + panic(err) + } + return nodes.Items + } +} + func Node(name string) func() *corev1.Node { return func() *corev1.Node { node := &corev1.Node{
