Skip to content

Commit

Permalink
Correctly handle framework for new plans and tests
Browse files Browse the repository at this point in the history
Set framework when creating and importing tests.
Update plan templates to use the internal executor.
  • Loading branch information
psss committed Oct 7, 2020
1 parent 07d04bb commit 346ce5b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/test/lint/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tmt/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tmt/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions tmt/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
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
Expand Down Expand Up @@ -56,7 +62,7 @@
discover:
how: fmf
execute:
how: shell.tmt
how: tmt
""".lstrip()

PLAN = dict()
Expand All @@ -74,7 +80,7 @@
discover:
how: fmf
execute:
how: beakerlib
how: tmt
""".lstrip()

PLAN['full'] = """
Expand All @@ -87,7 +93,7 @@
how: ansible
playbooks: plans/packages.yml
execute:
how: beakerlib
how: tmt
""".lstrip()

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 346ce5b

Please sign in to comment.