This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 58bcaa3aff41010d5cba05540758b8553314b539 Author: Antonin Stefanutti <anto...@stefanutti.fr> AuthorDate: Wed Sep 22 15:26:31 2021 +0200 chore(build): Add bug-resistant Go build constraints --- docs/modules/ROOT/pages/contributing/e2e.adoc | 1 + e2e/builder/build_test.go | 1 + e2e/builder/doc.go | 3 +- e2e/builder/docker_hub_test.go | 1 + e2e/builder/github_packages_test.go | 1 + e2e/builder/global_test.go | 1 + e2e/common/build/maven_ca_secret_test.go | 1 + e2e/common/build/maven_repository_test.go | 1 + e2e/common/cli/bind_test.go | 6 +- e2e/common/cli/delete_test.go | 16 +++--- e2e/common/cli/dev_mode_test.go | 1 + e2e/common/cli/duplicate_parameters_test.go | 4 +- e2e/common/cli/get_test.go | 14 +++-- e2e/common/cli/global_kamelet_test.go | 5 +- e2e/common/cli/install_test.go | 1 + e2e/common/cli/log_test.go | 8 ++- e2e/common/cli/offline_commands_test.go | 1 + e2e/common/cli/run_test.go | 15 ++--- e2e/common/cli/uninstall_test.go | 1 + e2e/common/client_test.go | 1 + e2e/common/config/config_test.go | 81 ++++++++++++++------------- e2e/common/cron_test.go | 19 ++++--- e2e/common/doc.go | 1 + e2e/common/integration_fail_test.go | 13 +++-- e2e/common/kamelet_binding_test.go | 17 +++--- e2e/common/kamelet_test.go | 9 +-- e2e/common/languages/groovy_test.go | 1 + e2e/common/languages/init_test_support.go | 1 + e2e/common/languages/java_test.go | 1 + e2e/common/languages/js_test.go | 1 + e2e/common/languages/kotlin_test.go | 1 + e2e/common/languages/polyglot_test.go | 1 + e2e/common/languages/xml_test.go | 1 + e2e/common/languages/yaml_test.go | 1 + e2e/common/operator_metrics_test.go | 1 + e2e/common/platformless_run_test.go | 1 + e2e/common/rest_test.go | 9 +-- e2e/common/scale_binding_test.go | 27 ++++----- e2e/common/scale_integration_test.go | 21 +++---- e2e/common/structured_logs_test.go | 5 +- e2e/common/tekton_test.go | 1 + e2e/common/traits/affinity_test.go | 1 + e2e/common/traits/error_handler_test.go | 1 + e2e/common/traits/istio_test.go | 1 + e2e/common/traits/jolokia_test.go | 1 + e2e/common/traits/jvm_test.go | 1 + e2e/common/traits/master_test.go | 1 + e2e/common/traits/pdb_test.go | 3 +- e2e/common/traits/pod_test.go | 23 ++++---- e2e/common/traits/prometheus_test.go | 1 + e2e/common/traits/pull_secret_test.go | 1 + e2e/common/traits/route_test.go | 80 +++++++++++++------------- e2e/common/traits/toleration_test.go | 1 + e2e/knative/doc.go | 1 + e2e/knative/kamelet_test.go | 19 ++++--- e2e/knative/knative_platform_test.go | 1 + e2e/knative/knative_test.go | 3 +- e2e/knative/openapi_test.go | 3 +- e2e/knative/pod_test.go | 17 +++--- e2e/local/local_run_test.go | 1 + e2e/native/native_test.go | 1 + e2e/service-binding/service_binding_test.go | 5 +- e2e/support/test_nexus_hooks.go | 2 + e2e/support/test_staging_hooks.go | 9 +-- e2e/support/test_support.go | 6 +- e2e/support/test_util.go | 1 + e2e/support/util/dump.go | 9 +-- e2e/support/util/log_counter.go | 3 +- e2e/support/util/log_scanner.go | 1 + e2e/support/util/log_walker.go | 1 + e2e/support/util/structured_log.go | 1 + e2e/support/util/temp_file.go | 3 +- e2e/upgrade/cli_upgrade_test.go | 1 + e2e/upgrade/olm_upgrade_test.go | 1 + e2e/upgrade/util.go | 1 + pkg/cmd/util_test.go | 1 + 76 files changed, 291 insertions(+), 211 deletions(-) diff --git a/docs/modules/ROOT/pages/contributing/e2e.adoc b/docs/modules/ROOT/pages/contributing/e2e.adoc index 14ce676..49ac4e7 100644 --- a/docs/modules/ROOT/pages/contributing/e2e.adoc +++ b/docs/modules/ROOT/pages/contributing/e2e.adoc @@ -7,6 +7,7 @@ integration tests. An integration test should start with the following line: [source] ---- +//go:build integration // +build integration ---- diff --git a/e2e/builder/build_test.go b/e2e/builder/build_test.go index 3d350f6..79b179f 100644 --- a/e2e/builder/build_test.go +++ b/e2e/builder/build_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/builder/doc.go b/e2e/builder/doc.go index 04e8574..7573216 100644 --- a/e2e/builder/doc.go +++ b/e2e/builder/doc.go @@ -1,6 +1,7 @@ +//go:build integration // +build integration -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "builder" +// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" /* Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/e2e/builder/docker_hub_test.go b/e2e/builder/docker_hub_test.go index 5d167d0..de9faf7 100644 --- a/e2e/builder/docker_hub_test.go +++ b/e2e/builder/docker_hub_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/builder/github_packages_test.go b/e2e/builder/github_packages_test.go index ae4d1e7..cd96e42 100644 --- a/e2e/builder/github_packages_test.go +++ b/e2e/builder/github_packages_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/builder/global_test.go b/e2e/builder/global_test.go index d2b408a..caac125 100644 --- a/e2e/builder/global_test.go +++ b/e2e/builder/global_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/build/maven_ca_secret_test.go b/e2e/common/build/maven_ca_secret_test.go index 25bd761..54c1e00 100644 --- a/e2e/common/build/maven_ca_secret_test.go +++ b/e2e/common/build/maven_ca_secret_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/build/maven_repository_test.go b/e2e/common/build/maven_repository_test.go index 44d5af1..596a5cc 100644 --- a/e2e/common/build/maven_repository_test.go +++ b/e2e/common/build/maven_repository_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/cli/bind_test.go b/e2e/common/cli/bind_test.go index cdab115..dc118cd 100644 --- a/e2e/common/cli/bind_test.go +++ b/e2e/common/cli/bind_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -22,9 +23,10 @@ limitations under the License. package common import ( - v1 "k8s.io/api/core/v1" "testing" + corev1 "k8s.io/api/core/v1" + . "github.com/onsi/gomega" . "github.com/apache/camel-k/e2e/support" @@ -37,7 +39,7 @@ func TestKamelCLIBind(t *testing.T) { t.Run("bind timer to log", func(t *testing.T) { Expect(Kamel("bind", "test-timer-source", "log:info", "-p", "source.message=helloTest", "-n", ns).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "test-timer-source-to-log"), TestTimeoutLong).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "test-timer-source-to-log"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) Eventually(IntegrationLogs(ns, "test-timer-source-to-log")).Should(ContainSubstring("Body: helloTest")) Expect(Kamel("bind", "test-timer-source", "log:info", "-p", "source.message=newText", "-n", ns).Execute()).To(Succeed()) diff --git a/e2e/common/cli/delete_test.go b/e2e/common/cli/delete_test.go index a68fde5..04f1c09 100644 --- a/e2e/common/cli/delete_test.go +++ b/e2e/common/cli/delete_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -22,9 +23,10 @@ limitations under the License. package common import ( - v1 "k8s.io/api/core/v1" "testing" + corev1 "k8s.io/api/core/v1" + . "github.com/onsi/gomega" . "github.com/apache/camel-k/e2e/support" @@ -36,7 +38,7 @@ func TestKamelCLIDelete(t *testing.T) { t.Run("delete running integration", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "../files/yaml.yaml").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) Expect(Kamel("delete", "yaml", "-n", ns).Execute()).To(Succeed()) Eventually(Integration(ns, "yaml")).Should(BeNil()) Eventually(IntegrationPod(ns, "yaml")).Should(BeNil()) @@ -51,7 +53,7 @@ func TestKamelCLIDelete(t *testing.T) { t.Run("delete integration from csv", func(t *testing.T) { Expect(Kamel("run", "github:apache/camel-k/e2e/common/files/yaml.yaml", "-n", ns).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) Expect(Kamel("delete", "yaml", "-n", ns).Execute()).To(Succeed()) Eventually(Integration(ns, "yaml")).Should(BeNil()) Eventually(IntegrationPod(ns, "yaml")).Should(BeNil()) @@ -60,8 +62,8 @@ func TestKamelCLIDelete(t *testing.T) { t.Run("delete several integrations", func(t *testing.T) { Expect(Kamel("run", "../files/yaml.yaml", "-n", ns).Execute()).To(Succeed()) Expect(Kamel("run", "../files/Java.java", "-n", ns).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) Expect(Kamel("delete", "yaml", "-n", ns).Execute()).To(Succeed()) Eventually(Integration(ns, "yaml")).Should(BeNil()) Eventually(IntegrationPod(ns, "yaml")).Should(BeNil()) @@ -73,8 +75,8 @@ func TestKamelCLIDelete(t *testing.T) { t.Run("delete all integrations", func(t *testing.T) { Expect(Kamel("run", "../files/yaml.yaml", "-n", ns).Execute()).To(Succeed()) Expect(Kamel("run", "../files/Java.java", "-n", ns).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) Eventually(Integration(ns, "yaml")).Should(BeNil()) Eventually(IntegrationPod(ns, "yaml")).Should(BeNil()) diff --git a/e2e/common/cli/dev_mode_test.go b/e2e/common/cli/dev_mode_test.go index 93cb052..480204e 100644 --- a/e2e/common/cli/dev_mode_test.go +++ b/e2e/common/cli/dev_mode_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/cli/duplicate_parameters_test.go b/e2e/common/cli/duplicate_parameters_test.go index dd744a2..d893f0d 100644 --- a/e2e/common/cli/duplicate_parameters_test.go +++ b/e2e/common/cli/duplicate_parameters_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -25,9 +26,10 @@ import ( "context" "testing" + . "github.com/onsi/gomega" + . "github.com/apache/camel-k/e2e/support" "github.com/apache/camel-k/pkg/cmd" - . "github.com/onsi/gomega" ) func TestDuplicateParameters(t *testing.T) { diff --git a/e2e/common/cli/get_test.go b/e2e/common/cli/get_test.go index b41a843..f9203d3 100644 --- a/e2e/common/cli/get_test.go +++ b/e2e/common/cli/get_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -23,9 +24,10 @@ package common import ( "fmt" - v1 "k8s.io/api/core/v1" "testing" + corev1 "k8s.io/api/core/v1" + . "github.com/onsi/gomega" . "github.com/apache/camel-k/e2e/support" @@ -37,7 +39,7 @@ func TestKamelCLIGet(t *testing.T) { t.Run("get integration", func(t *testing.T) { Expect(Kamel("run", "../files/yaml.yaml", "-n", ns).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) // regex is used for the compatibility of tests between OC and vanilla K8 // kamel get may have different output depending og the platform kitName := Integration(ns, "yaml")().Status.Kit @@ -50,19 +52,19 @@ func TestKamelCLIGet(t *testing.T) { t.Run("get several integrations", func(t *testing.T) { Expect(Kamel("run", "../files/yaml.yaml", "-n", ns).Execute()).To(Succeed()) Expect(Kamel("run", "../files/Java.java", "-n", ns).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) kitName1 := Integration(ns, "java")().Status.IntegrationKit.Name kitName2 := Integration(ns, "yaml")().Status.IntegrationKit.Name - regex := fmt.Sprintf("^NAME\tPHASE\tKIT\n\\s*java\tRunning\t" + + regex := fmt.Sprintf("^NAME\tPHASE\tKIT\n\\s*java\tRunning\t"+ "(%s/%s|%s)\n\\s*yaml\tRunning\t(%s/%s|%s)\n", ns, kitName1, kitName1, ns, kitName2, kitName2) Expect(GetOutputString(Kamel("get", "-n", ns))).To(MatchRegexp(regex)) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) - t.Run("get no integrations" , func(t *testing.T) { + t.Run("get no integrations", func(t *testing.T) { Expect(GetOutputString(Kamel("get", "-n", ns))).NotTo(ContainSubstring("Running")) Expect(GetOutputString(Kamel("get", "-n", ns))).NotTo(ContainSubstring("Building Kit")) }) diff --git a/e2e/common/cli/global_kamelet_test.go b/e2e/common/cli/global_kamelet_test.go index 1cbdb92..a667b3b 100644 --- a/e2e/common/cli/global_kamelet_test.go +++ b/e2e/common/cli/global_kamelet_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -28,7 +29,7 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/assert" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" . "github.com/apache/camel-k/e2e/support" "github.com/apache/camel-k/pkg/util/openshift" @@ -55,7 +56,7 @@ func TestRunGlobalKamelet(t *testing.T) { Expect(Kamel("install", "-n", ns2, "--skip-operator-setup", "--olm=false").Execute()).To(Succeed()) Expect(Kamel("run", "-n", ns2, "files/timer-kamelet-usage.groovy").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns2, "timer-kamelet-usage"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns2, "timer-kamelet-usage"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) Eventually(IntegrationLogs(ns2, "timer-kamelet-usage"), TestTimeoutShort).Should(ContainSubstring("Hello world")) Expect(Kamel("delete", "--all", "-n", ns2).Execute()).To(Succeed()) }) diff --git a/e2e/common/cli/install_test.go b/e2e/common/cli/install_test.go index 8666ec0..f0c3c40 100644 --- a/e2e/common/cli/install_test.go +++ b/e2e/common/cli/install_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/cli/log_test.go b/e2e/common/cli/log_test.go index 922b832..859c313 100644 --- a/e2e/common/cli/log_test.go +++ b/e2e/common/cli/log_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -22,10 +23,11 @@ limitations under the License. package common import ( - v1 "k8s.io/api/core/v1" "strings" "testing" + corev1 "k8s.io/api/core/v1" + . "github.com/onsi/gomega" . "github.com/apache/camel-k/e2e/support" @@ -37,8 +39,8 @@ func TestKamelCLILog(t *testing.T) { t.Run("check integration log", func(t *testing.T) { Expect(Kamel("run", "../files/yaml.yaml", "-n", ns).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - //first line of the integration logs + Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + // first line of the integration logs logs := strings.Split(IntegrationLogs(ns, "yaml")(), "\n")[0] podName := IntegrationPod(ns, "yaml")().Name diff --git a/e2e/common/cli/offline_commands_test.go b/e2e/common/cli/offline_commands_test.go index 834fc41..c3a1271 100644 --- a/e2e/common/cli/offline_commands_test.go +++ b/e2e/common/cli/offline_commands_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/cli/run_test.go b/e2e/common/cli/run_test.go index ef47b31..bd91c23 100644 --- a/e2e/common/cli/run_test.go +++ b/e2e/common/cli/run_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -31,7 +32,7 @@ import ( corev1 "k8s.io/api/core/v1" . "github.com/apache/camel-k/e2e/support" - camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" ) func TestRunExamplesFromGitHub(t *testing.T) { @@ -41,7 +42,7 @@ func TestRunExamplesFromGitHub(t *testing.T) { t.Run("run java from GitHub", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "github:apache/camel-k/e2e/common/files/Java.java").Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) - Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + Eventually(IntegrationCondition(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -49,7 +50,7 @@ func TestRunExamplesFromGitHub(t *testing.T) { t.Run("run java from GitHub (RAW)", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "https://raw.githubusercontent.com/apache/camel-k/main/e2e/common/files/Java.java").Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) - Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + Eventually(IntegrationCondition(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -58,7 +59,7 @@ func TestRunExamplesFromGitHub(t *testing.T) { name := "github-gist-id" Expect(Kamel("run", "-n", ns, "--name", name, "gist:e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) @@ -68,7 +69,7 @@ func TestRunExamplesFromGitHub(t *testing.T) { name := "github-gist-url" Expect(Kamel("run", "-n", ns, "--name", name, "https://gist.github.com/lburgazzoli/e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) @@ -86,7 +87,7 @@ func TestRunAndUpdate(t *testing.T) { name := "run" Expect(Kamel("run", "-n", ns, "files/run.yaml", "--name", name).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magic default")) // Re-run the Integration with an updated configuration @@ -100,7 +101,7 @@ func TestRunAndUpdate(t *testing.T) { // Check the new configuration is taken into account Eventually(IntegrationPodPhase(ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning)) - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magic value")) // Clean up diff --git a/e2e/common/cli/uninstall_test.go b/e2e/common/cli/uninstall_test.go index fb3933c..7eba807 100644 --- a/e2e/common/cli/uninstall_test.go +++ b/e2e/common/cli/uninstall_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/client_test.go b/e2e/common/client_test.go index ee054a1..d0b19d9 100644 --- a/e2e/common/client_test.go +++ b/e2e/common/client_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/config/config_test.go b/e2e/common/config/config_test.go index 2aa9536..3e0438a 100644 --- a/e2e/common/config/config_test.go +++ b/e2e/common/config/config_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -28,10 +29,10 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/assert" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" . "github.com/apache/camel-k/e2e/support" - camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" "github.com/apache/camel-k/pkg/util/gzip" ) @@ -43,24 +44,24 @@ func TestRunConfigExamples(t *testing.T) { t.Run("Simple property", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/property-route.groovy", "-p", "my.message=test-property").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "property-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("test-property")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) t.Run("Property file", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/property-file-route.groovy", "--property", "file:./files/my.properties").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "property-file-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello world")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) t.Run("Property precedence", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/property-file-route.groovy", "-p", "my.key.2=universe", "-p", "file:./files/my.properties").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "property-file-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello universe")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -80,8 +81,8 @@ func TestRunConfigExamples(t *testing.T) { t.Run("Config configmap", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/config-configmap-route.groovy", "--config", "configmap:my-cm").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "config-configmap-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "config-configmap-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "config-configmap-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "config-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "config-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"])) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -90,8 +91,8 @@ func TestRunConfigExamples(t *testing.T) { // We can reuse the configmap created previously Expect(Kamel("run", "-n", ns, "./files/resource-configmap-route.groovy", "--resource", "configmap:my-cm").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "resource-configmap-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "resource-configmap-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "resource-configmap-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "resource-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "resource-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"])) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -100,8 +101,8 @@ func TestRunConfigExamples(t *testing.T) { // We can reuse the configmap created previously Expect(Kamel("run", "-n", ns, "./files/resource-configmap-location-route.groovy", "--resource", "configmap:my-cm@/tmp/app").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "resource-configmap-location-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "resource-configmap-location-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "resource-configmap-location-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "resource-configmap-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "resource-configmap-location-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"])) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -110,8 +111,8 @@ func TestRunConfigExamples(t *testing.T) { // We'll use the configmap contaning 2 values filtering only 1 key Expect(Kamel("run", "-n", ns, "./files/resource-configmap-key-location-route.groovy", "--resource", "configmap:my-cm-multi/my-configmap-key-2@/tmp/app").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "resource-configmap-key-location-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "resource-configmap-key-location-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "resource-configmap-key-location-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "resource-configmap-key-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "resource-configmap-key-location-route"), TestTimeoutShort).ShouldNot(ContainSubstring(cmDataMulti["my-configmap-key"])) Eventually(IntegrationLogs(ns, "resource-configmap-key-location-route"), TestTimeoutShort).Should(ContainSubstring(cmDataMulti["my-configmap-key-2"])) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) @@ -124,8 +125,8 @@ func TestRunConfigExamples(t *testing.T) { t.Run("Config configmap as property file", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/config-configmap-properties-route.groovy", "--config", "configmap:my-cm-properties").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "config-configmap-properties-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "config-configmap-properties-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "config-configmap-properties-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "config-configmap-properties-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "config-configmap-properties-route"), TestTimeoutShort).Should(ContainSubstring("hello world")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -139,16 +140,16 @@ func TestRunConfigExamples(t *testing.T) { t.Run("Config secret", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/config-secret-route.groovy", "--config", "secret:my-sec").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "config-secret-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "config-secret-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "config-secret-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "config-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "config-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"])) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) t.Run("Resource secret", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/resource-secret-route.groovy", "--resource", "secret:my-sec").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "resource-secret-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "resource-secret-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "resource-secret-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "resource-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "resource-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"])) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -157,8 +158,8 @@ func TestRunConfigExamples(t *testing.T) { t.Run("Plain text configuration file", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/config-file-route.groovy", "--config", "file:./files/resources-data.txt").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "config-file-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "config-file-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "config-file-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "config-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "config-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -167,24 +168,24 @@ func TestRunConfigExamples(t *testing.T) { t.Run("Plain text resource file", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/resource-file-route.groovy", "--resource", "file:./files/resources-data.txt").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "resource-file-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "resource-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "resource-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) t.Run("Plain text resource file with destination path", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/resource-file-location-route.groovy", "--resource", "file:./files/resources-data.txt@/tmp/file.txt").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "resource-file-location-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "resource-file-location-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "resource-file-location-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "resource-file-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "resource-file-location-route"), TestTimeoutShort).Should(ContainSubstring("the file body")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) t.Run("Binary (zip) resource file", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/resource-file-binary-route.groovy", "--resource", "file:./files/resources-data.zip", "-d", "camel-zipfile").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "resource-file-binary-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "resource-file-binary-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "resource-file-binary-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "resource-file-binary-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "resource-file-binary-route"), TestTimeoutShort).Should(ContainSubstring("the file body")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -197,8 +198,8 @@ func TestRunConfigExamples(t *testing.T) { assert.Nil(t, err) Expect(Kamel("run", "-n", ns, "./files/resource-file-base64-encoded-route.groovy", "--resource", "file:./files/resources-data.txt", "--compression=true").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "resource-file-base64-encoded-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "resource-file-base64-encoded-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "resource-file-base64-encoded-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "resource-file-base64-encoded-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "resource-file-base64-encoded-route"), TestTimeoutShort).Should(ContainSubstring(string(expectedBytes))) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -206,8 +207,8 @@ func TestRunConfigExamples(t *testing.T) { // Build-Properties t.Run("Build time property", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/build-property-route.groovy", "--build-property", "quarkus.application.name=my-super-application").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "build-property-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "build-property-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "build-property-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "build-property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "build-property-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application")) // Don't delete - we need it for next test execution }) @@ -216,8 +217,8 @@ func TestRunConfigExamples(t *testing.T) { t.Run("Build time property updated", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/build-property-route.groovy", "--name", "build-property-route-updated", "--build-property", "quarkus.application.name=my-super-application-updated").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "build-property-route-updated"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "build-property-route-updated", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "build-property-route-updated"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "build-property-route-updated", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "build-property-route-updated"), TestTimeoutShort).Should(ContainSubstring("my-super-application-updated")) // Verify the integration kits are different Expect(IntegrationKit(ns, "build-property-route")).ShouldNot(Equal(IntegrationKit(ns, "build-property-route-updated"))) @@ -227,16 +228,16 @@ func TestRunConfigExamples(t *testing.T) { // Build-Properties file t.Run("Build time property file", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/build-property-file-route.groovy", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "build-property-file-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) t.Run("Build time property file with precedence", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "./files/build-property-file-route.groovy", "--build-property", "quarkus.application.name=my-overridden-application", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "build-property-file-route", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-overridden-application")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) diff --git a/e2e/common/cron_test.go b/e2e/common/cron_test.go index 950c52b..4953a2d 100644 --- a/e2e/common/cron_test.go +++ b/e2e/common/cron_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -26,10 +27,10 @@ import ( . "github.com/onsi/gomega" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" . "github.com/apache/camel-k/e2e/support" - camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" ) func TestRunCronExample(t *testing.T) { @@ -39,7 +40,7 @@ func TestRunCronExample(t *testing.T) { t.Run("cron", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "files/cron.yaml").Execute()).To(Succeed()) Eventually(IntegrationCronJob(ns, "cron"), TestTimeoutMedium).ShouldNot(BeNil()) - Eventually(IntegrationCondition(ns, "cron", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationCondition(ns, "cron", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "cron"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -47,7 +48,7 @@ func TestRunCronExample(t *testing.T) { t.Run("cron-yaml", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "files/cron-yaml.yaml").Execute()).To(Succeed()) Eventually(IntegrationCronJob(ns, "cron-yaml"), TestTimeoutMedium).ShouldNot(BeNil()) - Eventually(IntegrationCondition(ns, "cron-yaml", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationCondition(ns, "cron-yaml", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "cron-yaml"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -55,23 +56,23 @@ func TestRunCronExample(t *testing.T) { t.Run("cron-timer", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "files/cron-timer.yaml").Execute()).To(Succeed()) Eventually(IntegrationCronJob(ns, "cron-timer"), TestTimeoutMedium).ShouldNot(BeNil()) - Eventually(IntegrationCondition(ns, "cron-timer", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationCondition(ns, "cron-timer", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "cron-timer"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) t.Run("cron-fallback", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "files/cron-fallback.yaml").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "cron-fallback"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "cron-fallback", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "cron-fallback"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "cron-fallback", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "cron-fallback"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) t.Run("cron-quartz", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "files/cron-quartz.yaml").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "cron-quartz"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "cron-quartz", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "cron-quartz"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "cron-quartz", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "cron-quartz"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) diff --git a/e2e/common/doc.go b/e2e/common/doc.go index 252475e..9677808 100644 --- a/e2e/common/doc.go +++ b/e2e/common/doc.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/integration_fail_test.go b/e2e/common/integration_fail_test.go index 720e132..ee454bc 100644 --- a/e2e/common/integration_fail_test.go +++ b/e2e/common/integration_fail_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -27,10 +28,10 @@ import ( . "github.com/onsi/gomega" "github.com/onsi/gomega/gstruct" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" . "github.com/apache/camel-k/e2e/support" - camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" ) func TestBadRouteIntegration(t *testing.T) { @@ -40,9 +41,9 @@ func TestBadRouteIntegration(t *testing.T) { t.Run("run bad java route", func(t *testing.T) { name := "bad-route" Expect(Kamel("run", "-n", ns, "files/BadRoute.java", "--name", name).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationPhase(ns, name), TestTimeoutShort).Should(Equal(camelv1.IntegrationPhaseError)) - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionFalse)) + Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationPhase(ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse)) // Make sure the Integration can be scaled Expect(ScaleIntegration(ns, name, 2)).To(Succeed()) @@ -52,7 +53,7 @@ func TestBadRouteIntegration(t *testing.T) { Eventually(IntegrationStatusReplicas(ns, name), TestTimeoutShort). Should(gstruct.PointTo(BeNumerically("==", 2))) // Check the Integration stays in error phase - Eventually(IntegrationPhase(ns, name), TestTimeoutShort).Should(Equal(camelv1.IntegrationPhaseError)) + Eventually(IntegrationPhase(ns, name), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseError)) }) // Clean up diff --git a/e2e/common/kamelet_binding_test.go b/e2e/common/kamelet_binding_test.go index a25de07..77b6690 100644 --- a/e2e/common/kamelet_binding_test.go +++ b/e2e/common/kamelet_binding_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -22,12 +23,14 @@ limitations under the License. package common import ( - "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" - v1 "k8s.io/api/core/v1" "testing" - . "github.com/apache/camel-k/e2e/support" . "github.com/onsi/gomega" + + corev1 "k8s.io/api/core/v1" + + . "github.com/apache/camel-k/e2e/support" + "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" ) func TestErrorHandler(t *testing.T) { @@ -36,13 +39,13 @@ func TestErrorHandler(t *testing.T) { Expect(CreateErrorProducerKamelet(ns, "my-own-error-producer-source")()).To(Succeed()) Expect(CreateLogKamelet(ns, "my-own-log-sink")()).To(Succeed()) - from := v1.ObjectReference{ + from := corev1.ObjectReference{ Kind: "Kamelet", Name: "my-own-error-producer-source", APIVersion: v1alpha1.SchemeGroupVersion.String(), } - to := v1.ObjectReference{ + to := corev1.ObjectReference{ Kind: "Kamelet", Name: "my-own-log-sink", APIVersion: v1alpha1.SchemeGroupVersion.String(), @@ -65,7 +68,7 @@ func TestErrorHandler(t *testing.T) { Expect(BindKameletToWithErrorHandler(ns, "throw-error-binding", from, to, map[string]string{"message": "throw Error"}, map[string]string{"loggerName": "integrationLogger"}, errorHandler)()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "throw-error-binding"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "throw-error-binding"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) Eventually(IntegrationLogs(ns, "throw-error-binding"), TestTimeoutShort).Should(ContainSubstring("kameletErrorHandler")) Eventually(IntegrationLogs(ns, "throw-error-binding"), TestTimeoutShort).ShouldNot(ContainSubstring("integrationLogger")) @@ -75,7 +78,7 @@ func TestErrorHandler(t *testing.T) { Expect(BindKameletToWithErrorHandler(ns, "no-error-binding", from, to, map[string]string{"message": "true"}, map[string]string{"loggerName": "integrationLogger"}, errorHandler)()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "no-error-binding"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "no-error-binding"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) Eventually(IntegrationLogs(ns, "no-error-binding"), TestTimeoutShort).ShouldNot(ContainSubstring("kameletErrorHandler")) Eventually(IntegrationLogs(ns, "no-error-binding"), TestTimeoutShort).Should(ContainSubstring("integrationLogger")) diff --git a/e2e/common/kamelet_test.go b/e2e/common/kamelet_test.go index 4db8a31..cdb5e81 100644 --- a/e2e/common/kamelet_test.go +++ b/e2e/common/kamelet_test.go @@ -1,6 +1,7 @@ +//go:build integration // +build integration -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "knative" +// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" /* Licensed to the Apache Software Foundation (ASF) under one or more @@ -25,7 +26,7 @@ import ( "testing" . "github.com/onsi/gomega" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" . "github.com/apache/camel-k/e2e/support" ) @@ -35,7 +36,7 @@ func TestKameletClasspathLoading(t *testing.T) { Expect(Kamel("install", "-n", ns).Execute()).To(Succeed()) kameletName := "timer-source" - removeKamelet(kameletName , ns) + removeKamelet(kameletName, ns) Eventually(Kamelet(kameletName, ns)).Should(BeNil()) @@ -45,7 +46,7 @@ func TestKameletClasspathLoading(t *testing.T) { "-d", "camel:yaml-dsl", // kamelet dependencies "-d", "camel:timer").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "timer-kamelet-integration"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "timer-kamelet-integration"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) Eventually(IntegrationLogs(ns, "timer-kamelet-integration")).Should(ContainSubstring("important message")) diff --git a/e2e/common/languages/groovy_test.go b/e2e/common/languages/groovy_test.go index 12f2776..2bfb87a 100644 --- a/e2e/common/languages/groovy_test.go +++ b/e2e/common/languages/groovy_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/languages/init_test_support.go b/e2e/common/languages/init_test_support.go index 43cc2c0..061d569 100644 --- a/e2e/common/languages/init_test_support.go +++ b/e2e/common/languages/init_test_support.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/languages/java_test.go b/e2e/common/languages/java_test.go index 5134e15..5e1f35e 100644 --- a/e2e/common/languages/java_test.go +++ b/e2e/common/languages/java_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/languages/js_test.go b/e2e/common/languages/js_test.go index 6429f85..f90ee07 100644 --- a/e2e/common/languages/js_test.go +++ b/e2e/common/languages/js_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/languages/kotlin_test.go b/e2e/common/languages/kotlin_test.go index ae71328..0c8df4b 100644 --- a/e2e/common/languages/kotlin_test.go +++ b/e2e/common/languages/kotlin_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/languages/polyglot_test.go b/e2e/common/languages/polyglot_test.go index a2b50e3..b34dd69 100644 --- a/e2e/common/languages/polyglot_test.go +++ b/e2e/common/languages/polyglot_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/languages/xml_test.go b/e2e/common/languages/xml_test.go index 2a214fb..dbcfb94 100644 --- a/e2e/common/languages/xml_test.go +++ b/e2e/common/languages/xml_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/languages/yaml_test.go b/e2e/common/languages/yaml_test.go index 3cfd598..1884f66 100644 --- a/e2e/common/languages/yaml_test.go +++ b/e2e/common/languages/yaml_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/operator_metrics_test.go b/e2e/common/operator_metrics_test.go index b511aa4..e9a0c10 100644 --- a/e2e/common/operator_metrics_test.go +++ b/e2e/common/operator_metrics_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/platformless_run_test.go b/e2e/common/platformless_run_test.go index b4dc1c3..d3a93f5 100644 --- a/e2e/common/platformless_run_test.go +++ b/e2e/common/platformless_run_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/rest_test.go b/e2e/common/rest_test.go index fd7908a..3888933 100644 --- a/e2e/common/rest_test.go +++ b/e2e/common/rest_test.go @@ -1,6 +1,7 @@ +//go:build integration // +build integration -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "knative" +// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" /* Licensed to the Apache Software Foundation (ASF) under one or more @@ -30,7 +31,7 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/assert" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" . "github.com/apache/camel-k/e2e/support" "github.com/apache/camel-k/pkg/util/openshift" @@ -49,14 +50,14 @@ func TestRunRest(t *testing.T) { Expect(Kamel("install", "-n", ns, "--trait-profile", profile).Execute()).To(Succeed()) Expect(Kamel("run", "-n", ns, "files/rest-consumer.yaml").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "rest-consumer"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "rest-consumer"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) t.Run("Service works", func(t *testing.T) { name := "John" service := Service(ns, "rest-consumer") Eventually(service, TestTimeoutShort).ShouldNot(BeNil()) Expect(Kamel("run", "-n", ns, "files/rest-producer.yaml", "-p", "serviceName=rest-consumer", "-p", "name="+name).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "rest-producer"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) + Eventually(IntegrationPodPhase(ns, "rest-producer"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) Eventually(IntegrationLogs(ns, "rest-consumer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("get %s", name))) Eventually(IntegrationLogs(ns, "rest-producer"), TestTimeoutLong).Should(ContainSubstring(fmt.Sprintf("%s Doe", name))) }) diff --git a/e2e/common/scale_binding_test.go b/e2e/common/scale_binding_test.go index 27fc900..8b68144 100644 --- a/e2e/common/scale_binding_test.go +++ b/e2e/common/scale_binding_test.go @@ -1,6 +1,7 @@ +//go:build integration // +build integration -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "knative" +// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" /* Licensed to the Apache Software Foundation (ASF) under one or more @@ -27,7 +28,7 @@ import ( . "github.com/onsi/gomega" "github.com/onsi/gomega/gstruct" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -36,8 +37,8 @@ import ( "k8s.io/client-go/scale" . "github.com/apache/camel-k/e2e/support" - camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" - camelv1alpha1 "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" + "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" "github.com/apache/camel-k/pkg/client/camel/clientset/versioned" ) @@ -46,9 +47,9 @@ func TestKameletBindingScale(t *testing.T) { name := "binding" Expect(Kamel("install", "-n", ns, "-w").Execute()).To(Succeed()) Expect(Kamel("bind", "timer-source?message=HelloBinding", "log-sink", "-n", ns, "--name", name).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) - Eventually(KameletBindingCondition(ns, name, camelv1alpha1.KameletBindingConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + Eventually(KameletBindingCondition(ns, name, v1alpha1.KameletBindingConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("HelloBinding")) t.Run("Update binding scale spec", func(t *testing.T) { @@ -63,9 +64,9 @@ func TestKameletBindingScale(t *testing.T) { Eventually(KameletBindingStatusReplicas(ns, name), TestTimeoutShort). Should(gstruct.PointTo(BeNumerically("==", 3))) // Check the readiness condition becomes truthy back - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) // Finally check the readiness condition becomes truthy back on kamelet binding - Eventually(KameletBindingCondition(ns, name, camelv1alpha1.KameletBindingConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) + Eventually(KameletBindingCondition(ns, name, v1alpha1.KameletBindingConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) }) t.Run("Scale kamelet binding with polymorphic client", func(t *testing.T) { @@ -80,11 +81,11 @@ func TestKameletBindingScale(t *testing.T) { // Patch the integration scale subresource patch := "{\"spec\":{\"replicas\":2}}" - _, err = scaleClient.Scales(ns).Patch(TestContext, camelv1alpha1.SchemeGroupVersion.WithResource("kameletbindings"), name, types.MergePatchType, []byte(patch), metav1.PatchOptions{}) + _, err = scaleClient.Scales(ns).Patch(TestContext, v1alpha1.SchemeGroupVersion.WithResource("kameletbindings"), name, types.MergePatchType, []byte(patch), metav1.PatchOptions{}) Expect(err).To(BeNil()) // Check the readiness condition is still truthy as down-scaling - Expect(KameletBindingCondition(ns, name, camelv1alpha1.KameletBindingConditionReady)()).To(Equal(v1.ConditionTrue)) + Expect(KameletBindingCondition(ns, name, v1alpha1.KameletBindingConditionReady)()).To(Equal(corev1.ConditionTrue)) // Check the Integration scale subresource Spec field Eventually(IntegrationSpecReplicas(ns, name), TestTimeoutShort). Should(gstruct.PointTo(BeNumerically("==", 2))) @@ -115,12 +116,12 @@ func TestKameletBindingScale(t *testing.T) { Expect(err).To(BeNil()) // Check the readiness condition is still truthy as down-scaling in kamelet binding - Expect(KameletBindingCondition(ns, name, camelv1alpha1.KameletBindingConditionReady)()).To(Equal(v1.ConditionTrue)) + Expect(KameletBindingCondition(ns, name, v1alpha1.KameletBindingConditionReady)()).To(Equal(corev1.ConditionTrue)) // Check the KameletBinding scale subresource Spec field Eventually(KameletBindingSpecReplicas(ns, name), TestTimeoutShort). Should(gstruct.PointTo(BeNumerically("==", 1))) // Check the readiness condition is still truthy as down-scaling - Expect(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady)()).To(Equal(v1.ConditionTrue)) + Expect(IntegrationCondition(ns, name, v1.IntegrationConditionReady)()).To(Equal(corev1.ConditionTrue)) // Check the Integration scale subresource Spec field Eventually(IntegrationSpecReplicas(ns, name), TestTimeoutShort). Should(gstruct.PointTo(BeNumerically("==", 1))) diff --git a/e2e/common/scale_integration_test.go b/e2e/common/scale_integration_test.go index d88c8ca..1bd8e72 100644 --- a/e2e/common/scale_integration_test.go +++ b/e2e/common/scale_integration_test.go @@ -1,6 +1,7 @@ +//go:build integration // +build integration -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "knative" +// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" /* Licensed to the Apache Software Foundation (ASF) under one or more @@ -27,7 +28,7 @@ import ( . "github.com/onsi/gomega" "github.com/onsi/gomega/gstruct" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -36,7 +37,7 @@ import ( "k8s.io/client-go/scale" . "github.com/apache/camel-k/e2e/support" - camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" "github.com/apache/camel-k/pkg/client/camel/clientset/versioned" ) @@ -45,22 +46,22 @@ func TestIntegrationScale(t *testing.T) { name := "java" Expect(Kamel("install", "-n", ns).Execute()).To(Succeed()) Expect(Kamel("run", "-n", ns, "files/Java.java", "--name", name).Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) t.Run("Update integration scale spec", func(t *testing.T) { RegisterTestingT(t) Expect(ScaleIntegration(ns, name, 3)).To(Succeed()) // Check the readiness condition becomes falsy - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionFalse)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse)) // Check the scale cascades into the Deployment scale Eventually(IntegrationPods(ns, name), TestTimeoutShort).Should(HaveLen(3)) // Check it also cascades into the Integration scale subresource Status field Eventually(IntegrationStatusReplicas(ns, name), TestTimeoutShort). Should(gstruct.PointTo(BeNumerically("==", 3))) // Finally check the readiness condition becomes truthy back - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) }) t.Run("Scale integration with polymorphic client", func(t *testing.T) { @@ -75,11 +76,11 @@ func TestIntegrationScale(t *testing.T) { // Patch the integration scale subresource patch := "{\"spec\":{\"replicas\":2}}" - _, err = scaleClient.Scales(ns).Patch(TestContext, camelv1.SchemeGroupVersion.WithResource("integrations"), name, types.MergePatchType, []byte(patch), metav1.PatchOptions{}) + _, err = scaleClient.Scales(ns).Patch(TestContext, v1.SchemeGroupVersion.WithResource("integrations"), name, types.MergePatchType, []byte(patch), metav1.PatchOptions{}) Expect(err).To(BeNil()) // Check the readiness condition is still truthy as down-scaling - Expect(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady)()).To(Equal(v1.ConditionTrue)) + Expect(IntegrationCondition(ns, name, v1.IntegrationConditionReady)()).To(Equal(corev1.ConditionTrue)) // Check the Integration scale subresource Spec field Eventually(IntegrationSpecReplicas(ns, name), TestTimeoutShort). Should(gstruct.PointTo(BeNumerically("==", 2))) @@ -107,7 +108,7 @@ func TestIntegrationScale(t *testing.T) { Expect(err).To(BeNil()) // Check the readiness condition is still truthy as down-scaling - Expect(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady)()).To(Equal(v1.ConditionTrue)) + Expect(IntegrationCondition(ns, name, v1.IntegrationConditionReady)()).To(Equal(corev1.ConditionTrue)) // Check the Integration scale subresource Spec field Eventually(IntegrationSpecReplicas(ns, name), TestTimeoutShort). Should(gstruct.PointTo(BeNumerically("==", 1))) diff --git a/e2e/common/structured_logs_test.go b/e2e/common/structured_logs_test.go index e80a820..e7afd72 100644 --- a/e2e/common/structured_logs_test.go +++ b/e2e/common/structured_logs_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -22,9 +23,10 @@ limitations under the License. package common import ( - . "github.com/onsi/gomega" "testing" + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" . "github.com/apache/camel-k/e2e/support" @@ -55,4 +57,3 @@ func TestStructuredLogs(t *testing.T) { Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) } - diff --git a/e2e/common/tekton_test.go b/e2e/common/tekton_test.go index 2549f76..2ceb1c4 100644 --- a/e2e/common/tekton_test.go +++ b/e2e/common/tekton_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/traits/affinity_test.go b/e2e/common/traits/affinity_test.go index 53b0162..2ce04c1 100644 --- a/e2e/common/traits/affinity_test.go +++ b/e2e/common/traits/affinity_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/traits/error_handler_test.go b/e2e/common/traits/error_handler_test.go index 506eba4..a82f95c 100644 --- a/e2e/common/traits/error_handler_test.go +++ b/e2e/common/traits/error_handler_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/traits/istio_test.go b/e2e/common/traits/istio_test.go index 96d4d1a..8261f61 100644 --- a/e2e/common/traits/istio_test.go +++ b/e2e/common/traits/istio_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/traits/jolokia_test.go b/e2e/common/traits/jolokia_test.go index fb6bbae..da97d84 100644 --- a/e2e/common/traits/jolokia_test.go +++ b/e2e/common/traits/jolokia_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/traits/jvm_test.go b/e2e/common/traits/jvm_test.go index c15c977..b5701f8 100644 --- a/e2e/common/traits/jvm_test.go +++ b/e2e/common/traits/jvm_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/traits/master_test.go b/e2e/common/traits/master_test.go index 2d8cb8f..e9cff03 100644 --- a/e2e/common/traits/master_test.go +++ b/e2e/common/traits/master_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/traits/pdb_test.go b/e2e/common/traits/pdb_test.go index 807c57c..17aa117 100644 --- a/e2e/common/traits/pdb_test.go +++ b/e2e/common/traits/pdb_test.go @@ -1,6 +1,7 @@ +//go:build integration // +build integration -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "knative" +// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" /* Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/e2e/common/traits/pod_test.go b/e2e/common/traits/pod_test.go index 65994b3..eee5635 100644 --- a/e2e/common/traits/pod_test.go +++ b/e2e/common/traits/pod_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -24,10 +25,12 @@ package traits import ( "testing" - . "github.com/apache/camel-k/e2e/support" - camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" . "github.com/onsi/gomega" - v1 "k8s.io/api/core/v1" + + corev1 "k8s.io/api/core/v1" + + . "github.com/apache/camel-k/e2e/support" + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" ) func TestPodTrait(t *testing.T) { @@ -39,23 +42,23 @@ func TestPodTrait(t *testing.T) { "--pod-template", "files/template.yaml", ).Execute()).To(Succeed()) - //check integration is deployed - Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + // check integration is deployed + Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - //check that integrations is working and reading data created by sidecar container + // check that integrations is working and reading data created by sidecar container Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Content from the sidecar container")) - //check that env var is injected + // check that env var is injected Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("hello from the template")) pod := IntegrationPod(ns, name)() - //check if ENV variable is applied + // check if ENV variable is applied envValue := getEnvVar("TEST_VARIABLE", pod.Spec) Expect(envValue).To(Equal("hello from the template")) }) } -func getEnvVar(name string, spec v1.PodSpec) string { +func getEnvVar(name string, spec corev1.PodSpec) string { for _, i := range spec.Containers[0].Env { if i.Name == name { return i.Value diff --git a/e2e/common/traits/prometheus_test.go b/e2e/common/traits/prometheus_test.go index 91ce909..753a483 100644 --- a/e2e/common/traits/prometheus_test.go +++ b/e2e/common/traits/prometheus_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/traits/pull_secret_test.go b/e2e/common/traits/pull_secret_test.go index 9f29d85..430b5f8 100644 --- a/e2e/common/traits/pull_secret_test.go +++ b/e2e/common/traits/pull_secret_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/common/traits/route_test.go b/e2e/common/traits/route_test.go index 341215d..63eb4c5 100644 --- a/e2e/common/traits/route_test.go +++ b/e2e/common/traits/route_test.go @@ -1,6 +1,7 @@ +//go:build integration // +build integration -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "knative" +// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" /* Licensed to the Apache Software Foundation (ASF) under one or more @@ -31,6 +32,7 @@ import ( "encoding/pem" "fmt" "math/big" + rand2 "math/rand" "net/http" "testing" "time" @@ -38,8 +40,6 @@ import ( . "github.com/onsi/gomega" "github.com/stretchr/testify/assert" - rand2 "math/rand" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -47,26 +47,26 @@ import ( "github.com/apache/camel-k/pkg/util/openshift" ) -const( - secretName = "test-certificate" - integrationName = "platform-http-server" +const ( + secretName = "test-certificate" + integrationName = "platform-http-server" waitBeforeHttpRequest = 7 * time.Second ) type keyCertificatePair struct { - Key []byte + Key []byte Certificate []byte } // self-signed certificate used when making the https request var certPem []byte -// the e2e tests run on openshift3 in CI and there is no object to retrieve the base domain name -// to create a valid hostname to later have it validate when doing the https request -// as this a e2e test to validate the route object and not the certificate itself -// if the base domain name cannot be retrieved from dns/cluster we can safely skip TLS verification -// if running on openshift4, there is the dns/cluster object to retrieve the base domain name, -// then in this case the http client validates the TLS certificate +// the e2e tests run on OpenShift 3 and there is no object to retrieve the base domain name +// to create a valid hostname to later have it validated when doing the HTTPS request. +// As this e2e test validates the route object and not the certificate itself, +// if the base domain name cannot be retrieved from dns/cluster, we can safely skip TLS verification. +// if running on openshift4, there is the dns/cluster object to retrieve the base domain name, +// then in this case the HTTP client validates the TLS certificate. var skipClientTLSVerification = true func TestRunRoutes(t *testing.T) { @@ -97,7 +97,7 @@ func TestRunRoutes(t *testing.T) { Eventually(IntegrationPodPhase(ns, integrationName), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) route := Route(ns, integrationName) Eventually(route, TestTimeoutMedium).ShouldNot(BeNil()) - // must wait a little time after route is created, before doing an http request, + // must wait a little time after route is created, before doing an http request, // otherwise the route is unavailable and the http request will fail time.Sleep(waitBeforeHttpRequest) url := fmt.Sprintf("http://%s/hello?name=Simple", route().Spec.Host) @@ -110,13 +110,12 @@ func TestRunRoutes(t *testing.T) { // ============================= // TLS Route Edge // ============================= - t.Run("Route Edge https works", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "files/PlatformHttpServer.java", "-t", "route.tls-termination=edge").Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, integrationName), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) route := Route(ns, integrationName) Eventually(route, TestTimeoutMedium).ShouldNot(BeNil()) - // must wait a little time after route is created, before an http request, + // 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) url := fmt.Sprintf("https://%s/hello?name=TLS_Edge", route().Spec.Host) @@ -129,85 +128,82 @@ func TestRunRoutes(t *testing.T) { // ============================= // TLS Route Edge with custom certificate // ============================= - t.Run("Route Edge (custom certificate) https works", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "files/PlatformHttpServer.java", "-t", "route.tls-termination=edge", - "-t", "route.tls-certificate-secret=" + refCert, - "-t", "route.tls-key-secret=" + refKey, + "-t", "route.tls-certificate-secret="+refCert, + "-t", "route.tls-key-secret="+refKey, ).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, integrationName), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) route := Route(ns, integrationName) Eventually(route, TestTimeoutMedium).ShouldNot(BeNil()) - // must wait a little time after route is created, before an http request, + // 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) code := "TLS_EdgeCustomCertificate" url := fmt.Sprintf("https://%s/hello?name=%s", route().Spec.Host, code) response, err := httpRequest(t, url, true) assert.Nil(t, err) - assert.Equal(t, "Hello " + code, response) + assert.Equal(t, "Hello "+code, response) Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) }) // ============================= // TLS Route Passthrough // ============================= - t.Run("Route passthrough https works", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "files/PlatformHttpServer.java", // the --resource mounts the certificates inside secret as files in the integration pod - "--resource", "secret:" + secretName + "@/etc/ssl/" + secretName, + "--resource", "secret:"+secretName+"@/etc/ssl/"+secretName, // quarkus platform-http uses these two properties to setup the HTTP endpoint with TLS support - "-p", "quarkus.http.ssl.certificate.file=/etc/ssl/" + secretName + "/tls.crt", - "-p", "quarkus.http.ssl.certificate.key-file=/etc/ssl/" + secretName + "/tls.key", + "-p", "quarkus.http.ssl.certificate.file=/etc/ssl/"+secretName+"/tls.crt", + "-p", "quarkus.http.ssl.certificate.key-file=/etc/ssl/"+secretName+"/tls.key", "-t", "route.tls-termination=passthrough", "-t", "container.port=8443", ).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, integrationName), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) route := Route(ns, integrationName) Eventually(route, TestTimeoutMedium).ShouldNot(BeNil()) - // must wait a little time after route is created, before an http request, + // 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) code := "TLS_Passthrough" url := fmt.Sprintf("https://%s/hello?name=%s", route().Spec.Host, code) response, err := httpRequest(t, url, true) assert.Nil(t, err) - assert.Equal(t, "Hello " + code, response) + assert.Equal(t, "Hello "+code, response) Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) }) // ============================= // TLS Route Reencrypt // ============================= - t.Run("Route Reencrypt https works", func(t *testing.T) { Expect(Kamel("run", "-n", ns, "files/PlatformHttpServer.java", // the --resource mounts the certificates inside secret as files in the integration pod - "--resource", "secret:" + secretName + "@/etc/ssl/" + secretName, + "--resource", "secret:"+secretName+"@/etc/ssl/"+secretName, // quarkus platform-http uses these two properties to setup the HTTP endpoint with TLS support - "-p", "quarkus.http.ssl.certificate.file=/etc/ssl/" + secretName + "/tls.crt", - "-p", "quarkus.http.ssl.certificate.key-file=/etc/ssl/" + secretName + "/tls.key", + "-p", "quarkus.http.ssl.certificate.file=/etc/ssl/"+secretName+"/tls.crt", + "-p", "quarkus.http.ssl.certificate.key-file=/etc/ssl/"+secretName+"/tls.key", "-t", "route.tls-termination=reencrypt", // the destination CA certificate which the route service uses to validate the HTTP endpoint TLS certificate - "-t", "route.tls-destination-ca-certificate-secret=" + refCert, - "-t", "route.tls-certificate-secret=" + refCert, - "-t", "route.tls-key-secret=" + refKey, + "-t", "route.tls-destination-ca-certificate-secret="+refCert, + "-t", "route.tls-certificate-secret="+refCert, + "-t", "route.tls-key-secret="+refKey, "-t", "container.port=8443", ).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, integrationName), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) route := Route(ns, integrationName) Eventually(route, TestTimeoutMedium).ShouldNot(BeNil()) - // must wait a little time after route is created, before an http request, + // 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) code := "TLS_Reencrypt" url := fmt.Sprintf("https://%s/hello?name=%s", route().Spec.Host, code) response, err := httpRequest(t, url, true) assert.Nil(t, err) - assert.Equal(t, "Hello " + code, response) + assert.Equal(t, "Hello "+code, response) Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) }) Expect(TestClient().Delete(TestContext, &secret)).To(Succeed()) @@ -220,7 +216,7 @@ func httpRequest(t *testing.T, url string, tlsEnabled bool) (string, error) { var transCfg http.Transport if skipClientTLSVerification { transCfg = http.Transport{ - TLSClientConfig: &tls.Config { + TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, }, } @@ -228,7 +224,7 @@ func httpRequest(t *testing.T, url string, tlsEnabled bool) (string, error) { certPool := x509.NewCertPool() certPool.AppendCertsFromPEM(certPem) transCfg = http.Transport{ - TLSClientConfig: &tls.Config { + TLSClientConfig: &tls.Config{ RootCAs: certPool, }, } @@ -272,7 +268,7 @@ func createSecret(ns string) (corev1.Secret, error) { Type: corev1.SecretTypeTLS, Data: map[string][]byte{ corev1.TLSPrivateKeyKey: keyCertPair.Key, - corev1.TLSCertKey: keyCertPair.Certificate, + corev1.TLSCertKey: keyCertPair.Certificate, }, } return sec, TestClient().Create(TestContext, &sec) @@ -296,7 +292,7 @@ func generateSampleKeyAndCertificate(ns string) keyCertificatePair { Subject: pkix.Name{ Organization: []string{"Camel K test"}, }, - IsCA: true, + IsCA: true, DNSNames: []string{dnsHostname}, NotBefore: time.Now(), NotAfter: time.Now().AddDate(1, 0, 0), @@ -330,8 +326,8 @@ func generateSampleKeyAndCertificate(ns string) keyCertificatePair { Bytes: certBytes, }) - return keyCertificatePair { - Key: privateKeyPem, + return keyCertificatePair{ + Key: privateKeyPem, Certificate: certPem, } } diff --git a/e2e/common/traits/toleration_test.go b/e2e/common/traits/toleration_test.go index 30c0e03..c809a09 100644 --- a/e2e/common/traits/toleration_test.go +++ b/e2e/common/traits/toleration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/knative/doc.go b/e2e/knative/doc.go index 5c024f6..6fe4069 100644 --- a/e2e/knative/doc.go +++ b/e2e/knative/doc.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/knative/kamelet_test.go b/e2e/knative/kamelet_test.go index 5de3c7a..55ea055 100644 --- a/e2e/knative/kamelet_test.go +++ b/e2e/knative/kamelet_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -22,17 +23,17 @@ limitations under the License. package knative import ( - "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" "testing" . "github.com/onsi/gomega" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" messaging "knative.dev/eventing/pkg/apis/messaging/v1" . "github.com/apache/camel-k/e2e/support" - camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" + "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" ) // Test that kamelet binding can be changed and changes propagated to integrations @@ -42,25 +43,25 @@ func TestKameletChange(t *testing.T) { Expect(CreateTimerKamelet(ns, "timer-source")()).To(Succeed()) Expect(CreateKnativeChannel(ns, "messages")()).To(Succeed()) Expect(Kamel("run", "-n", ns, "files/display.groovy", "-w").Execute()).To(Succeed()) - from := v1.ObjectReference{ + from := corev1.ObjectReference{ Kind: "Kamelet", APIVersion: v1alpha1.SchemeGroupVersion.String(), Name: "timer-source", } - to := v1.ObjectReference{ + to := corev1.ObjectReference{ Kind: "InMemoryChannel", Name: "messages", APIVersion: messaging.SchemeGroupVersion.String(), } Expect(BindKameletTo(ns, "timer-binding", from, to, map[string]string{"message": "message is Hello"}, map[string]string{})()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "timer-binding"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "timer-binding", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "timer-binding"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "timer-binding", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "display"), TestTimeoutShort).Should(ContainSubstring("message is Hello")) Expect(BindKameletTo(ns, "timer-binding", from, to, map[string]string{"message": "message is Hi"}, map[string]string{})()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "timer-binding"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "timer-binding", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "timer-binding"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "timer-binding", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "display"), TestTimeoutShort).Should(ContainSubstring("message is Hi")) Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed()) }) diff --git a/e2e/knative/knative_platform_test.go b/e2e/knative/knative_platform_test.go index 75b4321..8a6f280 100644 --- a/e2e/knative/knative_platform_test.go +++ b/e2e/knative/knative_platform_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/knative/knative_test.go b/e2e/knative/knative_test.go index 6d3a5be..a849415 100644 --- a/e2e/knative/knative_test.go +++ b/e2e/knative/knative_test.go @@ -1,6 +1,7 @@ +//go:build integration // +build integration -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "knative" +// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" /* Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/e2e/knative/openapi_test.go b/e2e/knative/openapi_test.go index a78aa88..66d71cc 100644 --- a/e2e/knative/openapi_test.go +++ b/e2e/knative/openapi_test.go @@ -1,6 +1,7 @@ +//go:build integration // +build integration -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "knative" +// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" /* Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/e2e/knative/pod_test.go b/e2e/knative/pod_test.go index fb29f30..f2e9c27 100644 --- a/e2e/knative/pod_test.go +++ b/e2e/knative/pod_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -24,10 +25,12 @@ package knative import ( "testing" - . "github.com/apache/camel-k/e2e/support" - camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" . "github.com/onsi/gomega" - v1 "k8s.io/api/core/v1" + + corev1 "k8s.io/api/core/v1" + + . "github.com/apache/camel-k/e2e/support" + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" ) func TestPodTraitWithKnative(t *testing.T) { @@ -35,11 +38,11 @@ func TestPodTraitWithKnative(t *testing.T) { Expect(Kamel("install", "-n", ns).Execute()).To(Succeed()) Expect(Kamel("run", "-n", ns, "files/podtest-knative2.groovy", "--pod-template", "files/template-knative.yaml").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "podtest-knative2"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "podtest-knative2", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "podtest-knative2"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "podtest-knative2", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Expect(Kamel("run", "-n", ns, "files/podtest-knative1.groovy").Execute()).To(Succeed()) - Eventually(IntegrationPodPhase(ns, "podtest-knative1"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "podtest-knative1", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) + Eventually(IntegrationPodPhase(ns, "podtest-knative1"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) + Eventually(IntegrationCondition(ns, "podtest-knative1", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, "podtest-knative1"), TestTimeoutShort).Should(ContainSubstring("hello from the template")) }) diff --git a/e2e/local/local_run_test.go b/e2e/local/local_run_test.go index 8d12752..349f478 100644 --- a/e2e/local/local_run_test.go +++ b/e2e/local/local_run_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /* diff --git a/e2e/native/native_test.go b/e2e/native/native_test.go index fca7c7e..b6b806e 100644 --- a/e2e/native/native_test.go +++ b/e2e/native/native_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/service-binding/service_binding_test.go b/e2e/service-binding/service_binding_test.go index 9b88717..484d013 100644 --- a/e2e/service-binding/service_binding_test.go +++ b/e2e/service-binding/service_binding_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -31,7 +32,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" . "github.com/apache/camel-k/e2e/support" - camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1" + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" ) func TestServiceBindingTrait(t *testing.T) { @@ -71,7 +72,7 @@ func TestServiceBindingTrait(t *testing.T) { ).Execute()).To(Succeed()) Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) - Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) + Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring(fmt.Sprintf("%s:%s", host, port))) // Clean up diff --git a/e2e/support/test_nexus_hooks.go b/e2e/support/test_nexus_hooks.go index a04bb6e..81aaeb9 100644 --- a/e2e/support/test_nexus_hooks.go +++ b/e2e/support/test_nexus_hooks.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -26,6 +27,7 @@ import ( "os" corev1 "k8s.io/api/core/v1" + ctrl "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/e2e/support/test_staging_hooks.go b/e2e/support/test_staging_hooks.go index 31ffd57..b526602 100644 --- a/e2e/support/test_staging_hooks.go +++ b/e2e/support/test_staging_hooks.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -41,15 +42,15 @@ func init() { // this hook can be also used to test a released version of the operator, e.g. the staging version during a voting period // Uncomment the following lines and change references to enable the hook - //TestImageName = "docker.io/camelk/camel-k" - //TestImageVersion = "1.0.0-M2" + // TestImageName = "docker.io/camelk/camel-k" + // TestImageVersion = "1.0.0-M2" - //KamelHooks = append(KamelHooks, func(cmd []string) []string { + // KamelHooks = append(KamelHooks, func(cmd []string) []string { // if len(cmd) > 0 && cmd[0] == "install" { // cmd = append(cmd, "--operator-image=docker.io/camelk/camel-k:1.0.0-M2") // cmd = append(cmd, "--maven-repository=https://repository.apache.org/content/repositories/orgapachecamel-1156") // } // return cmd - //}) + // }) } diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go index 8c12fbf..5be6d7a 100644 --- a/e2e/support/test_support.go +++ b/e2e/support/test_support.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" @@ -1238,7 +1239,7 @@ func Kamelet(name string, ns string) func() *v1alpha1.Kamelet { func ClusterDomainName() (string, error) { dns := configv1.DNS{} key := ctrl.ObjectKey{ - Name: "cluster", + Name: "cluster", } err := TestClient().Get(TestContext, key, &dns) if err != nil { @@ -1247,7 +1248,6 @@ func ClusterDomainName() (string, error) { return dns.Spec.BaseDomain, nil } - /* Tekton */ @@ -1398,7 +1398,7 @@ func BindKameletToWithErrorHandler(ns string, name string, from corev1.ObjectRef kb := v1alpha1.NewKameletBinding(ns, name) kb.Spec = v1alpha1.KameletBindingSpec{ Source: v1alpha1.Endpoint{ - Ref: &from, + Ref: &from, Properties: asEndpointProperties(sourceProperties), }, Sink: v1alpha1.Endpoint{ diff --git a/e2e/support/test_util.go b/e2e/support/test_util.go index d627ccc..d95599c 100644 --- a/e2e/support/test_util.go +++ b/e2e/support/test_util.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/support/util/dump.go b/e2e/support/util/dump.go index f31ba9c..a8eacc2 100644 --- a/e2e/support/util/dump.go +++ b/e2e/support/util/dump.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /* @@ -25,7 +26,7 @@ import ( "fmt" "testing" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/apache/camel-k/pkg/client" @@ -134,7 +135,7 @@ func Dump(ctx context.Context, c client.Client, ns string, t *testing.T) error { t.Logf("name=%s\n", pod.Name) dumpConditions(" ", pod.Status.Conditions, t) t.Logf(" logs:\n") - var allContainers []v1.Container + var allContainers []corev1.Container allContainers = append(allContainers, pod.Spec.InitContainers...) allContainers = append(allContainers, pod.Spec.Containers...) for _, container := range allContainers { @@ -151,7 +152,7 @@ func Dump(ctx context.Context, c client.Client, ns string, t *testing.T) error { return nil } -func dumpConditions(prefix string, conditions []v1.PodCondition, t *testing.T) { +func dumpConditions(prefix string, conditions []corev1.PodCondition, t *testing.T) { for _, cond := range conditions { t.Logf("%scondition type=%s, status=%s, reason=%s, message=%q\n", prefix, cond.Type, cond.Status, cond.Reason, cond.Message) } @@ -159,7 +160,7 @@ func dumpConditions(prefix string, conditions []v1.PodCondition, t *testing.T) { func dumpLogs(ctx context.Context, c client.Client, prefix string, ns string, name string, container string, t *testing.T) error { lines := int64(50) - stream, err := c.CoreV1().Pods(ns).GetLogs(name, &v1.PodLogOptions{ + stream, err := c.CoreV1().Pods(ns).GetLogs(name, &corev1.PodLogOptions{ Container: container, TailLines: &lines, }).Stream(ctx) diff --git a/e2e/support/util/log_counter.go b/e2e/support/util/log_counter.go index 02a72db..e1ae294 100644 --- a/e2e/support/util/log_counter.go +++ b/e2e/support/util/log_counter.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /* @@ -24,7 +25,7 @@ import ( ) type LogCounter struct { - logs *[]LogEntry + logs *[]LogEntry } func NewLogCounter(logs *[]LogEntry) *LogCounter { diff --git a/e2e/support/util/log_scanner.go b/e2e/support/util/log_scanner.go index 65004eb..82262d8 100644 --- a/e2e/support/util/log_scanner.go +++ b/e2e/support/util/log_scanner.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /* diff --git a/e2e/support/util/log_walker.go b/e2e/support/util/log_walker.go index 3317ef7..ee1dbed 100644 --- a/e2e/support/util/log_walker.go +++ b/e2e/support/util/log_walker.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /* diff --git a/e2e/support/util/structured_log.go b/e2e/support/util/structured_log.go index ca26628..f740cab 100644 --- a/e2e/support/util/structured_log.go +++ b/e2e/support/util/structured_log.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /* diff --git a/e2e/support/util/temp_file.go b/e2e/support/util/temp_file.go index e1ac8b5..e10a3e3 100644 --- a/e2e/support/util/temp_file.go +++ b/e2e/support/util/temp_file.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration /* @@ -27,7 +28,6 @@ import ( "testing" ) -// MakeTempCopy -- func MakeTempCopy(t *testing.T, fileName string) string { _, simpleName := path.Split(fileName) var err error @@ -59,7 +59,6 @@ func ReplaceInFile(t *testing.T, fileName string, old, new string) { } } -// MakeTempDir -- func MakeTempDir(t *testing.T) string { var tmpDir string var err error diff --git a/e2e/upgrade/cli_upgrade_test.go b/e2e/upgrade/cli_upgrade_test.go index 313b18e..2f745a9 100644 --- a/e2e/upgrade/cli_upgrade_test.go +++ b/e2e/upgrade/cli_upgrade_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/upgrade/olm_upgrade_test.go b/e2e/upgrade/olm_upgrade_test.go index 7977c74..ac4d39c 100644 --- a/e2e/upgrade/olm_upgrade_test.go +++ b/e2e/upgrade/olm_upgrade_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/e2e/upgrade/util.go b/e2e/upgrade/util.go index 0b6d667..7bbeccd 100644 --- a/e2e/upgrade/util.go +++ b/e2e/upgrade/util.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" diff --git a/pkg/cmd/util_test.go b/pkg/cmd/util_test.go index 5938b86..2d8734b 100644 --- a/pkg/cmd/util_test.go +++ b/pkg/cmd/util_test.go @@ -1,3 +1,4 @@ +//go:build !darwin // +build !darwin /*