mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Update unit tests
This commit is contained in:
@@ -52,6 +52,7 @@ class TestGovernor(unittest.TestCase):
|
||||
with open('postgres0.yml', 'r') as f:
|
||||
config = yaml.load(f)
|
||||
g = Governor(config)
|
||||
g.postgresql.should_use_s3_to_create_replica = false
|
||||
g.etcd.base_client_url = 'http://remote'
|
||||
g.etcd.client_url
|
||||
g.postgresql.data_directory_empty = true
|
||||
|
||||
@@ -7,10 +7,18 @@ from helpers.etcd import Cluster, Member
|
||||
from helpers.postgresql import Postgresql
|
||||
|
||||
|
||||
def nop(*args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def os_system(cmd):
|
||||
return 0
|
||||
|
||||
|
||||
def false(*args, **kwargs):
|
||||
return False
|
||||
|
||||
|
||||
class MockCursor:
|
||||
|
||||
def __init__(self):
|
||||
@@ -75,8 +83,12 @@ class TestPostgresql(unittest.TestCase):
|
||||
|
||||
def set_up(self):
|
||||
os.system = os_system
|
||||
self.p = Postgresql({'name': 'test0', 'data_dir': 'data/test0', 'listen': '127.0.0.1, 127.0.0.2:5432', 'connect_address': '127.0.0.2:5432', 'replication': {
|
||||
'username': 'replicator', 'password': 'rep-pass', 'network': '127.0.0.1/32'}, 'parameters': {'foo': 'bar'}, 'recovery_conf': {'foo': 'bar'}})
|
||||
shutil.copy = nop
|
||||
self.p = Postgresql({'name': 'test0', 'data_dir': 'data/test0', 'listen': '127.0.0.1, 127.0.0.2:5432',
|
||||
'connect_address': '127.0.0.2:5432', 'superuser': {'password': ''},
|
||||
'admin': {'username': 'admin', 'password': 'admin'}, 'replication': {
|
||||
'username': 'replicator', 'password': 'rep-pass', 'network': '127.0.0.1/32'},
|
||||
'parameters': {'foo': 'bar'}, 'recovery_conf': {'foo': 'bar'}})
|
||||
psycopg2.connect = psycopg2_connect
|
||||
if not os.path.exists(self.p.data_dir):
|
||||
os.makedirs(self.p.data_dir)
|
||||
|
||||
Reference in New Issue
Block a user