Become a bit stricter: do full-line pattern match, and update unit tests to capture the full error output

This commit is contained in:
Pim van Pelt
2022-03-22 15:10:40 +00:00
parent 7303adb74a
commit 7bf940be0a
6 changed files with 8 additions and 8 deletions

View File

@ -68,7 +68,7 @@ class YAMLTest(unittest.TestCase):
for m in msgs:
this_msg_expected = False
for expected in msgs_expected:
if re.search(expected, m):
if re.match(expected, m):
this_msg_expected = True
break
if not this_msg_expected:

View File

@ -2,8 +2,8 @@ test:
description: "MTU too small on one interface, too large on another"
errors:
expected:
- "mtu.*less than 128"
- "mtu.*greater than 9216"
- "yamale:.*mtu: 127 is less than 128"
- "yamale:.*mtu: 9217 is greater than 9216"
count: 2
---
interfaces:

View File

@ -2,7 +2,7 @@ test:
description: "Interface description field mistyped"
errors:
expected:
- "descr.*Unexpected element"
- "yamale:.*descr: Unexpected element"
count: 1
---
interfaces:

View File

@ -4,7 +4,7 @@ test:
expected:
- "yamale: .* is not a "
- "yamale: .*: Unexpected element"
- "Length of .* is greater than 15"
- "yamale: .*: Length of .* is greater than 15"
count: 13
---
interfaces:

View File

@ -2,8 +2,8 @@ test:
description: "Two subinterfaces can't have the same encapsulation"
errors:
expected:
- "100 .* unique encapsulation"
- "101 .* unique encapsulation"
- "sub-interface .*.100 does not have unique encapsulation"
- "sub-interface .*.101 does not have unique encapsulation"
count: 2
---
interfaces:

View File

@ -2,7 +2,7 @@ test:
description: "A bunch of sub-interfaces with incorrect encapsulation"
errors:
expected:
- "has invalid encapsulation"
- "sub-interface .* has invalid encapsulation"
count: 2
---
interfaces: