Collect test output, add basic failover test.

This commit is contained in:
Oleksii Kliukin
2016-02-24 16:30:52 +01:00
parent f781d0b9fe
commit 6ec3523748
5 changed files with 113 additions and 21 deletions
+33
View File
@@ -0,0 +1,33 @@
from lettuce import world, steps
PATRONI_CONFIG = '{}.yml'
@steps
class BasicFailoverSteps(object):
def __init__(self, environ):
self.env = environ
def basic_replication(self, step):
'''Basic replication'''
step.behave_as("""
Given I start postgres0
And I start postgres1
When I add the table foo to postgres0
Then table foo is present on postgres1 after 10 seconds
""")
def start_patroni(self, step, pg_name):
'''I start (\w+)'''
return world.pctl.start_patroni(pg_name)
def stop_patroni(self, step, pg_name):
'''I shut down (\w+)'''
return world.pctl.stop_patroni(pg_name)
def check_role(self, step, pg_name, pg_role, max_promotion_timeout):
'''(\w+) role is the (\w+) after (\d+) seconds'''
return world.pctl.check_role_has_changed_to(pg_name, pg_role, timeout=int(max_promotion_timeout))
BasicFailoverSteps(world)