Skip to content

Commit

Permalink
hack: add conformance tests for hack builds
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronlevy committed May 27, 2016
1 parent c3153f6 commit 0520bdf
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ pkg/asset/internal/templates.go: $(GOFILES)
mkdir -p $(dir $@)
go generate pkg/asset/templates_gen.go

#TODO(aaron): Prompt because this is destructive
conformance-%: clean all
@cd hack/$*-node && vagrant destroy -f
@cd hack/$*-node && rm -rf cluster
@cd hack/$*-node && ./bootkube-up
@sleep 30 # Give addons a little time to start
@cd hack/$*-node && ./conformance-test.sh

vendor-$(VENDOR_VERSION):
@echo "Creating k8s vendor dir: $@"
@mkdir -p $@/k8s.io/kubernetes
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ And optionally, to install into $GOPATH/bin:
make install
```

## Conformance Tests

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.

To run the conformance tests:

```
make conformance-single
```

or

```
make conformance-multi
```

## License

bootkube is under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.
4 changes: 2 additions & 2 deletions hack/multi-node/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Vagrant.require_version ">= 1.6.0"

$update_channel = "alpha"
$controller_count = 1
$controller_vm_memory = 1024
$controller_vm_memory = 2048
$worker_count = 1
$worker_vm_memory = 1024
$worker_vm_memory = 512
$etcd_count = 1
$etcd_vm_memory = 512

Expand Down
7 changes: 7 additions & 0 deletions hack/multi-node/conformance-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail

ssh_key="$(vagrant ssh-config c1 | awk '/IdentityFile/ {print $2}' | tr -d '"')"
ssh_port="$(vagrant ssh-config c1 | awk '/Port [0-9]+/ {print $2}')"

../tests/conformance-test.sh "127.0.0.1" "${ssh_port}" "${ssh_key}"
7 changes: 7 additions & 0 deletions hack/single-node/conformance-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail

ssh_key="$(vagrant ssh-config | awk '/IdentityFile/ {print $2}' | tr -d '"')"
ssh_port="$(vagrant ssh-config | awk '/Port [0-9]+/ {print $2}')"

../tests/conformance-test.sh "127.0.0.1" "${ssh_port}" "${ssh_key}"
44 changes: 44 additions & 0 deletions hack/tests/conformance-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
set -euo pipefail

CONFORMANCE_VERSION=${CONFORMANCE_VERSION:-v1.2.4}

usage() {
echo "USAGE:"
echo " $0 <ssh-host> <ssh-port> <ssh-key>"
echo
exit 1
}

if [ $# -ne 3 ]; then
usage
exit 1
fi

ssh_host=$1
ssh_port=$2
ssh_key=$3

ssh -q -o stricthostkeychecking=no -i ${ssh_key} -p ${ssh_port} core@${ssh_host} \
"mkdir -p /home/core/go/src/k8s.io/kubernetes && git clone https://github.com/kubernetes/kubernetes /home/core/go/src/k8s.io/kubernetes"

RKT_OPTS=$(echo \
"--volume=kc,kind=host,source=/home/core/cluster/auth/kubeconfig "\
"--volume=k8s,kind=host,source=/home/core/go/src/k8s.io/kubernetes " \
"--mount volume=kc,target=/kubeconfig " \
"--mount volume=k8s,target=/go/src/k8s.io/kubernetes")

# Init steps necessary to run conformance in docker://golang:1.6.2 container
INIT="apt-get update && apt-get install -y rsync"

CONFORMANCE=$(echo \
"cd /go/src/k8s.io/kubernetes && " \
"git checkout ${CONFORMANCE_VERSION} && " \
"make all WHAT=cmd/kubectl && " \
"make all WHAT=github.com/onsi/ginkgo/ginkgo && " \
"make all WHAT=test/e2e/e2e.test && " \
"KUBECONFIG=/kubeconfig KUBERNETES_CONFORMANCE_TEST=Y hack/ginkgo-e2e.sh -ginkgo.focus='\[Conformance\]'")

CMD="sudo rkt run --insecure-options=image ${RKT_OPTS} docker://golang:1.6.2 --exec /bin/bash -- -c \"${INIT} && ${CONFORMANCE}\""

ssh -q -o stricthostkeychecking=no -i ${ssh_key} -p ${ssh_port} core@${ssh_host} "${CMD}"

0 comments on commit 0520bdf

Please sign in to comment.