Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b818e53

Browse files
committed
ressurect testgres tests
1 parent 0eae2c0 commit b818e53

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

tests_testgres/mm_cluster.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
#
66
# Execute this file in order to run 3-node mm cluster
77

8+
import time
89

910
from testgres import PostgresNode, NodeStatus, NodeBackup
1011
from testgres import reserve_port, release_port
11-
from testgres import default_username
12-
from testgres import DEFAULT_XLOG_METHOD
12+
from testgres.defaults import default_username
13+
from testgres.enums import XLogMethod
1314

15+
DEFAULT_XLOG_METHOD = XLogMethod.fetch
1416

1517
# track important changes
1618
__version__ = 0.1
@@ -127,6 +129,11 @@ def reload(self):
127129

128130
return self
129131

132+
def print_conninfo(self):
133+
print(self._build_mm_conn_strings(self.ports,
134+
self.dbname,
135+
self.username))
136+
130137
def install(self):
131138
self.node_any().poll_query_until(dbname=self.dbname,
132139
username=self.username,
@@ -189,6 +196,19 @@ def execute_any(self, dbname, query, username=None, commit=False):
189196
query=query,
190197
commit=commit)
191198

199+
def await_online(self, node_ids):
200+
# await for heartbeat timeout
201+
time.sleep(5)
202+
203+
for node_id in node_ids:
204+
self.nodes[node_id].poll_query_until(dbname=self.dbname,
205+
username=self.username,
206+
query="select true",
207+
raise_programming_error=False,
208+
raise_internal_error=False,
209+
expected=True)
210+
return self
211+
192212
def node_any(self, status=NodeStatus.Running):
193213
for node in self.nodes:
194214
if node.status():
@@ -244,9 +264,7 @@ def __init__(self,
244264

245265
super(ClusterNode, self).__init__(name=name,
246266
port=pg_port,
247-
base_dir=base_dir,
248-
use_logging=use_logging,
249-
master=master)
267+
base_dir=base_dir)
250268

251269
self.mm_port = mm_port
252270

tests_testgres/run_tests.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
#!/usr/bin/bash
1+
#!/bin/sh
2+
set -e
3+
ulimit -c unlimited
4+
5+
CURPATH=`pwd`
6+
BASEDIR=$CURPATH/../../..
7+
export PATH=$BASEDIR/tmp_install/usr/local/pgsql/bin/:$PATH
8+
export DYLD_LIBRARY_PATH=$BASEDIR/tmp_install/usr/local/pgsql/lib/:$DYLD_LIBRARY_PATH
9+
export DESTDIR=$BASEDIR/tmp_install
10+
11+
make -C $BASEDIR install
12+
make -C $BASEDIR/contrib/mmts install
213

314
if [ -z "$VIRTUAL_ENV" ]; then
415
>&2 echo WARNING: not in virtualenv
516
fi
617

7-
python -m unittest discover --pattern=*.py
18+
# python3 -m unittest discover --pattern=*.py
19+
python3 ddl.py

tests_testgres/test_failover.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
node_id += 1
1212

1313
print("Node #{}".format(node_id))
14-
print("\t-> pid: {}".format(node.get_pid()))
1514
print("\t-> port: {}".format(node.port))
1615
print("\t-> arbiter port: {}".format(node.mm_port))
1716
print("\t-> dir: {}".format(node.base_dir))

0 commit comments

Comments
 (0)