From 346ce5b58bef39e3624df9159882c2f52d871110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Wed, 7 Oct 2020 09:02:22 +0200 Subject: [PATCH] Correctly handle framework for new plans and tests Set framework when creating and importing tests. Update plan templates to use the internal executor. --- tests/test/lint/test.sh | 2 +- tmt/base.py | 2 +- tmt/convert.py | 2 +- tmt/templates.py | 16 +++++++++++----- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/test/lint/test.sh b/tests/test/lint/test.sh index 756ad090c2..d80453bff8 100755 --- a/tests/test/lint/test.sh +++ b/tests/test/lint/test.sh @@ -17,7 +17,7 @@ rlJournalStart rlPhaseStartTest "Bad" # Remove the test script path - rlRun "sed -i '$ s/\s.*$//' test/main.fmf" + rlRun "sed -i 's/test:.*/test:/' test/main.fmf" rlRun "tmt test lint | tee output" 1 rlAssertGrep 'fail test script must be defined' output rlPhaseEnd diff --git a/tmt/base.py b/tmt/base.py index 91fc068a47..e4fb5a14f5 100644 --- a/tmt/base.py +++ b/tmt/base.py @@ -275,7 +275,7 @@ def create(name, template, tree, force=False): # Create metadata metadata_path = os.path.join(directory_path, 'main.fmf') tmt.utils.create_file( - path=metadata_path, content=tmt.templates.TEST_METADATA, + path=metadata_path, content=tmt.templates.TEST_METADATA[template], name='test metadata', force=force) # Create script diff --git a/tmt/convert.py b/tmt/convert.py index 6dc9ffa0eb..e717a16a68 100644 --- a/tmt/convert.py +++ b/tmt/convert.py @@ -160,7 +160,7 @@ def read(path, makefile, nitrate, purpose, disabled): data for individual testcases (if multiple nitrate testcases found). """ - data = dict() + data = dict(framework='beakerlib') echo("Checking the '{0}' directory.".format(path)) # Make sure there is a metadata tree initialized diff --git a/tmt/templates.py b/tmt/templates.py index b443e4aa10..6bbfc9e765 100644 --- a/tmt/templates.py +++ b/tmt/templates.py @@ -7,13 +7,19 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TEST = dict() +TEST_METADATA = dict() -TEST_METADATA = """ +TEST_METADATA['shell'] = """ summary: Concise summary describing what the test does -contact: Name Surname test: ./test.sh """.lstrip() +TEST_METADATA['beakerlib'] = """ +summary: Concise summary describing what the test does +test: ./test.sh +framework: beakerlib +""".lstrip() + TEST['shell'] = """ #!/bin/sh -eux @@ -56,7 +62,7 @@ discover: how: fmf execute: - how: shell.tmt + how: tmt """.lstrip() PLAN = dict() @@ -74,7 +80,7 @@ discover: how: fmf execute: - how: beakerlib + how: tmt """.lstrip() PLAN['full'] = """ @@ -87,7 +93,7 @@ how: ansible playbooks: plans/packages.yml execute: - how: beakerlib + how: tmt """.lstrip() # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~