mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Add simple API tests for 2 nodes, to be extended.
This commit is contained in:
@@ -18,4 +18,14 @@ Scenario: check API requests on a stand-alone server
|
||||
And I receive a response text "failover is not possible: cluster does not have members except leader"
|
||||
When I issue an empty POST request to http://127.0.0.1:8008/failover
|
||||
Then I receive a response code 503
|
||||
And I receive a response text "No values given for required parameters leader and member"
|
||||
And I receive a response text "No values given for required parameters leader and member"
|
||||
|
||||
Scenario: check API requests for the primary-replica pair
|
||||
Given I start postgres1
|
||||
And replication works after 10 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
|
||||
|
||||
@@ -79,5 +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):
|
||||
'''And replication works after (\d+) seconds'''
|
||||
step.behave_as("""
|
||||
When I add the table foo to postgres0
|
||||
Then table foo is present on postgres1 after {0} seconds
|
||||
""".format(time_limit))
|
||||
|
||||
|
||||
PatroniAPISteps(world)
|
||||
|
||||
Reference in New Issue
Block a user