| 968 | |
| 969 | class testConstraintReplication(): |
| 970 | def __init__(self): |
| 971 | self.env = Env(decodeResponses=True, env='oss', useSlaves=True) |
| 972 | self.source = self.env.getConnection() |
| 973 | self.replica = self.env.getSlaveConnection() |
| 974 | self.monitor = [] |
| 975 | self.g = Graph(self.source, GRAPH_ID) |
| 976 | |
| 977 | self.monitor_thread = threading.Thread(target=self.monitor_thread) |
| 978 | self.monitor_thread.start() |
| 979 | |
| 980 | # wait for monitor thread to attach |
| 981 | while MONITOR_ATTACHED is False: |
| 982 | time.sleep(0.2) |
| 983 | |
| 984 | # clear DB |
| 985 | self.source.flushall() |
| 986 | |
| 987 | # the WAIT command forces master slave sync to complete |
| 988 | self.source.execute_command("WAIT", 1, 0) |
| 989 | |
| 990 | def monitor_thread(self): |
| 991 | global MONITOR_ATTACHED |