mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Improve the "replication work" sentence definition.
Add an ability to specify the origin and the destination for the replication works clause. Use this ability in the API promotion test to ensure the replication from the former replica to the former master.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user