tests: Compare blueprints as TOML objects, not strings

this is to avoid differences in ordering and white space. The same
approach is used on rhel7-extras branch.
This commit is contained in:
Alexander Todorov 2020-05-01 13:06:00 +03:00 committed by Brian C. Lane
parent eb7748236c
commit 04bc5e9e86
2 changed files with 15 additions and 1 deletions

13
tests/cli/lib/toml-compare Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env python
import sys
import toml
if len(sys.argv) != 3:
print("USAGE: ", __file__, "<blueprint-one.toml> <blueprint-two.toml>")
sys.exit(1)
blueprint_one = toml.loads(open(sys.argv[1]).read())
blueprint_two = toml.loads(open(sys.argv[2]).read())
assert blueprint_one == blueprint_two

View File

@ -51,7 +51,8 @@ __EOF__
rlPhaseEnd
rlPhaseStartTest "blueprints show"
rlAssertEquals "show displays blueprint in TOML" "`$CLI blueprints show $BLUEPRINT_NAME`" "`cat $BLUEPRINT_NAME.toml`"
$CLI blueprints show $BLUEPRINT_NAME > shown-$BLUEPRINT_NAME.toml
rlRun -t -c "$(dirname $0)/lib/toml-compare $BLUEPRINT_NAME.toml shown-$BLUEPRINT_NAME.toml"
rlPhaseEnd
rlPhaseStartTest "SemVer .patch version is incremented automatically"