From b81e260c4db214e3dd51bec6bcefaf22d83efab3 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Thu, 21 Nov 2019 13:25:00 +0200 Subject: [PATCH] Remove all repo files & install composer-cli from host repos when testing downstream snapshots this makes sure that lorax-composer and composer-cli are coming from the host OS. We also make 100% sure that there are no other repositories inside the VM other than what has been configured on the host! Make it possible to override where repo files are copied from by defining the REPOS_DIR variable. By default the value is /etc/yum.repos.d Cherry-picked from bd2f4925de4bcb7751b9581f3a639eda6d458108 Related: rhbz#1770193 --- Makefile | 12 +++++++++++- test/README.md | 7 ++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index abc2c55c..2765605e 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,10 @@ endif export TEST_OS VM_IMAGE=$(CURDIR)/test/images/$(TEST_OS) +ifeq ($(REPOS_DIR),) +REPOS_DIR = /etc/yum.repos.d +endif + default: all src/composer/version.py: @@ -133,8 +137,14 @@ vm: $(VM_IMAGE) # sure VM_IMAGE is as close as possible to the host! vm-local-repos: vm bots/image-customize -v \ - --upload /etc/yum.repos.d:/etc/yum.repos.d/ \ + --run-command "rm -rf /etc/yum.repos.d" \ + $(TEST_OS) + bots/image-customize -v \ + --upload $(REPOS_DIR):/etc/yum.repos.d \ + --run-command "yum -y remove composer-cli lorax-composer" \ --run-command "yum -y update" \ + --run-command "yum -y install composer-cli lorax-composer" \ + --run-command "systemctl enable lorax-composer" \ $(TEST_OS) vm-reset: diff --git a/test/README.md b/test/README.md index 9c314465..3e9cde83 100644 --- a/test/README.md +++ b/test/README.md @@ -41,12 +41,13 @@ To delete the generated image, run Base images are stored in `bots/images`. Set `TEST_DATA` to override this directory. -Use +To configure the image with all repositories found on the host system use $ make vm-local-repos -to configure the image with all repositories found on the host system! This -is mostly useful when running tests by hand on a downstream snapshot! +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`! +This is mostly useful when running tests by hand on a downstream snapshot! ## Running tests