summaryrefslogtreecommitdiffstats
path: root/tests/features/steps
diff options
context:
space:
mode:
Diffstat (limited to 'tests/features/steps')
-rw-r--r--tests/features/steps/basic_commands.py2
-rw-r--r--tests/features/steps/crud_database.py2
-rw-r--r--tests/features/steps/pgbouncer.py22
-rw-r--r--tests/features/steps/wrappers.py3
4 files changed, 26 insertions, 3 deletions
diff --git a/tests/features/steps/basic_commands.py b/tests/features/steps/basic_commands.py
index a7c99ee..7c87814 100644
--- a/tests/features/steps/basic_commands.py
+++ b/tests/features/steps/basic_commands.py
@@ -69,7 +69,7 @@ def step_ctrl_d(context):
context.cli.sendline(r"\pset pager off")
wrappers.wait_prompt(context)
context.cli.sendcontrol("d")
- context.cli.expect(pexpect.EOF, timeout=15)
+ context.cli.expect(pexpect.EOF, timeout=5)
context.exit_sent = True
diff --git a/tests/features/steps/crud_database.py b/tests/features/steps/crud_database.py
index 3f5d0e7..87cdc85 100644
--- a/tests/features/steps/crud_database.py
+++ b/tests/features/steps/crud_database.py
@@ -59,7 +59,7 @@ def step_see_prompt(context):
Wait to see the prompt.
"""
db_name = getattr(context, "currentdb", context.conf["dbname"])
- wrappers.expect_exact(context, f"{db_name}> ", timeout=5)
+ wrappers.expect_exact(context, f"{db_name}>", timeout=5)
context.atprompt = True
diff --git a/tests/features/steps/pgbouncer.py b/tests/features/steps/pgbouncer.py
new file mode 100644
index 0000000..f156982
--- /dev/null
+++ b/tests/features/steps/pgbouncer.py
@@ -0,0 +1,22 @@
+"""
+Steps for behavioral style tests are defined in this module.
+Each step is defined by the string decorating it.
+This string is used to call the step in "*.feature" file.
+"""
+
+from behave import when, then
+import wrappers
+
+
+@when('we send "show help" command')
+def step_send_help_command(context):
+ context.cli.sendline("show help")
+
+
+@then("we see the pgbouncer help output")
+def see_pgbouncer_help(context):
+ wrappers.expect_exact(
+ context,
+ "SHOW HELP|CONFIG|DATABASES|POOLS|CLIENTS|SERVERS|USERS|VERSION",
+ timeout=3,
+ )
diff --git a/tests/features/steps/wrappers.py b/tests/features/steps/wrappers.py
index 0ca8366..6180517 100644
--- a/tests/features/steps/wrappers.py
+++ b/tests/features/steps/wrappers.py
@@ -70,4 +70,5 @@ def run_cli(context, run_args=None, prompt_check=True, currentdb=None):
def wait_prompt(context):
"""Make sure prompt is displayed."""
- expect_exact(context, "{0}> ".format(context.conf["dbname"]), timeout=5)
+ prompt_str = "{0}>".format(context.currentdb)
+ expect_exact(context, [prompt_str + " ", prompt_str, pexpect.EOF], timeout=3)