mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-04 07:55:18 +00:00
[1853] Fix module_is_running() to check for component exactly
This commit is contained in:
@@ -148,8 +148,8 @@ def run_bindctl(commands, cmdctl_port=None):
|
|||||||
"stderr:\n" + str(stderr)
|
"stderr:\n" + str(stderr)
|
||||||
|
|
||||||
|
|
||||||
@step('last bindctl( stderr)? output should( not)? contain (\S+)')
|
@step('last bindctl( stderr)? output should( not)? contain (\S+)( exactly)?')
|
||||||
def check_bindctl_output(step, stderr, notv, string):
|
def check_bindctl_output(step, stderr, notv, string, exactly):
|
||||||
"""Checks the stdout (or stderr) stream of the last run of bindctl,
|
"""Checks the stdout (or stderr) stream of the last run of bindctl,
|
||||||
fails if the given string is not found in it (or fails if 'not' was
|
fails if the given string is not found in it (or fails if 'not' was
|
||||||
set and it is found
|
set and it is found
|
||||||
@@ -157,14 +157,19 @@ def check_bindctl_output(step, stderr, notv, string):
|
|||||||
stderr ('stderr'): Check stderr instead of stdout output
|
stderr ('stderr'): Check stderr instead of stdout output
|
||||||
notv ('not'): reverse the check (fail if string is found)
|
notv ('not'): reverse the check (fail if string is found)
|
||||||
string ('contain <string>') string to look for
|
string ('contain <string>') string to look for
|
||||||
|
exactly ('exactly'): Make an exact match delimited by whitespace
|
||||||
"""
|
"""
|
||||||
if stderr is None:
|
if stderr is None:
|
||||||
output = world.last_bindctl_stdout
|
output = world.last_bindctl_stdout
|
||||||
else:
|
else:
|
||||||
output = world.last_bindctl_stderr
|
output = world.last_bindctl_stderr
|
||||||
found = False
|
found = False
|
||||||
if string in output:
|
if exactly is None:
|
||||||
found = True
|
if string in output:
|
||||||
|
found = True
|
||||||
|
else:
|
||||||
|
if re.search(r'^\s+' + string + r'\s+', output, re.IGNORECASE | re.MULTILINE) is not None:
|
||||||
|
found = True
|
||||||
if notv is None:
|
if notv is None:
|
||||||
assert found == True, "'" + string +\
|
assert found == True, "'" + string +\
|
||||||
"' was not found in bindctl output:\n" +\
|
"' was not found in bindctl output:\n" +\
|
||||||
@@ -328,4 +333,4 @@ def module_is_running(step, name, not_str):
|
|||||||
if not_str is None:
|
if not_str is None:
|
||||||
not_str = ""
|
not_str = ""
|
||||||
step.given('send bind10 the command help')
|
step.given('send bind10 the command help')
|
||||||
step.given('last bindctl output should' + not_str + ' contain ' + name)
|
step.given('last bindctl output should' + not_str + ' contain ' + name + ' exactly')
|
||||||
|
Reference in New Issue
Block a user