Skip to content

Commit b701ba9

Browse files
committed
infinite test
1 parent f484f0b commit b701ba9

File tree

2 files changed

+64
-23
lines changed

2 files changed

+64
-23
lines changed

tests2/lib/event_history.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ def aggregate(self):
6666

6767
agg = {}
6868
for ev in self.events:
69-
if ev['finished_at'] < self.last_aggregation:
70-
#print("cont")
71-
continue
72-
7369
if ev['name'] not in agg:
7470
agg[ev['name']] = copy.deepcopy(self.agg_template)
7571
#print('-=-=-', agg)
@@ -85,6 +81,8 @@ def aggregate(self):
8581
if named_agg['max_latency'] < latency:
8682
named_agg['max_latency'] = latency
8783

84+
self.events = []
85+
8886
for value in self.running_events.itervalues():
8987

9088
if value['name'] not in agg:
@@ -97,8 +95,6 @@ def aggregate(self):
9795
if named_agg['running_latency'] < latency:
9896
named_agg['running_latency'] = latency
9997

100-
#self.last_aggregation = last_aggregation
101-
#print("aggregeted!")
10298
return agg
10399

104100
def aggregate_by(self, period):

tests2/test_recovery.py

+62-17
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,79 @@ def tearDownClass(self):
2222
self.clients.stop()
2323
#self.clients[0].cleanup()
2424

25-
26-
def test_0_normal_operation(self):
25+
def test_0_0_0(self):
2726
print('### normalOpsTest ###')
2827

29-
for i in range(1000):
30-
time.sleep(3)
31-
self.clients.print_agg()
32-
33-
def test_2_node_disconnect(self):
34-
print('### disconnectTest ###')
28+
time.sleep(10)
29+
subprocess.check_call(['blockade','partition','node3'])
3530

3631
self.clients.set_acc_to_tx(10000)
3732
self.clients.start()
3833

39-
subprocess.check_call(['blockade','partition','node3'])
40-
print('Node3 disconnected')
41-
42-
for i in range(5):
34+
for i in range(1000):
4335
time.sleep(3)
44-
for client in self.clients:
45-
agg = client.history.aggregate()
46-
print(agg)
47-
self.assertTrue(agg['transfer']['finish']['Commit'] > 0)
36+
self.clients.print_agg()
4837
print("\n")
4938

50-
subprocess.check_call(['blockade','join'])
5139
self.clients.stop()
5240

41+
42+
43+
# def test_0_normal_operation(self):
44+
# print('### normalOpsTest ###')
45+
#
46+
# self.clients.set_acc_to_tx(10000)
47+
# self.clients.start()
48+
#
49+
# for i in range(5):
50+
# time.sleep(3)
51+
# for client in self.clients:
52+
# agg = client.history.aggregate()
53+
# print(agg)
54+
# self.assertTrue(agg['transfer']['finish']['Commit'] > 0)
55+
# print("\n")
56+
#
57+
# self.clients.stop()
58+
#
59+
# def test_1_distributed_deadlock(self):
60+
# print('### DDD test ###')
61+
#
62+
# self.clients.set_acc_to_tx(10)
63+
# self.clients.start()
64+
#
65+
# for i in range(5):
66+
# time.sleep(3)
67+
# for client in self.clients:
68+
# agg = client.history.aggregate()
69+
# print(agg)
70+
# self.assertTrue(agg['transfer']['finish']['Commit'] > 0)
71+
# print("\n")
72+
#
73+
# self.clients.stop()
74+
#
75+
# def test_2_node_disconnect(self):
76+
# print('### disconnectTest ###')
77+
#
78+
# self.clients.set_acc_to_tx(10000)
79+
# self.clients.start()
80+
#
81+
# subprocess.check_call(['blockade','partition','node3'])
82+
# print('Node3 disconnected')
83+
#
84+
# # give cluster some time to discover problem
85+
# time.sleep(3)
86+
#
87+
# for i in range(5):
88+
# time.sleep(3)
89+
# for client in self.clients:
90+
# agg = client.history.aggregate()
91+
# print(agg)
92+
# self.assertTrue(agg['transfer']['finish']['Commit'] > 0)
93+
# print("\n")
94+
#
95+
# subprocess.check_call(['blockade','join'])
96+
# self.clients.stop()
97+
5398
subprocess.check_call(['blockade','join'])
5499
print("Node3 joined back")
55100

0 commit comments

Comments
 (0)