diff --git a/test/features/connection.feature b/test/features/connection.feature index 04d041d3..4ce59514 100644 --- a/test/features/connection.feature +++ b/test/features/connection.feature @@ -4,20 +4,22 @@ Feature: connect to a database: Scenario: run mycli on localhost without port When we run mycli with arguments "host=localhost" without arguments "port" When we query "status" - Then status contains "via UNIX socket" + Then status is socket or tcpip + @requires_local_db Scenario: run mycli on TCP host without port When we run mycli without arguments "port" When we query "status" - Then status contains "via TCP/IP" + Then status is socket or tcpip + @requires_local_db Scenario: run mycli with port but without host When we run mycli without arguments "host" When we query "status" - Then status contains "via TCP/IP" + Then status is socket or tcpip @requires_local_db Scenario: run mycli without host and port When we run mycli without arguments "host port" When we query "status" - Then status contains "via UNIX socket" + Then status is socket or tcpip diff --git a/test/features/steps/connection.py b/test/features/steps/connection.py index 74df2883..ea6daeb6 100644 --- a/test/features/steps/connection.py +++ b/test/features/steps/connection.py @@ -15,13 +15,15 @@ def step_run_cli_without_args(context, excluded_args, exact_args=""): wrappers.run_cli(context, run_args=parse_cli_args_to_dict(exact_args), exclude_args=parse_cli_args_to_dict(excluded_args).keys()) -@then('status contains "{expression}"') -def status_contains(context, expression): - wrappers.expect_exact(context, f"{expression}", timeout=5) - - # Normally, the shutdown after scenario waits for the prompt. - # But we may have changed the prompt, depending on parameters, - # so let's wait for its last character +@then('status is socket or tcpip') +def status_is_socket_or_tcp_ip(context): + # The mycli connection can fall back to TCP/IP when a socket is + # unavailable, independently of the fixture's setup connection. + wrappers.expect_exact(context, ('via UNIX socket', 'via TCP/IP'), timeout=5) + + # Normally, the shutdown after scenario waits for the prompt. But we may + # have changed the prompt, depending on parameters, so wait for its last + # character. context.cli.expect_exact(">") context.atprompt = True