@@ -57,12 +57,12 @@ class RecoveryTest(unittest.TestCase, TestHelper):
57
57
58
58
@classmethod
59
59
def setUpClass (self ):
60
- # subprocess.check_call(['docker-compose','up',
61
- # '--force-recreate',
62
- # '-d'])
60
+ subprocess .check_call (['docker-compose' ,'up' ,
61
+ '--force-recreate' ,
62
+ '-d' ])
63
63
64
64
# XXX: add normal wait here
65
- # time.sleep(30 )
65
+ time .sleep (20 )
66
66
self .client = MtmClient ([
67
67
"dbname=regression user=postgres host=127.0.0.1 port=15432" ,
68
68
"dbname=regression user=postgres host=127.0.0.1 port=15433" ,
@@ -75,24 +75,18 @@ def tearDownClass(self):
75
75
print ('tearDown' )
76
76
self .client .stop ()
77
77
# XXX: check nodes data identity here
78
- # subprocess.check_call(['docker-compose','down'])
78
+ subprocess .check_call (['docker-compose' ,'down' ])
79
79
80
80
def test_normal_operations (self ):
81
81
print ('### normal_operations ###' )
82
82
83
- self .client .clean_aggregates ()
84
- time .sleep (TEST_DURATION )
85
- aggs_failure = self .client .get_aggregates ()
86
-
87
- self .client .clean_aggregates ()
88
- time .sleep (TEST_RECOVERY_TIME )
89
- aggs = self .client .get_aggregates ()
83
+ aggs_failure , aggs = self .performFailure (NoFailure ())
90
84
91
- for agg in aggs_failure :
92
- self .assertTrue ( 'commit' in aggs_failure [ agg ][ 'finish' ] )
85
+ self . assertCommits ( aggs_failure )
86
+ self .assertIsolation ( aggs_failure )
93
87
94
- for agg in aggs :
95
- self .assertTrue ( 'commit' in aggs [ agg ][ 'finish' ] )
88
+ self . assertCommits ( aggs )
89
+ self .assertIsolation ( aggs )
96
90
97
91
98
92
def test_node_partition (self ):
@@ -111,31 +105,14 @@ def test_node_partition(self):
111
105
def test_edge_partition (self ):
112
106
print ('### edgePartitionTest ###' )
113
107
114
- failure = EdgePartition ('node2' , 'node3' )
115
- failure .start ()
108
+ aggs_failure , aggs = self .performFailure (EdgePartition ('node2' , 'node3' ))
116
109
117
- self .client .clean_aggregates ()
118
- time .sleep (TEST_DURATION )
119
- aggs_failure = self .client .get_aggregates ()
120
-
121
- failure .stop ()
122
-
123
- self .client .clean_aggregates ()
124
- time .sleep (TEST_RECOVERY_TIME )
125
- aggs = self .client .get_aggregates ()
110
+ self .assertTrue ( ('commit' in aggs_failure [1 ]['transfer' ]['finish' ]) or ('commit' in aggs_failure [2 ]['transfer' ]['finish' ]) )
111
+ self .assertCommits (aggs_failure [0 :1 ]) # first node
112
+ self .assertIsolation (aggs_failure )
126
113
127
- self .assertTrue ( ('commit' in aggs_failure ['transfer_2' ]['finish' ]) or ('commit' in aggs_failure ['transfer_1' ]['finish' ]) )
128
- self .assertTrue ( 'commit' in aggs_failure ['transfer_0' ]['finish' ] )
129
- self .assertTrue ( aggs_failure ['sumtotal_0' ]['isolation' ] == 0 )
130
- self .assertTrue ( aggs_failure ['sumtotal_1' ]['isolation' ] == 0 )
131
- self .assertTrue ( aggs_failure ['sumtotal_2' ]['isolation' ] == 0 )
132
-
133
- self .assertTrue ( 'commit' in aggs ['transfer_0' ]['finish' ] )
134
- self .assertTrue ( 'commit' in aggs ['transfer_1' ]['finish' ] )
135
- self .assertTrue ( 'commit' in aggs ['transfer_2' ]['finish' ] )
136
- self .assertTrue ( aggs ['sumtotal_0' ]['isolation' ] == 0 )
137
- self .assertTrue ( aggs ['sumtotal_1' ]['isolation' ] == 0 )
138
- self .assertTrue ( aggs ['sumtotal_2' ]['isolation' ] == 0 )
114
+ self .assertCommits (aggs )
115
+ self .assertIsolation (aggs )
139
116
140
117
subprocess .check_call (['blockade' ,'join' ])
141
118
print ("Node3 joined back" )
0 commit comments