diff --git a/features/patroni_api.feature b/features/patroni_api.feature index c7779af1..78f014e2 100644 --- a/features/patroni_api.feature +++ b/features/patroni_api.feature @@ -22,14 +22,14 @@ Scenario: check API requests on a stand-alone server Scenario: check API requests for the primary-replica pair Given I start postgres1 - And replication works after 10 seconds + And replication works from postgres0 to postgres1 after 15 seconds When I issue a GET request to http://127.0.0.1:8009/replica Then I receive a response code 200 And I receive a response state running And I receive a response role replica When I issue an empty POST request to http://127.0.0.1:8009/reinitialize Then I receive a response code 200 - Given replication works after 10 seconds + Given replication works from postgres0 to postgres1 after 10 seconds When I issue an empty POST request to http://127.0.0.1:8008/restart Then I receive a response code 200 And postgres0 is a leader after 5 seconds @@ -37,4 +37,5 @@ Scenario: check API requests for the primary-replica pair Scenario: check promotion via the API Given I issue a POST request to http://127.0.0.1:8008/failover with leader=postgres0,candidate=postgres1 Then I receive a response code 200 - And postgres1 is a leader after 10 seconds + And postgres1 is a leader after 5 seconds + And replication works from postgres1 to postgres0 after 15 seconds diff --git a/features/patroni_api.py b/features/patroni_api.py index 44de0f56..37650d99 100644 --- a/features/patroni_api.py +++ b/features/patroni_api.py @@ -79,12 +79,12 @@ class PatroniAPISteps(object): assert component in self.response, "{0} is not part of the response".format(component) assert self.response[component] == data, "{0} does not contain {1}".format(component, data) - def replication_works(self, step, time_limit): - '''replication works after (\d+) seconds''' + def replication_works(self, step, master, replica, time_limit): + '''replication works from (\w+) to (\w+) after (\d+) seconds''' step.behave_as(""" - When I add the table test_{0} to postgres0 - Then table test_{0} is present on postgres1 after {1} seconds - """.format(int(time.time()), time_limit)) + When I add the table test_{0} to {1} + Then table test_{0} is present on {2} after {3} seconds + """.format(int(time.time()), master, replica, time_limit)) PatroniAPISteps(world)