From 0b4f4a7cdaeb6661dd72875108d60441e110197b Mon Sep 17 00:00:00 2001 From: Miroslav Vadkerti Date: Fri, 3 Nov 2023 19:55:26 +0100 Subject: [PATCH] Correctly update environment from importing plan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The environment from the importing plan was ignored. Resolves #2446 Signed-off-by: Miroslav Vadkerti Co-authored-by: Petr Šplíchal --- tests/plan/import/modify.sh | 4 +++- tmt/base.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/plan/import/modify.sh b/tests/plan/import/modify.sh index 48a188ab98..6ad3c8a788 100755 --- a/tests/plan/import/modify.sh +++ b/tests/plan/import/modify.sh @@ -17,12 +17,14 @@ rlJournalStart rlPhaseStartTest "Show importing plan (modify imported plan)" rlRun -s "tmt plan show ${importing}" rlAssertGrep 'test "foobar" == "foobar"' $rlRun_LOG + rlAssertGrep 'environment VARIABLE: foobar' $rlRun_LOG rlPhaseEnd rlPhaseStartTest "Run plan ${importing}" - rlRun -s "tmt run -vv plan --name ${importing}" 0 "Run plan ${importing}" + rlRun -s "tmt run -dddvv plan --name ${importing}" 0 "Run plan ${importing}" rlAssertGrep 'cmd: test "foobar" == "foobar"' $rlRun_LOG rlAssertGrep "summary: 1 test passed" $rlRun_LOG + rlAssertGrep "VARIABLE: foobar" $rlRun_LOG rlPhaseEnd rlPhaseStartCleanup diff --git a/tmt/base.py b/tmt/base.py index e0b48b2f94..a68a2a38cd 100644 --- a/tmt/base.py +++ b/tmt/base.py @@ -1678,6 +1678,9 @@ def environment(self) -> EnvironmentType: if self.my_run: combined = self._plan_environment.copy() combined.update(self._environment) + # Include environment of the importing plan + if self._original_plan is not None: + combined.update(self._original_plan.environment) # Command line variables take precedence combined.update(self.my_run.environment) # Include path to the plan data directory