Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions e2e/common/cli/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
. "github.com/onsi/gomega"

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

func TestKamelCLIBind(t *testing.T) {
Expand All @@ -40,22 +41,25 @@ func TestKamelCLIBind(t *testing.T) {
g.Expect(CreateTimerKamelet(t, ctx, ns, kameletName)()).To(Succeed())

t.Run("bind timer to log", func(t *testing.T) {
pipeName := "test-timer-source-to-log"
g.Expect(KamelBind(t, ctx, ns, kameletName, "log:info", "-p", "source.message=helloTest").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, "test-timer-source-to-log"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationLogs(t, ctx, ns, "test-timer-source-to-log")).Should(ContainSubstring("Body: helloTest"))
g.Expect(KamelBind(t, ctx, ns, "test-timer-source", "log:info", "-p", "source.message=newText").Execute()).To(Succeed())
g.Eventually(IntegrationLogs(t, ctx, ns, "test-timer-source-to-log")).Should(ContainSubstring("Body: newText"))
g.Eventually(IntegrationConditionStatus(t, ctx, ns, pipeName, v1.IntegrationConditionReady), TestTimeoutMedium).
Should(Equal(corev1.ConditionTrue))
g.Eventually(IntegrationPodPhase(t, ctx, ns, pipeName)).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationLogs(t, ctx, ns, pipeName)).Should(ContainSubstring("Body: helloTest"))

g.Expect(KamelBind(t, ctx, ns, kameletName, "log:info", "-p", "source.message=newText").Execute()).To(Succeed())
g.Eventually(IntegrationConditionStatus(t, ctx, ns, pipeName, v1.IntegrationConditionReady), TestTimeoutMedium).
Should(Equal(corev1.ConditionTrue))
g.Eventually(IntegrationLogs(t, ctx, ns, pipeName)).Should(ContainSubstring("Body: newText"))
})

t.Run("bind uris", func(t *testing.T) {
g.Expect(KamelBind(t, ctx, ns, "timer:foo", "log:bar").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, "timer-to-log"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationConditionStatus(t, ctx, ns, "timer-to-log", v1.IntegrationConditionReady), TestTimeoutMedium).
Should(Equal(corev1.ConditionTrue))
g.Eventually(IntegrationPodPhase(t, ctx, ns, "timer-to-log")).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationLogs(t, ctx, ns, "timer-to-log")).Should(ContainSubstring("Body is null"))
})

t.Run("bind with custom SA", func(t *testing.T) {
g.Expect(KamelBind(t, ctx, ns, "timer:foo", "log:bar", "--service-account", "my-service-account").Execute()).To(Succeed())
g.Eventually(IntegrationSpecSA(t, ctx, ns, "timer-to-log")).Should(Equal("my-service-account"))
})
})
}
10 changes: 0 additions & 10 deletions e2e/support/test_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,16 +870,6 @@ func IntegrationStatusCapabilities(t *testing.T, ctx context.Context, ns string,
}
}

func IntegrationSpecSA(t *testing.T, ctx context.Context, ns string, name string) func() string {
return func() string {
it := Integration(t, ctx, ns, name)()
if it == nil {
return ""
}
return it.Spec.ServiceAccountName
}
}

func IntegrationKitName(t *testing.T, ctx context.Context, ns string, name string) func() string {
return func() string {
it := Integration(t, ctx, ns, name)()
Expand Down
Loading