leapp-repository/SOURCES/0025-Makefile-Properly-copy-commands-dir-to-test-containe.patch
eabdullin f53b53a68e Import from CS git
(cherry picked from commit 316902b8f7)
2025-12-01 15:05:53 +02:00

43 lines
2.1 KiB
Diff

From 7d9ae2c0adcef2eac7cb09fd9acf74f9a6011d64 Mon Sep 17 00:00:00 2001
From: Matej Matuska <mmatuska@redhat.com>
Date: Fri, 17 Oct 2025 09:08:02 +0200
Subject: [PATCH 25/55] Makefile: Properly copy commands dir to test containers
During a containerized tests run, the commands/ directory is not used
when running the commands tests. Instead, the commands are imported from
tut/lib/python3.X/site-packages/leapp/cli/commands/ where python3.X is
the python used in the tut/ virtualenv.
When there are changes breaking the commands tests, the test are still
passing because the files are not being updated in the directory
mentioned above. This can be currently fixed by rebuilding the container
which takes a lot of time.
This patch adds copying of the commands/ dir to the
tut/lib/python3.X/site-packages/leapp/cli/commands/.
This helped while working on #1438 because I caught the failing tests
only after opening a the PR. The CI containerized tests are always
created from scratch so it works there.
---
Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 1bfbc3ac..9774a475 100644
--- a/Makefile
+++ b/Makefile
@@ -447,7 +447,8 @@ test_container:
export _CONT_NAME="leapp-repo-tests-$(_TEST_CONTAINER)-cont"; \
$(_CONTAINER_TOOL) ps -q -f name=$$_CONT_NAME && { $(_CONTAINER_TOOL) kill $$_CONT_NAME; $(_CONTAINER_TOOL) rm $$_CONT_NAME; }; \
$(_CONTAINER_TOOL) run -di --name $$_CONT_NAME -v "$$PWD":/repo:Z -e PYTHON_VENV=$$_VENV $$TEST_IMAGE && \
- $(_CONTAINER_TOOL) exec $$_CONT_NAME rsync -aur --delete --exclude 'tut/' --exclude 'docs/' --exclude '**/__pycache__/' --exclude 'packaging/' --exclude '.git/' /repo/ /repocopy && \
+ $(_CONTAINER_TOOL) exec $$_CONT_NAME rsync -aur --delete --exclude 'tut/' --exclude 'docs/' --exclude '**/__pycache__/' --exclude 'packaging/' --exclude '.git/' --exclude 'commands/' /repo/ /repocopy && \
+ $(_CONTAINER_TOOL) exec $$_CONT_NAME rsync -aur --delete --exclude '**/__pycache__/' /repo/commands/ /repocopy/tut/lib/$$_VENV/site-packages/leapp/cli/commands/ && \
export res=0; \
case $$_VENV in \
python3.6) \
--
2.51.1