|
@@ -120,7 +120,7 @@ def have_bind10_running(step, config_file, cmdctl_port, process_name):
|
|
step.given(start_step)
|
|
step.given(start_step)
|
|
|
|
|
|
# function to send lines to bindctl, and store the result
|
|
# function to send lines to bindctl, and store the result
|
|
-def run_bindctl(commands, cmdctl_port=None):
|
|
|
|
|
|
+def run_bindctl(commands, cmdctl_port=None, ignore_failure=False):
|
|
"""Run bindctl.
|
|
"""Run bindctl.
|
|
Parameters:
|
|
Parameters:
|
|
commands: a sequence of strings which will be sent.
|
|
commands: a sequence of strings which will be sent.
|
|
@@ -140,6 +140,8 @@ def run_bindctl(commands, cmdctl_port=None):
|
|
for line in commands:
|
|
for line in commands:
|
|
bindctl.stdin.write(line + "\n")
|
|
bindctl.stdin.write(line + "\n")
|
|
(stdout, stderr) = bindctl.communicate()
|
|
(stdout, stderr) = bindctl.communicate()
|
|
|
|
+ if ignore_failure:
|
|
|
|
+ return
|
|
result = bindctl.returncode
|
|
result = bindctl.returncode
|
|
world.last_bindctl_stdout = stdout
|
|
world.last_bindctl_stdout = stdout
|
|
world.last_bindctl_stderr = stderr
|
|
world.last_bindctl_stderr = stderr
|
|
@@ -306,19 +308,24 @@ def config_remove_command(step, name, value, cmdctl_port):
|
|
"quit"]
|
|
"quit"]
|
|
run_bindctl(commands, cmdctl_port)
|
|
run_bindctl(commands, cmdctl_port)
|
|
|
|
|
|
-@step('send bind10(?: with cmdctl port (\d+))? the command (.+)')
|
|
|
|
-def send_command(step, cmdctl_port, command):
|
|
|
|
|
|
+@step('send bind10(?: with cmdctl port (\d+))?( ignoring failure)? the command (.+)')
|
|
|
|
+def send_command(step, cmdctl_port, ignore_failure, command):
|
|
"""
|
|
"""
|
|
Run bindctl, send the given command, and exit bindctl.
|
|
Run bindctl, send the given command, and exit bindctl.
|
|
Parameters:
|
|
Parameters:
|
|
command ('the command <command>'): The command to send.
|
|
command ('the command <command>'): The command to send.
|
|
cmdctl_port ('with cmdctl port <portnr>', optional): cmdctl port to send
|
|
cmdctl_port ('with cmdctl port <portnr>', optional): cmdctl port to send
|
|
the command to. Defaults to 47805.
|
|
the command to. Defaults to 47805.
|
|
- Fails if cmdctl does not exit with status code 0.
|
|
|
|
|
|
+ ignore_failure ('ignoring failure', optional): set to not None if bindctl
|
|
|
|
+ is expected to fail (and it's acceptable).
|
|
|
|
+
|
|
|
|
+ Fails if bindctl does not exit with status code 0 and ignore_failure
|
|
|
|
+ is not None.
|
|
|
|
+
|
|
"""
|
|
"""
|
|
commands = [command,
|
|
commands = [command,
|
|
"quit"]
|
|
"quit"]
|
|
- run_bindctl(commands, cmdctl_port)
|
|
|
|
|
|
+ run_bindctl(commands, cmdctl_port, ignore_failure is not None)
|
|
|
|
|
|
@step('bind10 module (\S+) should( not)? be running')
|
|
@step('bind10 module (\S+) should( not)? be running')
|
|
def module_is_running(step, name, not_str):
|
|
def module_is_running(step, name, not_str):
|