From 12440334ce30874548da0614c3e0d9514ac53046 Mon Sep 17 00:00:00 2001 From: Tomas Tomecek Date: Tue, 20 Feb 2018 16:08:47 +0100 Subject: [PATCH] add a new target to invoke tests using conu library Required-by: s2i-ruby-container#167 Signed-off-by: Tomas Tomecek --- README.md | 9 +++++++++ common.mk | 5 +++++ test.sh | 25 +++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/README.md b/README.md index 9bc1110e..326b798f 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,15 @@ Depends on `tag` as some tests might need to have the images tagged (s2i). Similar to `make test` but runs testsuite for Openshift, expected to be found at `$gitroot/$version/test/run-openshift` +`make test-with-conu` +The rule is similar to `make test`. It runs a test suite written using [conu +library](https://github.com/user-cont/conu). The path to the test script is +meant to be at `$gitroot/$version/test/run-conu`. By default the test suite is +being run in the current environment. You can also run the tests in a container +by defining variable `CONU_IMAGE`. Container images with conu are available in +[this docker hub repository](docker.io/usercont/conu:0.6.2), a good value for +the variable is `docker.io/usercont/conu:0.6.2`. + `make clean` Runs scripts that clean-up the working dir. Depends on the `clean-images` rule by default and additional clean rules can be provided through the `clean-hook` variable. diff --git a/common.mk b/common.mk index 8f2ba61d..305185a9 100644 --- a/common.mk +++ b/common.mk @@ -87,6 +87,11 @@ test: script_env += TEST_MODE=true test: tag VERSIONS="$(VERSIONS)" $(script_env) $(test) +.PHONY: test-with-conu +test-with-conu: script_env += TEST_CONU_MODE=true +test-with-conu: tag + VERSIONS="$(VERSIONS)" $(script_env) $(test) + .PHONY: test-openshift test-openshift: script_env += TEST_OPENSHIFT_MODE=true test-openshift: tag diff --git a/test.sh b/test.sh index 9c406818..ab40daff 100755 --- a/test.sh +++ b/test.sh @@ -19,6 +19,31 @@ for dir in ${VERSIONS}; do VERSION=$dir test/run fi + if [ -n "${TEST_CONU_MODE}" ]; then + if [[ -x test/run-conu ]]; then + if [ -n "${CONU_IMAGE}" ]; then + echo "-> Running conu tests in a container" + docker run \ + --net=host \ + -e VERSION="${dir}" \ + -e IMAGE_NAME \ + --rm \ + --security-opt label=disable \ + -ti \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v ${PWD}/../:/src \ + -w "/src/${dir}/" \ + -ti \ + "${CONU_IMAGE}" \ + ./test/run-conu + else + VERSION="${dir}" ./test/run-conu + fi + else + echo "-> conu tests are not present, skipping" + fi + fi + if [ -n "${TEST_OPENSHIFT_MODE}" ]; then if [[ -x test/run-openshift ]]; then VERSION=$dir test/run-openshift