Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitccbe62c

Browse files
committed
formatted aggregation in tests
1 parent6e077eb commitccbe62c

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__importprint_function
12
importpsycopg2
23
importrandom
34
frommultiprocessingimportProcess,Value,Queue
@@ -32,9 +33,35 @@ def stop(self):
3233
forclientinself._clients:
3334
client.stop()
3435

35-
defset_acc_to_tx(self,max_acc):
36+
defprint_agg(self):
37+
aggs= []
3638
forclientinself._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+
forcolincolumns:
47+
print(col,end="\t")
48+
print("\n",end="")
49+
50+
fori,agginenumerate(aggs):
51+
forkinagg.keys():
52+
print("%s_%d:\t"% (k,i+1),end="")
53+
forcolincolumns:
54+
ifkinaggandcolinagg[k]:
55+
ifisinstance(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
classBankClient(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
deftest_0_normal_operation(self):
2727
print('### normalOpsTest ###')
2828

29-
self.clients.set_acc_to_tx(10000)
30-
self.clients.start()
31-
32-
foriinrange(5):
33-
time.sleep(3)
34-
forclientinself.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-
deftest_1_distributed_deadlock(self):
43-
print('### DDD test ###')
44-
45-
self.clients.set_acc_to_tx(10)
46-
self.clients.start()
47-
48-
foriinrange(5):
29+
foriinrange(1000):
4930
time.sleep(3)
50-
forclientinself.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
deftest_2_node_disconnect(self):
5934
print('### disconnectTest ###')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp