Skip to content

Commit a884380

Browse files
author
Ian Campbell
committed
test: Basic build tests for all 4 combinations of runtime/network.
{docker,cri} × {bridge,weave} Needs a top-level Makefile hook to control the output directory. Signed-off-by: Ian Campbell <ijc@docker.com>
1 parent 049cf07 commit a884380

File tree

9 files changed

+133
-2
lines changed

9 files changed

+133
-2
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ endif
1111

1212
KUBE_FORMAT_ARGS := $(patsubst %,-format %,$(KUBE_FORMATS))
1313

14+
KUBE_BASENAME ?= kube-
15+
1416
.PHONY: all master node
1517
all: master node
1618

1719
master: yml/kube.yml yml/$(KUBE_RUNTIME).yml yml/$(KUBE_RUNTIME)-master.yml yml/$(KUBE_NETWORK).yml
18-
linuxkit $(LINUXKIT_ARGS) build $(LINUXKIT_BUILD_ARGS) -name kube-master $(KUBE_FORMAT_ARGS) $^
20+
linuxkit $(LINUXKIT_ARGS) build $(LINUXKIT_BUILD_ARGS) -name $(KUBE_BASENAME)master $(KUBE_FORMAT_ARGS) $^
1921

2022
node: yml/kube.yml yml/$(KUBE_RUNTIME).yml yml/$(KUBE_NETWORK).yml
21-
linuxkit $(LINUXKIT_ARGS) build $(LINUXKIT_BUILD_ARGS) -name kube-node $(KUBE_FORMAT_ARGS) $^
23+
linuxkit $(LINUXKIT_ARGS) build $(LINUXKIT_BUILD_ARGS) -name $(KUBE_BASENAME)node $(KUBE_FORMAT_ARGS) $^
2224

2325
yml/weave.yml: kube-weave.yaml
2426

test/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_results
2+
cases/_tmp
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
# SUMMARY: build and boot using cri-containerd runtime and Bridged networking
3+
# LABELS:
4+
5+
runtime=cri-containerd
6+
network=bridge
7+
8+
# Doesn't return
9+
. ../common.sh
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
# SUMMARY: build and boot using cri-containerd runtime and Weave networking
3+
# LABELS:
4+
5+
runtime=cri-containerd
6+
network=weave
7+
8+
# Doesn't return
9+
. ../common.sh
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
# SUMMARY: build and boot using Docker runtime and Bridged networking
3+
# LABELS:
4+
5+
runtime=docker
6+
network=bridge
7+
8+
# Doesn't return
9+
. ../common.sh
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
# SUMMARY: build and boot using Docker runtime and Weave networking
3+
# LABELS:
4+
5+
runtime=docker
6+
network=weave
7+
8+
# Doesn't return
9+
. ../common.sh

test/cases/000_smoke/common.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# To be sourced by */test.sh
2+
3+
set -e
4+
5+
# Source libraries. Uncomment if needed/defined
6+
#. "${RT_LIB}"
7+
#. "${RT_PROJECT_ROOT}/_lib/lib.sh"
8+
9+
if [ "x$runtime" = "x" ] || [ "x$network" = "x" ] ; then
10+
echo "common.sh requires \$runtime and \$network" >&2
11+
exit 1
12+
fi
13+
14+
clean_up() {
15+
rm -f kube-master.iso
16+
}
17+
18+
trap clean_up EXIT
19+
20+
export KUBE_RUNTIME=$runtime
21+
export KUBE_NETWORK=$network
22+
export LINUXKIT_BUILD_ARGS="--disable-content-trust"
23+
export KUBE_BASENAME="`pwd`/kube-"
24+
make -C ${RT_PROJECT_ROOT}/../../ master
25+
26+
exit 0

test/cases/000_smoke/group.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
# SUMMARY: Basic build and run smoke tests
3+
# LABELS:
4+
5+
group_init() {
6+
# Group initialisation code goes here
7+
return 0
8+
}
9+
10+
group_deinit() {
11+
# Group de-initialisation code goes here
12+
return 0
13+
}
14+
15+
CMD=$1
16+
case $CMD in
17+
init)
18+
group_init
19+
res=$?
20+
;;
21+
deinit)
22+
group_deinit
23+
res=$?
24+
;;
25+
*)
26+
res=1
27+
;;
28+
esac
29+
30+
exit $res
31+

test/cases/group.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
# NAME: kubernetes
3+
# SUMMARY: LinuxKit/Kubernetes regression tests
4+
5+
# Source libraries. Uncomment if needed/defined
6+
# . "${RT_LIB}"
7+
#. "${RT_PROJECT_ROOT}/_lib/lib.sh"
8+
9+
group_init() {
10+
# Group initialisation code goes here
11+
return 0
12+
}
13+
14+
group_deinit() {
15+
# Group de-initialisation code goes here
16+
return 0
17+
}
18+
19+
CMD=$1
20+
case $CMD in
21+
init)
22+
group_init
23+
res=$?
24+
;;
25+
deinit)
26+
group_deinit
27+
res=$?
28+
;;
29+
*)
30+
res=1
31+
;;
32+
esac
33+
34+
exit $res

0 commit comments

Comments
 (0)