Become a bit stricter: do full-line pattern match, and update unit tests to capture the full error output
This commit is contained in:
2
tests.py
2
tests.py
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -2,7 +2,7 @@ test:
|
||||
description: "Interface description field mistyped"
|
||||
errors:
|
||||
expected:
|
||||
- "descr.*Unexpected element"
|
||||
- "yamale:.*descr: Unexpected element"
|
||||
count: 1
|
||||
---
|
||||
interfaces:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
Reference in New Issue
Block a user