-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement a directive for disabling inheritance
As the first step for the special `fmf` directives let's allow to completely disable inheriting data from parent which is currently the most desired use case. Fix #14.
- Loading branch information
Showing
13 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Do not inherit common test metadata into CI configuration | ||
/: | ||
inherit: false | ||
|
||
resultsdb-testcase: separate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
summary: Full test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test: echo fine | ||
contact: somebody |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
summary: Minimal test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
summary: This plan should inherit nothing | ||
|
||
provision: | ||
how: local | ||
discover: | ||
how: fmf | ||
execute: | ||
how: tmt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Do not inherit common test metadata into plans | ||
/: | ||
inherit: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/: An invalid fmf directive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
summary: Verify functionality of the `inherit` directive | ||
description: | ||
Make sure that the inheritance from parent can be turned off | ||
using the `inherit` directive both when defined in the same | ||
file or separately. Test on a real-life scenario when plans | ||
and the CI config are defined in the test namespace. | ||
require: [tmt] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
. /usr/share/beakerlib/beakerlib.sh || exit 1 | ||
|
||
rlJournalStart | ||
rlPhaseStartTest "Valid" | ||
rlRun "pushd data" | ||
|
||
# Check test | ||
rlRun -s "fmf show --name /mini" | ||
rlAssertGrep "Minimal test" $rlRun_LOG | ||
rlAssertGrep "contact" $rlRun_LOG | ||
rlAssertGrep "fine" $rlRun_LOG | ||
|
||
# Check plan | ||
rlRun -s "fmf show --name /plans/features" | ||
rlAssertGrep "This plan should inherit nothing" $rlRun_LOG | ||
rlAssertNotGrep "contact" $rlRun_LOG | ||
rlAssertNotGrep "fine" $rlRun_LOG | ||
|
||
# Check ci | ||
rlRun -s "fmf show --name /ci" | ||
rlAssertGrep "resultsdb-testcase: separate" $rlRun_LOG | ||
rlAssertNotGrep "contact" $rlRun_LOG | ||
rlAssertNotGrep "fine" $rlRun_LOG | ||
|
||
rlRun "popd" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Invalid" | ||
rlRun "pushd $(mktemp -d)" | ||
rlRun "fmf init" | ||
|
||
# Directives should be dictionary | ||
rlRun "echo '/: weird' > file.fmf" | ||
rlRun -s "fmf show" 1 | ||
rlAssertGrep "Invalid fmf directive in '/file" $rlRun_LOG | ||
rlAssertGrep "Should be a 'dict', got a 'str' instead." $rlRun_LOG | ||
|
||
# Inherit should be a bool | ||
rlRun "echo -e '/: \n inherit: hmmm' > file.fmf" | ||
rlRun -s "fmf show" 1 | ||
rlAssertGrep "Invalid fmf directive 'inherit'" $rlRun_LOG | ||
|
||
# Unknown directive | ||
rlRun "echo -e '/: \n weird: hmmm' > file.fmf" | ||
rlRun -s "fmf show" 1 | ||
rlAssertGrep "Unknown fmf directive 'weird' in '/file'" $rlRun_LOG | ||
|
||
rlRun "popd" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Integration with tmt" | ||
rlRun "pushd data" | ||
|
||
# Show tests | ||
rlRun -s "tmt tests show" | ||
rlAssertGrep "/mini" $rlRun_LOG | ||
rlAssertGrep "Minimal test" $rlRun_LOG | ||
rlAssertGrep "echo fine" $rlRun_LOG | ||
rlAssertNotGrep "/plan" $rlRun_LOG | ||
rlAssertNotGrep "/ci" $rlRun_LOG | ||
|
||
# Check plan | ||
rlRun -s "tmt plans show" | ||
rlAssertGrep "/plan" $rlRun_LOG | ||
rlAssertGrep "This plan should inherit nothing" $rlRun_LOG | ||
rlAssertNotGrep "/test" $rlRun_LOG | ||
rlAssertNotGrep "/ci" $rlRun_LOG | ||
|
||
rlRun "popd" | ||
rlPhaseEnd | ||
rlJournalEnd |