Skip to content

Commit 14338b4

Browse files
committed
restructure to use common-scripts and reduce Makefile complexity
Signed-off-by: Rajat Jindal <[email protected]>
1 parent a3ceefe commit 14338b4

File tree

9 files changed

+48
-51
lines changed

9 files changed

+48
-51
lines changed

Makefile

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ up:
3838
pod-status-check:
3939
./scripts/pod-status-check.sh
4040

41-
./PHONY: workloads
42-
workloads:
43-
./scripts/workloads.sh
41+
./PHONY: deploy-workloads-pushed-using-docker-build-push
42+
deploy-workloads-pushed-using-docker-build-push:
43+
./scripts/deploy-workloads.sh "workloads-pushed-using-docker-build-push"
4444

45-
./PHONY: workloads-spin-registry-push
46-
workloads-spin-registry-push:
47-
./scripts/workloads-spin-registry-push.sh
45+
./PHONY: deploy-workloads-pushed-using-spin-registry-push
46+
deploy-workloads-pushed-using-spin-registry-push:
47+
./scripts/deploy-workloads.sh "workloads-pushed-using-spin-registry-push"
4848

4949
./PHONY: pod-terminates-test
5050
pod-terminates-test:
@@ -54,18 +54,12 @@ pod-terminates-test:
5454
integration-tests: prepare-cluster-and-images integration-docker-build-push-tests integration-spin-registry-push-tests
5555

5656
.PHONY: integration-docker-build-push-tests
57-
integration-docker-build-push-tests: workloads pod-terminates-test
58-
cargo test -p containerd-shim-spin-tests -- --nocapture
59-
kubectl delete -f tests/workloads-common --wait --timeout 60s --ignore-not-found=true
60-
kubectl delete -f tests/workloads-docker-build-push --wait --timeout 60s --ignore-not-found=true
61-
kubectl wait pod --for=delete -l app=wasm-spin -l app=spin-keyvalue -l app=spin-outbound-redis -l app=spin-multi-trigger-app --timeout 60s
57+
integration-docker-build-push-tests:
58+
./scripts/run-integration-tests.sh "workloads-pushed-using-docker-build-push"
6259

6360
.PHONY: integration-spin-registry-push-tests pod-terminates-test
64-
integration-spin-registry-push-tests: workloads-spin-registry-push
65-
cargo test -p containerd-shim-spin-tests -- --nocapture
66-
kubectl delete -f tests/workloads-common --wait --timeout 60s
67-
kubectl delete -f tests/workloads-spin-registry-push --wait --timeout 60s
68-
kubectl wait pod --for=delete -l app=wasm-spin -l app=spin-keyvalue -l app=spin-outbound-redis -l app=spin-multi-trigger-app --timeout 60s
61+
integration-spin-registry-push-tests:
62+
./scripts/run-integration-tests.sh "workloads-pushed-using-spin-registry-push"
6963

7064
.PHONY: prepare-cluster-and-images
7165
prepare-cluster-and-images: check-bins move-bins up pod-status-check

scripts/workloads-spin-registry-push.sh renamed to scripts/deploy-workloads.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@ fi
1212
# apply the workloads
1313
echo ">>> apply workloads"
1414
kubectl apply -f tests/workloads-common
15-
kubectl apply -f tests/workloads-spin-registry-push
1615

16+
if [ "$1" == "workloads-pushed-using-spin-registry-push" ]; then
17+
echo "deploying spin apps pushed to registry using 'spin registry push' command"
18+
kubectl apply -f tests/workloads-pushed-using-spin-registry-push
19+
else
20+
echo "deploying spin apps pushed to registry using 'docker build && k3d image import' command"
21+
kubectl apply -f tests/workloads-pushed-using-docker-build-push
22+
fi
1723

1824
# wait for all the pods to be ready
1925
kubectl wait --for=condition=ready --timeout=50s pod --all

scripts/run-integration-tests.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
## Deploy workloads into k3d cluster
6+
if [ "$1" == "workloads-pushed-using-spin-registry-push" ]; then
7+
make deploy-workloads-pushed-using-spin-registry-push
8+
else
9+
make deploy-workloads-pushed-using-docker-build-push
10+
fi
11+
12+
13+
14+
## Verify pods can be terminated successfully
15+
make pod-terminates-test
16+
17+
## Run integration tests
18+
cargo test -p containerd-shim-spin-tests -- --nocapture
19+
20+
## tests done, cleanup workloads for next test
21+
make teardown-workloads

scripts/teardown-workloads.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
kubectl delete -f tests/workloads-common --wait --timeout 60s --ignore-not-found=true
6+
kubectl delete -f tests/workloads-pushed-using-docker-build-push --wait --timeout 60s --ignore-not-found=true
7+
kubectl delete -f tests/workloads-pushed-using-spin-registry-push --wait --timeout 60s --ignore-not-found=true
8+
kubectl wait pod --for=delete -l app=wasm-spin -l app=spin-keyvalue -l app=spin-outbound-redis -l app=spin-multi-trigger-app --timeout 60s

scripts/workloads.sh

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder has yaml file to apply workloads which are built using `docker build` and imported into k3d cluster using `k3d image import` command.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder has yaml file to apply workloads which are built using `spin build` and pushed to a registry, managed with k3d in CI, using `spin registry push` command.

0 commit comments

Comments
 (0)