Skip to content

Commit

Permalink
DRY up the e2e/docker-{run,test}.sh scripts into just e2e/docker.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Normore committed Jul 22, 2019
1 parent 072db22 commit 38f3e71
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 48 deletions.
4 changes: 2 additions & 2 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ It may be run either locally or on the CI.

## usage

The easiest way to run the end-to-end test is to execute `e2e.sh`. It requires the following environment variables to be set:
The easiest way to run the end-to-end test is to execute `docker.sh test`. It requires the following environment variables to be set or available in a `.env` file:

- `DIGITALOCEAN_ACCESS_TOKEN`: the DigitalOcean access token
- `KOPS_REGION`: the DigitalOcean region (e.g., _sfo2_)
Expand All @@ -25,6 +25,6 @@ The following environment parameters are optional:

## resource cleanup

The end-to-end tests clean up resources used on the DigitalOcean cloud after themselves on completion (either successful or erroneous). In the case that teardown does not complete for whatever reason (say, because of a crash of the tests or resources being in an irreparable state), the `cleanup-resources.sh` script can be used to remove the resources explicitly.
The end-to-end tests clean up resources used on the DigitalOcean cloud after themselves on completion (either successful or erroneous). In the case that teardown does not complete for whatever reason (say, because of a crash of the tests or resources being in an irreparable state), the `docker.sh clean` script can be used to remove the resources explicitly.

See the script's header for details.
45 changes: 0 additions & 45 deletions e2e/docker-clean.sh

This file was deleted.

13 changes: 12 additions & 1 deletion e2e/docker-run.sh → e2e/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ set -o errexit
set -o pipefail
set -o nounset

COMMAND=${1:-}
TARGET_SCRIPT=$(case "${COMMAND}" in
(test) echo "e2e.sh";;
(clean) echo "scripts/cleanup-resources.sh";;
esac)

if [ -z "${TARGET_SCRIPT}" ]; then
echo "usage: docker.sh test|clean"
exit 1
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_DIR="${SCRIPT_DIR}/.."

Expand All @@ -42,5 +53,5 @@ PROJECT_DIR="${SCRIPT_DIR}/.."
-e KOPS_CLUSTER_NAME \
${DOCKER_RUN_ARGS} \
do-ccm-e2e \
./e2e/e2e.sh
e2e/${TARGET_SCRIPT}
)

0 comments on commit 38f3e71

Please sign in to comment.