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

Commitf40b220

Browse files
committed
small cleanup#6
1 parent6ba3da3 commitf40b220

File tree

3 files changed

+2
-34
lines changed

3 files changed

+2
-34
lines changed

‎tests2/lib/bank_client.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def __init__(self, connstrs):
1111
forcsinconnstrs:
1212
b=BankClient(cs)
1313
self._clients.append(b)
14-
# glob_clients.append(b)
1514

1615
self._clients[0].initialize()
1716

@@ -29,7 +28,6 @@ def start(self):
2928
defstop(self):
3029
forclientinself._clients:
3130
client.stop()
32-
# client.cleanup()
3331

3432

3533
classBankClient(object):
@@ -41,7 +39,6 @@ def __init__(self, connstr):
4139
self.accounts=10000
4240

4341
definitialize(self):
44-
# initialize database
4542
conn=psycopg2.connect(self.connstr)
4643
cur=conn.cursor()
4744
cur.execute('create extension if not exists multimaster')
@@ -69,7 +66,7 @@ def check_total(self):
6966
res=cur.fetchone()
7067
ifres[0]!=0:
7168
print("Isolation error, total = %d"% (res[0],))
72-
raiseBaseException#
69+
raiseBaseException
7370

7471
cur.close()
7572
conn.close()
@@ -88,7 +85,6 @@ def transfer_money(self):
8885

8986
event_id=self.history.register_start('tx')
9087

91-
#cur.execute('begin')
9288
cur.execute('''update bank_test
9389
set amount = amount - %s
9490
where uid = %s''',
@@ -97,7 +93,6 @@ def transfer_money(self):
9793
set amount = amount + %s
9894
where uid = %s''',
9995
(amount,to_uid))
100-
#cur.execute('commit')
10196

10297
try:
10398
conn.commit()
@@ -106,8 +101,6 @@ def transfer_money(self):
106101
else:
107102
self.history.register_finish(event_id,'commit')
108103

109-
#print("T", i)
110-
111104
cur.close()
112105
conn.close()
113106

@@ -131,8 +124,6 @@ def start(self):
131124

132125
defstop(self):
133126
self.run.value=False
134-
# self.total_process.join()
135-
# self.transfer_process.join()
136127
return
137128

138129
defcleanup(self):

‎tests2/lib/event_history.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def aggregate(self):
7878
named_agg['running']=1
7979
named_agg['running_latency']=latency
8080

81-
# print(self.running_events)
8281
returnagg
8382

8483
defaggregate_by(self,period):

‎tests2/test_recovery.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
importtime
33
importsubprocess
44
fromlib.bank_clientimport*
5-
#from lib.bank_client import *
65

76

87
classRecoveryTest(unittest.TestCase):
@@ -35,33 +34,12 @@ def test_1_node_disconnect(self):
3534

3635
subprocess.check_call(['blockade','partition','node3'])
3736
print('---node3 out---')
38-
39-
time.sleep(25)
40-
41-
# node1 should work
42-
agg=self.clients[0].history.aggregate()
43-
print(agg)
44-
# self.assertTrue(agg['tx']['commit'] > 0)
45-
46-
# node3 shouldn't work
47-
agg=self.clients[2].history.aggregate()
48-
print(agg)
49-
# self.assertTrue(agg['tx']['commit'] == 0)
50-
51-
# subprocess.check_call(['blockade','partition','node2'])
52-
# print('---node2 out---')
53-
# time.sleep(5)
37+
time.sleep(15)
5438

5539
subprocess.check_call(['blockade','join'])
5640
print('---node2 and node3 are back---')
5741
time.sleep(5)
5842

59-
#b1_agg = self.b1.history().aggregate()
60-
#self.assertTrue(b1_agg['commit']['count'] > 0)
61-
#self.assertTrue(
62-
# float(b1_agg['rollback']['count'])/b1_agg['commit']['count'] < 0.2
63-
#)
64-
6543
if__name__=='__main__':
6644
unittest.main()
6745

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp