Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a way to run multiple test suites #67

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down