|
| 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