Skip to content

Commit

Permalink
Start migration of test Kamel -> CamelK
Browse files Browse the repository at this point in the history
  • Loading branch information
gansheer committed Mar 11, 2024
1 parent a664a58 commit a28d669
Show file tree
Hide file tree
Showing 73 changed files with 314 additions and 306 deletions.
18 changes: 9 additions & 9 deletions e2e/advanced/build_order_strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestRunBuildOrderStrategyMatchingDependencies(t *testing.T) {
g.Expect(CreateTimerKamelet(t, operatorID, ns, "timer-source")()).To(Succeed())

integrationA := RandomizedSuffixName("java-a")
g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/Java.java",
"--name", integrationA,
).Execute()).To(Succeed())

Expand All @@ -58,20 +58,20 @@ func TestRunBuildOrderStrategyMatchingDependencies(t *testing.T) {
g.Eventually(Build(t, ns, integrationKitNameA), TestTimeoutMedium).ShouldNot(BeNil())

integrationB := RandomizedSuffixName("java-b")
g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/Java.java",
"--name", integrationB,
"-d", "camel:cron",
).Execute()).To(Succeed())

integrationC := RandomizedSuffixName("java-c")
g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/Java.java",
"--name", integrationC,
"-d", "camel:cron",
"-d", "camel:zipfile",
).Execute()).To(Succeed())

integrationZ := RandomizedSuffixName("groovy-z")
g.Expect(KamelRunWithID(t, operatorID, ns, "files/timer-source.groovy",
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/timer-source.groovy",
"--name", integrationZ,
).Execute()).To(Succeed())

