26
26
import unittest # noqa
27
27
28
28
29
+ # Previous Cassandra upgrade
29
30
two_to_three_path = upgrade_paths ([
30
31
UpgradePath ("2.2.9-3.11" , {"version" : "2.2.9" }, {"version" : "3.11" }, {}),
31
32
])
33
+
34
+ # Previous DSE upgrade
35
+ five_upgrade_path = upgrade_paths ([
36
+ UpgradePath ("5.0.11-5.1.4" , {"version" : "5.0.11" }, {"version" : "5.1.4" }, {}),
37
+ ])
38
+
39
+
32
40
class UpgradeTests (UpgradeBase ):
33
41
@two_to_three_path
34
42
def test_can_write (self ):
@@ -43,16 +51,17 @@ def test_can_write(self):
43
51
"""
44
52
self .start_upgrade (0 )
45
53
54
+ self .cluster_driver .add_execution_profile ("all" , ExecutionProfile (consistency_level = ConsistencyLevel .ALL ))
55
+ self .cluster_driver .add_execution_profile ("one" , ExecutionProfile (consistency_level = ConsistencyLevel .LOCAL_ONE ))
56
+
46
57
c = count ()
47
58
while not self .is_upgraded ():
48
- self .session .execute ("INSERT INTO test3rf.test(k, v) VALUES (%s, 0)" , (next (c ), ))
59
+ self .session .execute ("INSERT INTO test3rf.test(k, v) VALUES (%s, 0)" , (next (c ), ), execution_profile = "one" )
49
60
time .sleep (0.0001 )
50
61
51
- self .session .default_consistency_level = ConsistencyLevel .ALL
52
- total_number_of_inserted = self .session .execute ("SELECT COUNT(*) from test3rf.test" )[0 ][0 ]
62
+ total_number_of_inserted = self .session .execute ("SELECT COUNT(*) from test3rf.test" , execution_profile = "all" )[0 ][0 ]
53
63
self .assertEqual (total_number_of_inserted , next (c ))
54
64
55
- self .session .default_consistency_level = ConsistencyLevel .LOCAL_ONE
56
65
self .assertEqual (self .logger_handler .get_message_count ("error" , "" ), 0 )
57
66
58
67
@two_to_three_path
@@ -101,16 +110,17 @@ def test_can_write(self):
101
110
"""
102
111
self .start_upgrade (0 )
103
112
113
+ self .cluster_driver .add_execution_profile ("all" , ExecutionProfile (consistency_level = ConsistencyLevel .ALL ))
114
+ self .cluster_driver .add_execution_profile ("one" , ExecutionProfile (consistency_level = ConsistencyLevel .LOCAL_ONE ))
115
+
104
116
c = count ()
105
117
while not self .is_upgraded ():
106
- self .session .execute ("INSERT INTO test3rf.test(k, v) VALUES (%s, 0)" , (next (c ),))
118
+ self .session .execute ("INSERT INTO test3rf.test(k, v) VALUES (%s, 0)" , (next (c ),), execution_profile = "one" )
107
119
time .sleep (0.0001 )
108
120
109
- self .session .default_consistency_level = ConsistencyLevel .ALL
110
- total_number_of_inserted = self .session .execute ("SELECT COUNT(*) from test3rf.test" )[0 ][0 ]
121
+ total_number_of_inserted = self .session .execute ("SELECT COUNT(*) from test3rf.test" , execution_profile = "all" )[0 ][0 ]
111
122
self .assertEqual (total_number_of_inserted , next (c ))
112
123
113
- self .session .default_consistency_level = ConsistencyLevel .LOCAL_ONE
114
124
self .assertEqual (self .logger_handler .get_message_count ("error" , "" ), 0 )
115
125
116
126
@two_to_three_path
@@ -261,7 +271,7 @@ def test_can_write_speculative(self):
261
271
cluster = Cluster ()
262
272
self .addCleanup (cluster .shutdown )
263
273
cluster .add_execution_profile ("spec_ep_rr" , spec_ep_rr )
264
-
274
+ cluster . add_execution_profile ( "all" , ExecutionProfile ( consistency_level = ConsistencyLevel . ALL ))
265
275
session = cluster .connect ()
266
276
267
277
self .start_upgrade (0 )
@@ -272,8 +282,7 @@ def test_can_write_speculative(self):
272
282
execution_profile = 'spec_ep_rr' )
273
283
time .sleep (0.0001 )
274
284
275
- session .default_consistency_level = ConsistencyLevel .ALL
276
- total_number_of_inserted = session .execute ("SELECT COUNT(*) from test3rf.test" )[0 ][0 ]
285
+ total_number_of_inserted = session .execute ("SELECT COUNT(*) from test3rf.test" , execution_profile = "all" )[0 ][0 ]
277
286
self .assertEqual (total_number_of_inserted , next (c ))
278
287
279
288
self .assertEqual (self .logger_handler .get_message_count ("error" , "" ), 0 )
0 commit comments