Skip to content

Commit

Permalink
Try running controller in e2e test:
Browse files Browse the repository at this point in the history
  • Loading branch information
barney-s committed Feb 12, 2020
1 parent d8dce85 commit ec37717
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ test: $(TOOLBIN)/etcd $(TOOLBIN)/kube-apiserver $(TOOLBIN)/kubectl
# Run e2e-tests
.PHONY: e2e-test
e2e-test: generate fmt vet manifests $(TOOLBIN)/kind
BIN=$(TOOLBIN) ./e2e/test_e2e.sh
BIN=$(TOOLBIN) ./e2e/run_e2e_test.sh

## --------------------------------------
## Build and run
Expand All @@ -100,6 +100,11 @@ e2e-test: generate fmt vet manifests $(TOOLBIN)/kind
bin/manager: main.go generate fmt vet manifests
go build -o bin/manager main.go

# Run against the configured Kubernetes cluster in ~/.kube/config
.PHONY: runbg
runbg: generate fmt vet manifests
go run ./main.go >& controller.log & echo $$! > controller.pid

# Run against the configured Kubernetes cluster in ~/.kube/config
.PHONY: run
run: generate fmt vet manifests
Expand Down
16 changes: 9 additions & 7 deletions e2e/test_e2e.sh → e2e/run_e2e_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
# Copyright 2020 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0



set -o errexit
set -o nounset
set -o pipefail

# remove running containers on exit
function cleanup() {
kill `cat controller.pid`
${BIN}/kind delete cluster
cat controller.log
}


K8S_VERSION="v1.16.4"

export KUBECONFIG="$(${BIN}/kind get kubeconfig-path --name="kind")"
# image supported version are listed at https://hub.docker.com/r/kindest/node/tags
${BIN}/kind create cluster -v 4 --retain --wait=1m --config e2e/kind-config.yaml --image=kindest/node:$K8S_VERSION

# remove running containers on exit
function cleanup() {
${BIN}/kind delete cluster
}
make runbg

trap cleanup EXIT

Expand Down

0 comments on commit ec37717

Please sign in to comment.