Expand Down Expand Up @@ -118,7 +118,7 @@ func TestRunBuildOrderStrategyMatchingDependencies(t *testing.T) {
g.Expect(buildZ.Status.StartedAt.Before(buildB.Status.StartedAt)).Should(BeTrue())
g.Expect(buildZ.Status.StartedAt.Before(buildC.Status.StartedAt)).Should(BeTrue())

g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
g.Expect(CamelK(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}

Expand All @@ -134,19 +134,19 @@ func TestRunBuildOrderStrategyFIFO(t *testing.T) {
g.Expect(CreateTimerKamelet(t, ns, "timer-source")()).To(Succeed())
integrationA := RandomizedSuffixName("java-a")
g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/Java.java",
"--name", integrationA,
).Execute()).To(Succeed())
g.Eventually(IntegrationPhase(t, ns, integrationA)).Should(Equal(v1.IntegrationPhaseBuildingKit))
integrationB := RandomizedSuffixName("java-b")
g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/Java.java",
"--name", integrationB,
"-d", "camel:joor",
).Execute()).To(Succeed())
integrationZ := RandomizedSuffixName("groovy-z")
g.Expect(KamelRunWithID(t, operatorID, ns, "files/timer-source.groovy",
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/timer-source.groovy",
"--name", integrationZ,
).Execute()).To(Succeed())
Expand Down Expand Up @@ -179,7 +179,7 @@ func TestRunBuildOrderStrategyFIFO(t *testing.T) {
g.Eventually(IntegrationLogs(t, ns, integrationZ), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
g.Eventually(Kit(t, ns, integrationKitNameZ)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
g.Expect(CamelK(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
*/
2 changes: 1 addition & 1 deletion e2e/advanced/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestBuilderTimeout(t *testing.T) {

t.Run("run yaml", func(t *testing.T) {
name := RandomizedSuffixName("yaml")
g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml",
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/yaml.yaml",
"--name", name,
"-t", "builder.strategy=pod").Execute()).To(Succeed())
// As the build hits timeout, it keeps trying building
Expand Down
8 changes: 4 additions & 4 deletions e2e/advanced/catalog_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestCamelCatalogBuilder(t *testing.T) {
name := RandomizedSuffixName("java-1-15")
nonCompatibleCatalogName := "camel-catalog-1.15.0"
g.Expect(
KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
CamelKRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
"-t", "camel.runtime-version=1.15.0",
).Execute()).To(Succeed())

Expand Down Expand Up @@ -89,7 +89,7 @@ func TestCamelCatalogBuilder(t *testing.T) {
g.Eventually(CamelCatalog(t, ns, compatibleCatalogName)).Should(BeNil())

g.Expect(
KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
CamelKRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
"-t", "camel.runtime-version="+compatibleVersion,
).Execute()).To(Succeed())

Expand All @@ -115,7 +115,7 @@ func TestCamelCatalogBuilder(t *testing.T) {
g.Eventually(CamelCatalog(t, ns, compatibleCatalogName)).Should(BeNil())

g.Expect(
KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
CamelKRunWithID(t, operatorID, ns, "files/Java.java", "--name", name,
"-t", "camel.runtime-version="+compatibleVersion,
).Execute()).To(Succeed())

Expand All @@ -137,6 +137,6 @@ func TestCamelCatalogBuilder(t *testing.T) {
g.Eventually(DeleteIntegrations(t, ns)).Should(Equal(0))
})

g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
g.Expect(CamelK(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
18 changes: 9 additions & 9 deletions e2e/advanced/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestKamelCLIDebug(t *testing.T) {
g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))

t.Run("debug local default port check", func(t *testing.T) {
g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
g.Expect(portIsInUse("127.0.0.1", "5005")()).To(BeFalse())

Expand All @@ -57,11 +57,11 @@ func TestKamelCLIDebug(t *testing.T) {
go KamelWithContext(t, debugTestContext, "debug", "yaml", "-n", ns).ExecuteContext(debugTestContext)

g.Eventually(portIsInUse("127.0.0.1", "5005"), TestTimeoutMedium, 5*time.Second).Should(BeTrue())
g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
g.Expect(CamelK(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})

t.Run("debug local port check", func(t *testing.T) {
g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
g.Expect(portIsInUse("127.0.0.1", "5006")()).To(BeFalse())

Expand All @@ -70,23 +70,23 @@ func TestKamelCLIDebug(t *testing.T) {
go KamelWithContext(t, debugTestContext, "debug", "yaml", "--port", "5006", "-n", ns).ExecuteContext(debugTestContext)

g.Eventually(portIsInUse("127.0.0.1", "5006"), TestTimeoutMedium, 5*time.Second).Should(BeTrue())
g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
g.Expect(CamelK(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})

t.Run("debug logs check", func(t *testing.T) {
g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))

debugTestContext, cancel := context.WithCancel(TestContext)
defer cancelAndWait(cancel)
go KamelWithContext(t, debugTestContext, "debug", "yaml", "-n", ns).ExecuteContext(debugTestContext)

g.Eventually(IntegrationLogs(t, ns, "yaml"), TestTimeoutMedium).Should(ContainSubstring("Listening for transport dt_socket at address: 5005"))
g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
g.Expect(CamelK(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})

t.Run("Pod config test", func(t *testing.T) {
g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))

debugTestContext, cancel := context.WithCancel(TestContext)
Expand All @@ -97,10 +97,10 @@ func TestKamelCLIDebug(t *testing.T) {
return IntegrationPod(t, ns, "yaml")().Spec.Containers[0].Args[0]
}).Should(ContainSubstring("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005"))
g.Expect(IntegrationPod(t, ns, "yaml")().GetLabels()["camel.apache.org/debug"]).To(Not(BeNil()))
g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
g.Expect(CamelK(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})

g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
g.Expect(CamelK(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}

Expand Down
5 changes: 3 additions & 2 deletions e2e/advanced/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ package advanced
import (
"testing"

"os/exec"

. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"os/exec"

. "github.com/apache/camel-k/v2/e2e/support"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
Expand Down Expand Up @@ -68,7 +69,7 @@ func TestDeploymentFailureShouldReportIntegrationCondition(t *testing.T) {
)
// Create an Integration into a restricted namespace
name := RandomizedSuffixName("java-fail")
g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java", "--name", name, "-n", nsRestr).Execute()).To(Succeed())
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/Java.java", "--name", name, "-n", nsRestr).Execute()).To(Succeed())
// Check the error is reported into the Integration
g.Eventually(IntegrationPhase(t, nsRestr, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseError))
g.Eventually(IntegrationCondition(t, nsRestr, name, v1.IntegrationConditionReady)().Status).
Expand Down
5 changes: 3 additions & 2 deletions e2e/advanced/dump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ package advanced

import (
"fmt"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"testing"

v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"

. "github.com/onsi/gomega"

corev1 "k8s.io/api/core/v1"
Expand All @@ -52,7 +53,7 @@ func TestKamelCLIDump(t *testing.T) {
g.Expect(KamelInstallWithID(t, operatorID, ns)).To(Succeed())
g.Eventually(SelectedPlatformPhase(t, ns, operatorID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))

g.Expect(KamelRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/yaml.yaml").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationLogs(t, ns, "yaml")).Should(ContainSubstring("Magicstring!"))

Expand Down
8 changes: 4 additions & 4 deletions e2e/advanced/environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestEnvironmentTrait(t *testing.T) {

t.Run("Run integration with default environment", func(t *testing.T) {
name := RandomizedSuffixName("java-default")
g.Expect(KamelRunWithID(t, operatorID, ns, "--name", name, "files/Java.java").Execute()).To(Succeed())
g.Expect(CamelKRunWithID(t, operatorID, ns, "--name", name, "files/Java.java").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationConditionStatus(t, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
g.Eventually(IntegrationLogs(t, ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
Expand All @@ -104,7 +104,7 @@ func TestEnvironmentTrait(t *testing.T) {

t.Run("Run integration with custom environment", func(t *testing.T) {
name := RandomizedSuffixName("java-custom-proxy")
g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/Java.java",
"--name", name,
"-t", "environment.vars=HTTP_PROXY=http://custom.proxy",
).Execute()).To(Succeed())
Expand Down Expand Up @@ -133,7 +133,7 @@ func TestEnvironmentTrait(t *testing.T) {

t.Run("Run integration without default HTTP proxy environment", func(t *testing.T) {
name := RandomizedSuffixName("java-no-proxy")
g.Expect(KamelRunWithID(t, operatorID, ns, "files/Java.java",
g.Expect(CamelKRunWithID(t, operatorID, ns, "files/Java.java",
"--name", name,
"-t", "environment.http-proxy=false",
).Execute()).To(Succeed())
Expand Down Expand Up @@ -168,7 +168,7 @@ func TestEnvironmentTrait(t *testing.T) {
g.Expect(envTrait["httpProxy"]).To(Equal(false))
})

g.Expect(Kamel(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
g.Expect(CamelK(t, "delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}

Expand Down
Loading

0 comments on commit a28d669

Please sign in to comment.