Add simple API tests for 2 nodes, to be extended.

This commit is contained in:
Oleksii Kliukin
2016-02-26 18:00:11 +01:00
parent 4e9ebf48a8
commit 0d44e3eb7c
2 changed files with 18 additions and 1 deletions
+11 -1
View File
@@ -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
+7
View File
@@ -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)