Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit db32bd8

Browse files
author
David Chung
authored
e2e testing scripts clean-up (#359)
Signed-off-by: David Chung <[email protected]>
1 parent 9a16aaf commit db32bd8

File tree

6 files changed

+22
-136
lines changed

6 files changed

+22
-136
lines changed

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ ifeq (${DISABLE_OPTIMIZATION},true)
1414
VERSION:="$(VERSION)-noopt"
1515
endif
1616

17-
.PHONY: clean all fmt vet lint build test vendor-update containers check-docs tutorial-test get-tools
17+
.PHONY: clean all fmt vet lint build test vendor-update containers check-docs e2e-test get-tools
1818
.DEFAULT: all
1919
all: clean fmt vet lint build test binaries
2020

21-
ci: fmt vet lint check-docs coverage tutorial-test
21+
ci: fmt vet lint check-docs coverage e2e-test
2222

2323
AUTHORS: .mailmap .git/HEAD
2424
git log --format='%aN <%aE>' | sort -fu > $@
@@ -50,8 +50,8 @@ build-docker:
5050
@docker build ${DOCKER_BUILD_FLAGS} \
5151
-t ${DOCKER_IMAGE}:${DOCKER_TAG} \
5252
-f ${CURDIR}/dockerfiles/Dockerfile.bundle .
53-
@echo "Running tests -- scripts/container-test to verify the binaries"
54-
@scripts/container-test
53+
@echo "Running tests -- scripts/e2e-test-docker-containers.sh to verify the binaries"
54+
@scripts/e2e-test-docker-containers.sh
5555
ifeq (${DOCKER_PUSH},true)
5656
@docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
5757
ifeq (${DOCKER_TAG_LATEST},true)
@@ -141,9 +141,9 @@ coverage:
141141
go test -test.short -race -coverprofile="../../../$$pkg/coverage.txt" $${pkg} || exit 1; \
142142
done
143143

144-
tutorial-test: binaries
144+
e2e-test: binaries
145145
@echo "+ $@"
146-
./scripts/tutorial-test2
146+
./scripts/e2e-test.sh
147147

148148
test-full:
149149
@echo "+ $@"

circle.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ machine:
99
GOVERSION: "1.7"
1010
GOPATH: "$HOME/.go_workspace"
1111
WORKDIR: "$GOPATH/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
12-
DOCKER_RM: "false"
13-
SKIP_CLEANUP: "true"
12+
E2E_CLEANUP: "false"
1413

1514
dependencies:
1615
pre:

scripts/container-test renamed to scripts/e2e-test-docker-containers.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ cd "$HERE/.."
1010
TEST_DIR=$(pwd)/container-test
1111
DOCKER_IMAGE="${DOCKER_IMAGE:-infrakit/devbundle}"
1212
DOCKER_TAG="${DOCKER_TAG:-dev}"
13-
DOCKER_RM="${DOCKER_RM:-true}"
13+
E2E_CLEANUP=${E2E_CLEANUP:-true}
1414

1515
cleanup() {
16-
if [ "$DOCKER_RM" = "true" ]; then
16+
if [ "$E2E_CLEANUP" = "true" ]; then
1717
echo "cleaning up docker images"
1818
docker ps -a | grep devbundle | awk '{print $1}' | xargs docker stop
1919
docker ps -a | grep devbundle | awk '{print $1}' | xargs docker rm
@@ -23,14 +23,19 @@ cleanup() {
2323
trap cleanup EXIT
2424

2525
# set up the directories
26-
27-
mkdir -p $TEST_DIR/plugins
26+
plugins=$TEST_DIR/plugins
27+
mkdir -p $plugins
28+
rm -rf $plugins/*
2829

2930
configstore=$TEST_DIR/configs
3031
mkdir -p $configstore
32+
rm -rf $configstore/*
3133

3234
mkdir -p $TEST_DIR/tutorial
35+
rm -rf $TEST_DIR/tutorial/*
36+
3337

38+
# bind mounts
3439
volumes="-v $TEST_DIR:/root -v $PWD/docs:/root/docs"
3540

3641
# set the environment variable to use a shorter path so we don't have
File renamed without changes.

scripts/tutorial-test2 renamed to scripts/e2e-test.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,20 @@ cd "$HERE/.."
88

99
export PATH=$PWD/build:$PATH
1010

11-
SKIP_CLEANUP=${SKIP_CLEANUP:-false}
11+
E2E_CLEANUP=${E2E_CLEANUP:-true}
1212

1313
starterpid="" # pid of the cli plugin starter
1414
cleanup() {
15+
if [ "$E2E_CLEANUP" = "true" ]; then
1516
pgid=$(ps -o pgid= -p $starterpid)
1617
echo "Stopping plugin starter utility - $starterpid , pgid=$pgid"
1718
kill -TERM -$pgid
1819
echo "Stopping other jobs"
1920
kill $(jobs -p)
2021
rm -rf tutorial
22+
fi
2123
}
22-
23-
if [ "$SKIP_CLEANUP" != "true" ]; then
24-
trap cleanup EXIT
25-
fi
24+
trap cleanup EXIT
2625

2726
# infrakit directories
2827
plugins=~/.infrakit/plugins
@@ -50,7 +49,7 @@ sleep 5 # manager needs to detect leadership
5049
LOG_DIR=~/.infrakit/logs
5150
mkdir -p $LOG_DIR
5251

53-
# see the config josn 'tutorial-start-plugins.json' for reference of environment variable TUTORIAL_DIR
52+
# see the config josn 'e2e-test-plugins.json' for reference of environment variable TUTORIAL_DIR
5453
TUTORIAL_DIR=~/.infrakit/tutorial
5554
mkdir -p $TUTORIAL_DIR
5655
rm -rf $TUTORIAL_DIR/*
@@ -59,7 +58,7 @@ export LOG_DIR=$LOG_DIR
5958
export TUTORIAL_DIR=$TUTORIAL_DIR
6059

6160
# note -- on exit, this won't clean up the plugins started by the cli since they will be in a separate process group
62-
infrakit plugin start --wait --config-url file:///$PWD/scripts/tutorial-start-plugins.json --os group-default instance-file flavor-vanilla &
61+
infrakit plugin start --wait --config-url file:///$PWD/scripts/e2e-test-plugins.json --os group-default instance-file flavor-vanilla &
6362

6463
starterpid=$!
6564
echo "plugin start pid=$starterpid"

scripts/tutorial-test

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)