Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 0520bdf

Browse files
committed
hack: add conformance tests for hack builds
1 parent c3153f6 commit 0520bdf

File tree

6 files changed

+84
-2
lines changed

6 files changed

+84
-2
lines changed

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ pkg/asset/internal/templates.go: $(GOFILES)
3030
mkdir -p $(dir $@)
3131
go generate pkg/asset/templates_gen.go
3232

33+
#TODO(aaron): Prompt because this is destructive
34+
conformance-%: clean all
35+
@cd hack/$*-node && vagrant destroy -f
36+
@cd hack/$*-node && rm -rf cluster
37+
@cd hack/$*-node && ./bootkube-up
38+
@sleep 30 # Give addons a little time to start
39+
@cd hack/$*-node && ./conformance-test.sh
40+
3341
vendor-$(VENDOR_VERSION):
3442
@echo "Creating k8s vendor dir: $@"
3543
@mkdir -p $@/k8s.io/kubernetes

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,22 @@ And optionally, to install into $GOPATH/bin:
6565
make install
6666
```
6767

68+
## Conformance Tests
69+
70+
This repository includes scripts for running the Kubernetes conformance tests agains the [hack/single-node](hack/single-node) and [hack/multi-node](hack/multi-node) launched clusters.
71+
72+
To run the conformance tests:
73+
74+
```
75+
make conformance-single
76+
```
77+
78+
or
79+
80+
```
81+
make conformance-multi
82+
```
83+
6884
## License
6985

7086
bootkube is under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.

hack/multi-node/Vagrantfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Vagrant.require_version ">= 1.6.0"
1010

1111
$update_channel = "alpha"
1212
$controller_count = 1
13-
$controller_vm_memory = 1024
13+
$controller_vm_memory = 2048
1414
$worker_count = 1
15-
$worker_vm_memory = 1024
15+
$worker_vm_memory = 512
1616
$etcd_count = 1
1717
$etcd_vm_memory = 512
1818

hack/multi-node/conformance-test.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
ssh_key="$(vagrant ssh-config c1 | awk '/IdentityFile/ {print $2}' | tr -d '"')"
5+
ssh_port="$(vagrant ssh-config c1 | awk '/Port [0-9]+/ {print $2}')"
6+
7+
../tests/conformance-test.sh "127.0.0.1" "${ssh_port}" "${ssh_key}"

hack/single-node/conformance-test.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
ssh_key="$(vagrant ssh-config | awk '/IdentityFile/ {print $2}' | tr -d '"')"
5+
ssh_port="$(vagrant ssh-config | awk '/Port [0-9]+/ {print $2}')"
6+
7+
../tests/conformance-test.sh "127.0.0.1" "${ssh_port}" "${ssh_key}"

hack/tests/conformance-test.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
CONFORMANCE_VERSION=${CONFORMANCE_VERSION:-v1.2.4}
5+
6+
usage() {
7+
echo "USAGE:"
8+
echo " $0 <ssh-host> <ssh-port> <ssh-key>"
9+
echo
10+
exit 1
11+
}
12+
13+
if [ $# -ne 3 ]; then
14+
usage
15+
exit 1
16+
fi
17+
18+
ssh_host=$1
19+
ssh_port=$2
20+
ssh_key=$3
21+
22+
ssh -q -o stricthostkeychecking=no -i ${ssh_key} -p ${ssh_port} core@${ssh_host} \
23+
"mkdir -p /home/core/go/src/k8s.io/kubernetes && git clone https://github.com/kubernetes/kubernetes /home/core/go/src/k8s.io/kubernetes"
24+
25+
RKT_OPTS=$(echo \
26+
"--volume=kc,kind=host,source=/home/core/cluster/auth/kubeconfig "\
27+
"--volume=k8s,kind=host,source=/home/core/go/src/k8s.io/kubernetes " \
28+
"--mount volume=kc,target=/kubeconfig " \
29+
"--mount volume=k8s,target=/go/src/k8s.io/kubernetes")
30+
31+
# Init steps necessary to run conformance in docker://golang:1.6.2 container
32+
INIT="apt-get update && apt-get install -y rsync"
33+
34+
CONFORMANCE=$(echo \
35+
"cd /go/src/k8s.io/kubernetes && " \
36+
"git checkout ${CONFORMANCE_VERSION} && " \
37+
"make all WHAT=cmd/kubectl && " \
38+
"make all WHAT=github.com/onsi/ginkgo/ginkgo && " \
39+
"make all WHAT=test/e2e/e2e.test && " \
40+
"KUBECONFIG=/kubeconfig KUBERNETES_CONFORMANCE_TEST=Y hack/ginkgo-e2e.sh -ginkgo.focus='\[Conformance\]'")
41+
42+
CMD="sudo rkt run --insecure-options=image ${RKT_OPTS} docker://golang:1.6.2 --exec /bin/bash -- -c \"${INIT} && ${CONFORMANCE}\""
43+
44+
ssh -q -o stricthostkeychecking=no -i ${ssh_key} -p ${ssh_port} core@${ssh_host} "${CMD}"

0 commit comments

Comments
 (0)