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

Commit ccbe62c

Browse files
committed
formatted aggregation in tests
1 parent 6e077eb commit ccbe62c

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

tests2/lib/bank_client.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import print_function
12
import psycopg2
23
import random
34
from multiprocessing import Process, Value, Queue
@@ -32,9 +33,35 @@ def stop(self):
3233
for client in self._clients:
3334
client.stop()
3435

35-
def set_acc_to_tx(self, max_acc):
36+
def print_agg(self):
37+
aggs = []
3638
for client in self._clients:
37-
client.set_acc_to_tx(max_acc)
39+
aggs.append(client.history.aggregate())
40+
41+
columns = ['running', 'running_latency', 'max_latency', 'finish']
42+
43+
#rows = [ k+str(i+1) for k in agg.keys() for i, agg in enumerate(aggs)]
44+
45+
print("\t\t", end="")
46+
for col in columns:
47+
print(col, end="\t")
48+
print("\n", end="")
49+
50+
for i, agg in enumerate(aggs):
51+
for k in agg.keys():
52+
print("%s_%d:\t" % (k, i+1), end="")
53+
for col in columns:
54+
if k in agg and col in agg[k]:
55+
if isinstance(agg[k][col], float):
56+
print("%.2f\t" % (agg[k][col],), end="\t")
57+
#print(agg[k][col], end="\t")
58+
else :
59+
print(agg[k][col], end="\t")
60+
else :
61+
print("-\t", end='')
62+
print("\n", end='')
63+
64+
print("")
3865

3966

4067
class BankClient(object):

tests2/test_recovery.py

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,9 @@ def tearDownClass(self):
2626
def test_0_normal_operation(self):
2727
print('### normalOpsTest ###')
2828

29-
self.clients.set_acc_to_tx(10000)
30-
self.clients.start()
31-
32-
for i in range(5):
33-
time.sleep(3)
34-
for client in self.clients:
35-
agg = client.history.aggregate()
36-
print(agg)
37-
self.assertTrue(agg['transfer']['finish']['Commit'] > 0)
38-
print("\n")
39-
40-
self.clients.stop()
41-
42-
def test_1_distributed_deadlock(self):
43-
print('### DDD test ###')
44-
45-
self.clients.set_acc_to_tx(10)
46-
self.clients.start()
47-
48-
for i in range(5):
29+
for i in range(1000):
4930
time.sleep(3)
50-
for client in self.clients:
51-
agg = client.history.aggregate()
52-
print(agg)
53-
self.assertTrue(agg['transfer']['finish']['Commit'] > 0)
54-
print("\n")
55-
56-
self.clients.stop()
31+
self.clients.print_agg()
5732

5833
def test_2_node_disconnect(self):
5934
print('### disconnectTest ###')

0 commit comments

Comments
 (0)