From 5273d7ea9678ff45e2ced0746be6ea1de069844c Mon Sep 17 00:00:00 2001 From: Sasha Klizhentas Date: Fri, 15 Jun 2018 15:05:15 -0700 Subject: [PATCH] Add support for running tests in K8s --- Makefile | 5 +++++ build.assets/Makefile | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e174bda5b1a57..1dcf421bc92f0 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,10 @@ PAMFLAGS = -tags pam PAM_MESSAGE = "Building Teleport with PAM support." endif +KUBECONFIG ?= +TEST_KUBE ?= +export + # # 'make all' builds all 3 executables and plaaces them in a current directory # @@ -136,6 +140,7 @@ test: $(VERSRC) # .PHONY: integration integration: + @echo KUBECONFIG is: $(KUBECONFIG), TEST_KUBE: $(TEST_KUBE) go test $(PAMFLAGS) -v ./integration/... -check.v # This rule triggers re-generation of version.go and gitref.go if Makefile changes diff --git a/build.assets/Makefile b/build.assets/Makefile index 63bc4cf22e079..50768885c575d 100644 --- a/build.assets/Makefile +++ b/build.assets/Makefile @@ -9,9 +9,17 @@ DOCSDIR=/teleport HOSTNAME=buildbox SRCDIR=/gopath/src/github.com/gravitational/teleport -DOCKERFLAGS=--rm=true -v "$$(pwd)/../":$(SRCDIR) -v /tmp:/tmp -w $(SRCDIR) -h $(HOSTNAME) +DOCKERFLAGS := --rm=true -v "$$(pwd)/../":$(SRCDIR) -v /tmp:/tmp -w $(SRCDIR) -h $(HOSTNAME) ADDFLAGS=-ldflags -w NOROOT=-u $$(id -u):$$(id -g) +KUBECONFIG ?= +TEST_KUBE ?= + +ifneq ("$(KUBECONFIG)","") +DOCKERFLAGS := $(DOCKERFLAGS) -v $(KUBECONFIG):/mnt/kube/config -e KUBECONFIG=/mnt/kube/config -e TEST_KUBE=$(TEST_KUBE) +endif +export + # # Build 'teleport' release inside a docker container @@ -70,7 +78,7 @@ test: bbox .PHONY:integration integration: bbox docker run $(DOCKERFLAGS) $(NOROOT) -t $(BBOX) \ - /bin/bash -c "make -C $(SRCDIR) FLAGS='-cover' integration" + /bin/bash -c "make -C $(SRCDIR) FLAGS='-cover' integration" # # Builds docs