Skip to content

Commit f760d23

Browse files
committed
add a new target to invoke tests using conu library
Required-by: s2i-ruby-container#167 Signed-off-by: Tomas Tomecek <[email protected]>
1 parent 6e0d445 commit f760d23

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ Depends on `tag` as some tests might need to have the images tagged (s2i).
3838
Similar to `make test` but runs testsuite for Openshift, expected to be found at
3939
`$gitroot/$version/test/run-openshift`
4040

41+
`make test-with-conu`
42+
The rule is similar to `make test`. It runs a test suite written using [conu
43+
library](https://github.com/user-cont/conu). The path to the test script is
44+
meant to be at `$gitroot/$version/test/run-conu`. By default the test suite is
45+
being run in the current environment. You can also run the tests in a container
46+
by defining variable `CONU_IMAGE`. Container images with conu are available in
47+
[this docker hub repository](docker.io/usercont/conu:0.6.2), a good value for
48+
the variable is `docker.io/usercont/conu:0.6.2`.
49+
4150
`make clean`
4251
Runs scripts that clean-up the working dir. Depends on the `clean-images` rule by default
4352
and additional clean rules can be provided through the `clean-hook` variable.

common.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ test: script_env += TEST_MODE=true
8787
test: tag
8888
VERSIONS="$(VERSIONS)" $(script_env) $(test)
8989

90+
.PHONY: test-with-conu
91+
test-with-conu: script_env += TEST_CONU_MODE=true
92+
test-with-conu: tag
93+
VERSIONS="$(VERSIONS)" $(script_env) $(test)
94+
9095
.PHONY: test-openshift
9196
test-openshift: script_env += TEST_OPENSHIFT_MODE=true
9297
test-openshift: tag

test.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,32 @@ for dir in ${VERSIONS}; do
1919
VERSION=$dir test/run
2020
fi
2121

22+
if [ -n "${TEST_CONU_MODE}" ]; then
23+
if [[ -x test/run-conu ]]; then
24+
if [ -n "$CONU_IMAGE" ]; then
25+
docker run \
26+
--net=host \
27+
-e VERSION=$dir \
28+
-e IMAGE_NAME \
29+
--rm -v /dev:/dev:ro \
30+
-v /var/lib/docker:/var/lib/docker:ro \
31+
--security-opt label=disable \
32+
--cap-add SYS_ADMIN \
33+
-ti \
34+
-v /var/run/docker.sock:/var/run/docker.sock \
35+
-v ${PWD}/../:/src \
36+
-w /src/${dir}/ \
37+
-ti \
38+
$CONU_IMAGE \
39+
./test/run-conu
40+
else
41+
VERSION=$dir ./test/run-conu
42+
fi
43+
else
44+
echo "-> conu tests are not present, skipping"
45+
fi
46+
fi
47+
2248
if [ -n "${TEST_OPENSHIFT_MODE}" ]; then
2349
if [[ -x test/run-openshift ]]; then
2450
VERSION=$dir test/run-openshift

0 commit comments

Comments
 (0)