Stop using build to run the tests, allow using podman

To use podman run the tests like this:
DOCKER=podman make test-in-docker

This now builds the welder/lorax-tests image as a separate step from
running the tests.

Running the tests uses the welder/lorax-tests image and mounts the
source directory read-only, copies it into /lorax-test/ and runs the
tests from there.

(cherry picked from commit 8a26d0648e)
This commit is contained in:
Brian C. Lane 2018-10-30 12:24:19 -07:00
parent a2797e8f1b
commit 4c71adadd5
2 changed files with 11 additions and 12 deletions

View File

@ -1,5 +1,4 @@
FROM registry.fedoraproject.org/fedora:29
RUN dnf -y install \
anaconda-tui \
libgit2-glib \
@ -22,15 +21,8 @@ RUN dnf -y install \
beakerlib \
sudo \
tito \
rsync \
which
RUN useradd weldr
RUN mkdir /lorax
COPY . /lorax
# remove byte-compiled files to avoid issues between Python 2/3
# this can happen when you switch between rhel7 and master branches
RUN find /lorax -name "*.pyc" -exec rm -f {} \;
VOLUME /lorax
WORKDIR /lorax
RUN make check test

View File

@ -2,12 +2,14 @@ PYTHON ?= /usr/bin/python3
DESTDIR ?= /
PREFIX ?= /usr
mandir ?= $(PREFIX)/share/man
DOCKER ?= docker
PKGNAME = lorax
VERSION = $(shell awk '/Version:/ { print $$2 }' $(PKGNAME).spec)
RELEASE = $(shell awk '/Release:/ { print $$2 }' $(PKGNAME).spec | sed -e 's|%.*$$||g')
TAG = lorax-$(VERSION)-$(RELEASE)
IMAGE_RELEASE = $(shell awk -F: '/FROM/ { print $$2}' Dockerfile.test)
default: all
@ -74,11 +76,16 @@ local:
@rm -rf /var/tmp/$(PKGNAME)-$(VERSION)
@echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
test-in-copy:
rsync -aP --exclude=.git /lorax/ /lorax-test/
make -C /lorax-test/ check test
test-in-docker:
sudo docker build -t welder/lorax:latest -f Dockerfile.test .
sudo $(DOCKER) build -t welder/lorax-tests:$(IMAGE_RELEASE) -f Dockerfile.test .
sudo $(DOCKER) run --rm -it -v `pwd`:/lorax:ro --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make test-in-copy
docs-in-docker:
sudo docker run -it --rm -v `pwd`/docs/html/:/lorax/docs/html/ --security-opt label=disable welder/lorax-composer:latest make docs
sudo $(DOCKER) run -it --rm -v `pwd`/docs/html/:/lorax/docs/html/ --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make docs
ci: check test