Skip to content

Commit 8883c23

Browse files
committed
run cases.sh on kind in CI
This patch runs the cases.sh test cases in CI on a locally deployed kind cluster. Signed-off-by: Nathan Skrzypczak <[email protected]>
1 parent 06b112a commit 8883c23

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

.ci/buildspec.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,21 @@ phases:
3232
- make clean-vpp
3333
- make images
3434

35+
# run linting and go tests
3536
- make mdlint
3637
- make ci-lint
3738
- make ci-test
3839
- make ci-cov
3940

41+
# Publish image, even if they are not fine
42+
# as this helps reproducing
4043
- make push
4144

45+
# Run integration tests (kind & e2e)
46+
- make kind
47+
- make test-e2e
48+
- make kind-rm-cluster
49+
4250
post_build:
4351
commands:
4452
- echo Build completed on `date`

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,18 @@ restart-calicovpp:
181181
kubectl -n calico-vpp-dataplane rollout restart ds/calico-vpp-node
182182
kubectl -n calico-vpp-dataplane rollout status ds/calico-vpp-node
183183

184+
# Make sure we are running against a kind cluster, as the tests will
185+
# try to break dataplane
186+
.PHONY: validate-kind
187+
validate-kind:
188+
test -n "$(shell kubectl config current-context | grep '^kind-')" || test -n "$(FORCE)"
189+
190+
# test-e2e run repo local end to end test of calico VPP,
191+
# making sure basic connectivity, DNS and services work
192+
# This requires a running cluser. e.g. 'make kind'
193+
.PHONY: test-e2e
194+
test-e2e: validate-kind run-tests run-tests-v6 restart-calicovpp
195+
184196
.PHONY: goapi
185197
export VPP_DIR ?= $(shell pwd)/vpp-manager/vpp_build
186198
goapi:
@@ -236,10 +248,6 @@ release: check-TAG check-CALICO_TAG
236248
@echo "Calico version \"v3.27.0\", the directory would be \"calico_versioned_docs/version-3.27\". If this is not done,"
237249
@echo "the install docs get broken!!"
238250

239-
.PHONY: run-integration-tests
240-
run-integration-tests:
241-
$(MAKE) -C test/integration-tests $@
242-
243251
.PHONY: test-memif-multinet
244252
test-memif-multinet:
245253
kubectl apply -f test/yaml/multinet/network.yaml

common.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,4 @@ ifeq (${CODEBUILD_WEBHOOK_TRIGGER},branch/master)
5656
endif
5757

5858
CLUSTER_NAME ?= kind-$(shell whoami)-$(shell git describe --always --abbrev=4)
59+
KIND ?= go run sigs.k8s.io/[email protected]

test/kind/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ DEBUG ?= false
99

1010
.PHONY: new-cluster
1111
new-cluster:
12-
@N_KIND_WORKERS=$(N_KIND_WORKERS) \
12+
N_KIND_WORKERS=$(N_KIND_WORKERS) \
1313
N_KIND_CONTROL_PLANES=$(N_KIND_CONTROL_PLANES) \
1414
CPU_PINNING=$(CPU_PINNING) \
1515
CLUSTER_NAME=$(CLUSTER_NAME) \
16+
KIND="$(KIND)" \
1617
./new_cluster.sh
1718
mkdir -p $(HOME)/.kube
18-
kind get kubeconfig --name $(CLUSTER_NAME) > $(HOME)/.kube/config
19+
$(KIND) get kubeconfig --name $(CLUSTER_NAME) > $(HOME)/.kube/config
1920

2021
.PHONY: install-cni
2122
install-cni:
@@ -24,7 +25,7 @@ install-cni:
2425

2526
.PHONY: rm-cluster
2627
rm-cluster:
27-
kind delete cluster --name $(CLUSTER_NAME)
28+
$(KIND) delete cluster --name $(CLUSTER_NAME)
2829

2930
.PHONY: dev
3031
dev:

test/kind/new_cluster.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -o errexit
33

4-
if [[ $(kind get clusters | grep -E '^'${CLUSTER_NAME}'$') == "${CLUSTER_NAME}" ]]; then
4+
if [[ $(${KIND} get clusters | grep -E '^'${CLUSTER_NAME}'$') == "${CLUSTER_NAME}" ]]; then
55
echo "Cluster kind already exists"
66
exit 0
77
fi
@@ -88,7 +88,7 @@ fi
8888
done
8989
# use cpuSet in the case of a patched kind version like in scale tests (test/scale/README.md)
9090

91-
echo -e "$config" | kind create cluster --config=-
91+
echo -e "$config" | ${KIND} create cluster --config=-
9292

9393
# connect the registry to the cluster network if not already connected
9494
if [ "$(docker inspect -f='{{json .NetworkSettings.Networks.kind}}' "${reg_name}")" = 'null' ]; then

0 commit comments

Comments
 (0)