Skip to content

Commit db2a3e1

Browse files
committed
test: add E2E test case for KinD import-images functionality
Verify that the import-images feature works correctly after upgrading kind dependency to v0.27.0. - Add test/e2e/kind/ with KinD cluster config, test pod, and expected result - Add e2e-test-kind target in Makefile for local testing - Update CI workflow to run KinD E2E test - Update test/e2e/README.md with new directory structure
1 parent 3219f55 commit db2a3e1

File tree

7 files changed

+124
-3
lines changed

7 files changed

+124
-3
lines changed

.github/workflows/e2e-test.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,12 @@ jobs:
5959
uses: apache/skywalking-infra-e2e@main
6060
with:
6161
e2e-file: ./test/e2e/e2e.yaml
62+
63+
- name: Install KinD
64+
run: |
65+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64
66+
chmod +x ./kind
67+
sudo mv ./kind /usr/local/bin/kind
68+
69+
- name: Run KinD E2E Test
70+
run: make e2e-test-kind

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,10 @@ uninstall: $(GOOS)
111111
e2e-test: $(GOOS)
112112
- make build
113113
- ./bin/$(GOOS)/$(PROJECT) run -c ./test/e2e/e2e.yaml
114+
115+
.PHONY: e2e-test-kind
116+
# Run E2E test with KinD to verify import-images functionality
117+
e2e-test-kind:
118+
$(MAKE) $(GOOS)
119+
docker pull busybox:latest
120+
./bin/$(GOOS)/$(PROJECT) run -c ./test/e2e/kind/e2e.yaml

test/e2e/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ You can perform testing locally. And when you submit a pull request (PR), GitHub
99
|- concurrency
1010
|- fail-fast (concurrency & fail-fast mode)
1111
|- internal
12-
|- expected.yaml
12+
|- expected.yaml
1313
|- verify.yaml (configuration file)
1414
|- expected.yaml
1515
|- non-fail-fast (concurrency & non-fail-fast mode)
1616
|- internal
1717
|- expected.yaml
1818
|- verify.yaml (configuration file)
1919
|- expected.yaml
20-
|- non-concurrency
20+
|- non-concurrency
2121
|- fail-fast (non-concurrency & fail-fast mode)
2222
|- internal
2323
|- expected.yaml
@@ -28,6 +28,11 @@ You can perform testing locally. And when you submit a pull request (PR), GitHub
2828
|- expected.yaml
2929
|- verify.yaml (configuration file)
3030
|- expected.yaml
31+
|- kind (KinD import-images test)
32+
|- kind-cluster.yaml (KinD cluster configuration)
33+
|- e2e.yaml (E2E test configuration with import-images)
34+
|- deployment.yaml (test Pod definition)
35+
|- expected.yaml (expected result)
3136
|- docker-compose.yaml (run a httpbin container, which can return YAML data)
3237
|- e2e.yaml (configuration file for the outer infra E2E)
3338
@@ -143,7 +148,8 @@ skippedCount: 0
143148
add the name of the cases to 'passed','failed' or 'skipped'. And add the number of cases on 'passedCount','failedCount' and 'skippedCount'.
144149

145150
## Tips
146-
- You can use `make e2e-test` to run the test locally
151+
- You can use `make e2e-test` to run the docker-compose test locally
152+
- You can use `make e2e-test-kind` to run the KinD import-images test locally
147153
- You may need to split your PR to pass e2e tests in CI
148154
```
149155
# /internal/expected.yaml

test/e2e/kind/deployment.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
apiVersion: v1
17+
kind: Pod
18+
metadata:
19+
name: import-test
20+
spec:
21+
containers:
22+
- name: test
23+
image: busybox:latest
24+
imagePullPolicy: Never # Force using locally imported image
25+
command: ["sleep", "3600"]

test/e2e/kind/e2e.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# This file tests the import-images functionality with KinD.
17+
18+
setup:
19+
env: kind
20+
file: kind-cluster.yaml
21+
timeout: 10m
22+
kind:
23+
import-images:
24+
- busybox:latest
25+
steps:
26+
- name: deploy test pod
27+
command: kubectl apply -f test/e2e/kind/deployment.yaml
28+
29+
cleanup:
30+
on: always
31+
32+
verify:
33+
retry:
34+
count: 10
35+
interval: 5s
36+
cases:
37+
- name: verify pod running with imported image
38+
query: kubectl get pod import-test -o jsonpath='{.status.phase}'
39+
expected: expected.yaml

test/e2e/kind/expected.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
Running

test/e2e/kind/kind-cluster.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
kind: Cluster
17+
apiVersion: kind.x-k8s.io/v1alpha4
18+
nodes:
19+
- role: control-plane

0 commit comments

Comments
 (0)