@@ -258,20 +258,22 @@ def _do_upgrade(self,
258
258
assert_busy (lambda : self .assert_green (conn , 'blob' , 'b1' ))
259
259
self .assertIsNotNone (container .get (digest ))
260
260
261
+ accumulated_dynamic_column_names : list [str ] = []
261
262
self ._process_on_stop ()
262
263
for version_def in versions [1 :]:
263
264
timestamp = datetime .utcnow ().isoformat (timespec = 'seconds' )
264
265
print (f"{ timestamp } Upgrade to: { version_def .version } " )
265
- self .assert_data_persistence (version_def , nodes , digest , paths )
266
+ self .assert_data_persistence (version_def , nodes , digest , paths , accumulated_dynamic_column_names )
266
267
# restart with latest version
267
268
version_def = versions [- 1 ]
268
- self .assert_data_persistence (version_def , nodes , digest , paths )
269
+ self .assert_data_persistence (version_def , nodes , digest , paths , accumulated_dynamic_column_names )
269
270
270
271
def assert_data_persistence (self ,
271
272
version_def : VersionDef ,
272
273
nodes : int ,
273
274
digest : str ,
274
- paths : Iterable [str ]):
275
+ paths : Iterable [str ],
276
+ accumulated_dynamic_column_names : list [str ]):
275
277
env = prepare_env (version_def .java_home )
276
278
version = version_def .version
277
279
cluster = self ._new_cluster (version , nodes , data_paths = paths , settings = self .CLUSTER_SETTINGS , env = env )
@@ -303,15 +305,26 @@ def assert_data_persistence(self,
303
305
cursor .execute (f'select * from versioned."{ table } "' )
304
306
cursor .execute (f'insert into versioned."{ table } " (id, col_int) values (?, ?)' , [str (uuid4 ()), 1 ])
305
307
308
+ # to trigger `alter` stmt bug(https://github.com/crate/crate/pull/17178) that falsely updated the table's
309
+ # version created setting that resulted in oids instead of column names in resultsets
310
+ cursor .execute ('ALTER TABLE doc.parted SET ("refresh_interval" = 900)' )
311
+
306
312
# older versions had a bug that caused this to fail
307
- if version in ('latest-nightly' , '3.2' ):
308
- # Test that partition and dynamic columns can be created
309
- obj = {"t_" + version .replace ('.' , '_' ): True }
310
- args = (str (uuid4 ()), version , obj )
311
- cursor .execute (
312
- 'INSERT INTO doc.parted (id, version, cols) values (?, ?, ?)' ,
313
- args
314
- )
313
+ # Test that partition and dynamic columns can be created
314
+ key = "t_" + version .replace ('.' , '_' )
315
+ obj = {key : True }
316
+ args = (str (uuid4 ()), version , obj )
317
+ cursor .execute (
318
+ 'INSERT INTO doc.parted (id, version, cols) VALUES (?, ?, ?)' ,
319
+ args
320
+ )
321
+ cursor .execute ('REFRESH TABLE doc.parted' )
322
+ accumulated_dynamic_column_names .append (key )
323
+ cursor .execute ('SELECT cols FROM doc.parted' )
324
+ result = cursor .fetchall ()
325
+ for row in result :
326
+ for name in row [0 ].keys ():
327
+ self .assertIn (name , accumulated_dynamic_column_names )
315
328
self ._process_on_stop ()
316
329
317
330
def assert_green (self , conn : Connection , schema : str , table_name : str ):
0 commit comments