Skip to content

Commit bcfb935

Browse files
committed
chore(e2e): integration apply test
1 parent fa0c426 commit bcfb935

2 files changed

Lines changed: 93 additions & 0 deletions

File tree

e2e/common/cli/files/my-it.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# ---------------------------------------------------------------------------
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
# ---------------------------------------------------------------------------
17+
18+
apiVersion: camel.apache.org/v1
19+
kind: Integration
20+
metadata:
21+
name: my-it
22+
spec:
23+
flows:
24+
- route:
25+
from:
26+
parameters:
27+
period: "1000"
28+
steps:
29+
- setBody:
30+
simple: Hello Camel from my-it
31+
- log: ${body}
32+
uri: timer:yaml

e2e/common/cli/it_apply_test.go

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//go:build integration
2+
// +build integration
3+
4+
// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
5+
6+
/*
7+
Licensed to the Apache Software Foundation (ASF) under one or more
8+
contributor license agreements. See the NOTICE file distributed with
9+
this work for additional information regarding copyright ownership.
10+
The ASF licenses this file to You under the Apache License, Version 2.0
11+
(the "License"); you may not use this file except in compliance with
12+
the License. You may obtain a copy of the License at
13+
14+
http://www.apache.org/licenses/LICENSE-2.0
15+
16+
Unless required by applicable law or agreed to in writing, software
17+
distributed under the License is distributed on an "AS IS" BASIS,
18+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
See the License for the specific language governing permissions and
20+
limitations under the License.
21+
*/
22+
23+
package common
24+
25+
import (
26+
"context"
27+
"os/exec"
28+
"testing"
29+
30+
corev1 "k8s.io/api/core/v1"
31+
32+
. "github.com/apache/camel-k/v2/e2e/support"
33+
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
34+
. "github.com/onsi/gomega"
35+
)
36+
37+
func TestKubectlApply(t *testing.T) {
38+
t.Parallel()
39+
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
40+
t.Run("kubectl apply", func(t *testing.T) {
41+
name := "my-it"
42+
43+
ExpectExecSucceed(t, g,
44+
exec.Command(
45+
"kubectl",
46+
"apply",
47+
"-f",
48+
"files/my-it.yaml",
49+
"-n",
50+
ns,
51+
),
52+
)
53+
54+
g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).
55+
Should(Equal(corev1.ConditionTrue))
56+
g.Eventually(IntegrationPodPhase(t, ctx, ns, name)).Should(Equal(corev1.PodRunning))
57+
58+
g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("Hello Camel from my-it"))
59+
})
60+
})
61+
}

0 commit comments

Comments
 (0)