Skip to content

Commit

Permalink
Add support for running tests in K8s
Browse files Browse the repository at this point in the history
  • Loading branch information
klizhentas committed Jun 15, 2018
1 parent c6d2994 commit 5273d7e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Makefile
Expand Up @@ -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
#
Expand Down Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions build.assets/Makefile
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5273d7e

Please sign in to comment.