[tests] Enable handling of rel-eng images

In order to enable testing on rel-eng images, it's necessary to properly
change the way lorax-composer packages are installed (in Makefile and
vm.install script).

Related: rhbz#1810711
This commit is contained in:
Jiri Kortus 2020-03-05 19:51:57 +01:00 committed by Brian C. Lane
parent d4b40da130
commit d72a2b0c7b
3 changed files with 47 additions and 4 deletions

View File

@ -149,6 +149,20 @@ vm-local-repos: vm
--run-command "systemctl enable lorax-composer" \ --run-command "systemctl enable lorax-composer" \
$(TEST_OS) $(TEST_OS)
vm-releng:
rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2
bots/image-customize -v \
--resize 20G \
--upload $(CURDIR)/test/vm.install:/var/tmp/vm.install \
--upload $(realpath tests):/ \
--run-command "chmod +x /var/tmp/vm.install" \
--run-command "cd /var/tmp; BUILD_SRPM=0 /var/tmp/vm.install" \
$(TEST_OS)
[ -f ~/.config/lorax-test-env ] && bots/image-customize \
--upload ~/.config/lorax-test-env:/var/tmp/lorax-test-env \
$(TEST_OS) || echo
vm-reset: vm-reset:
rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2 rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2

View File

@ -49,6 +49,24 @@ You may also define `REPOS_DIR` variable to point to another directory
containing yum .repo files. By default the value is `/etc/yum.repos.d`! containing yum .repo files. By default the value is `/etc/yum.repos.d`!
This is mostly useful when running tests by hand on a downstream snapshot! This is mostly useful when running tests by hand on a downstream snapshot!
If you need to run the tests on a particular rel-eng RHEL compose, you can
create the image by using [image-create-rhel-compose](https://github.com/cockpit-project/bots/blob/master/image-create-rhel-compose)
script from bots repo. By default it uses the `-latest` extras rel-eng repo,
however its advisable to build the image using explicitly specified repos
using `COMPOSE` and `EXTRAS_COMPOSE` environment variables, for example:
$ export COMPOSE=”RHEL-7.x-yyyymmdd.b”
$ export EXTRAS_COMPOSE=”EXTRAS-7.x-RHEL-7-yyyymmdd.b”
$ bots/image-create-rhel-compose
This will provide you with a RHEL-7.x-yyyymmdd.b image with preconfigured
rel-eng repos. To perform the composer-specific setup as you would do by `make vm`
for a stock bots image, use
$ export TEST_OS=”rhel-7-x-yyyymmdd-b”
$ make vm-releng
## Running tests ## Running tests
After building a test image, run After building a test image, run

View File

@ -1,6 +1,11 @@
#!/bin/sh -eux #!/bin/sh -eux
# BUILD_SRPM serves as a flag whether we should build and install the composer packages
BUILD_SRPM=${BUILD_SRPM:-1}
if [ "$BUILD_SRPM" -eq 1 ]; then
SRPM="$1" SRPM="$1"
fi
# always remove older versions of these RPMs if they exist # always remove older versions of these RPMs if they exist
# to ensure newly built packages have been installed # to ensure newly built packages have been installed
@ -86,11 +91,17 @@ rootlv=$(findmnt --noheadings -oSOURCE /)
lvresize $rootlv -l+100%FREE -r lvresize $rootlv -l+100%FREE -r
rm -rf build-results rm -rf build-results
if [ "$BUILD_SRPM" -eq 1 ]; then
SRPM="$1"
su builder -c "/usr/bin/mock --no-clean --resultdir build-results --rebuild $SRPM" su builder -c "/usr/bin/mock --no-clean --resultdir build-results --rebuild $SRPM"
packages=$(find build-results -name '*.rpm' -not -name '*.src.rpm') packages=$(find build-results -name '*.rpm' -not -name '*.src.rpm')
yum install -y $packages yum install -y $packages
else
yum -y install lorax-composer composer-cli
fi
systemctl enable lorax-composer.socket systemctl enable lorax-composer.socket
if [ -f /usr/bin/docker ]; then if [ -f /usr/bin/docker ]; then