summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/debugger/test_run_once.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/debugger/test_run_once.py')
-rwxr-xr-xtest/integration/targets/debugger/test_run_once.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/integration/targets/debugger/test_run_once.py b/test/integration/targets/debugger/test_run_once.py
new file mode 100755
index 0000000..237f9c2
--- /dev/null
+++ b/test/integration/targets/debugger/test_run_once.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+import io
+import os
+import sys
+
+import pexpect
+
+
+env_vars = {
+ 'ANSIBLE_NOCOLOR': 'True',
+ 'ANSIBLE_RETRY_FILES_ENABLED': 'False',
+}
+
+env = os.environ.copy()
+env.update(env_vars)
+
+with io.BytesIO() as logfile:
+ debugger_test_test = pexpect.spawn(
+ 'ansible-playbook',
+ args=['test_run_once_playbook.yml'] + sys.argv[1:],
+ timeout=10,
+ env=env
+ )
+
+ debugger_test_test.logfile = logfile
+
+ debugger_test_test.expect_exact('TASK: Task 1 (debug)> ')
+ debugger_test_test.send('task.args["that"] = "true"\r')
+ debugger_test_test.expect_exact('TASK: Task 1 (debug)> ')
+ debugger_test_test.send('r\r')
+ debugger_test_test.expect(pexpect.EOF)
+ debugger_test_test.close()
+
+ assert str(logfile.getvalue()).count('Task 2 executed') == 2