tests: Add RUN_TESTS to Makefile so you can pass in targets

Also add a test_cli target to run things like the blueprint cli tests.
Run this like so:

RUN_TESTS="ci test_cli" make test-in-docker

If nothing is passed it will run the "ci" target.
This commit is contained in:
Brian C. Lane 2019-06-24 11:19:12 -07:00 committed by Lars Karlitski
parent f1733369fa
commit 7ff4d7ac9e
1 changed files with 9 additions and 2 deletions

View File

@ -4,6 +4,7 @@ PREFIX ?= /usr
mandir ?= $(PREFIX)/share/man
DOCKER ?= docker
DOCS_VERSION ?= next
RUN_TESTS ?= ci
PKGNAME = lorax
VERSION = $(shell awk '/Version:/ { print $$2 }' $(PKGNAME).spec)
@ -73,6 +74,9 @@ test_openstack:
test_vmware:
sudo -E ./tests/test_cli.sh tests/cli/test_build_and_deploy_vmware.sh
test_cli:
sudo -E ./tests/test_cli.sh
clean_cloud_envs:
# clean beakerlib logs from previous executions
sudo rm -rf /var/tmp/beakerlib-*/
@ -122,13 +126,16 @@ local:
test-in-copy:
rsync -aP --exclude=.git /lorax-ro/ /lorax/
make -C /lorax/ ci
make -C /lorax/ $(RUN_TESTS)
cp /lorax/.coverage /test-results/
test-in-docker:
sudo $(DOCKER) build -t welder/lorax-tests:$(IMAGE_RELEASE) -f Dockerfile.test .
@mkdir -p `pwd`/.test-results
sudo $(DOCKER) run --rm -it -v `pwd`/.test-results/:/test-results -v `pwd`:/lorax-ro:ro --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make test-in-copy
sudo $(DOCKER) run --rm -it -v `pwd`/.test-results/:/test-results \
-v `pwd`:/lorax-ro:ro --security-opt label=disable \
--env RUN_TESTS="$(RUN_TESTS)" \
welder/lorax-tests:$(IMAGE_RELEASE) make test-in-copy
docs-in-docker:
sudo $(DOCKER) run -it --rm -v `pwd`:/lorax-ro:ro \