Skip to content

Commit 2a0e681

Browse files
committed
Create new table on each version during BWC upgrade tests
Some logic in CrateDB is table version specific, this helps cover more mixed table version scenarios.
1 parent b49d21d commit 2a0e681

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/bwc/test_upgrade.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def _test_upgrade_path(self, versions: Tuple[VersionDef, ...], nodes: int):
211211
f.truncate()
212212
f.close()
213213

214-
@timeout(900)
214+
@timeout(1200)
215215
def _do_upgrade(self,
216216
cluster: CrateCluster,
217217
nodes: int,
@@ -246,7 +246,7 @@ def _do_upgrade(self,
246246
self._process_on_stop()
247247
for version_def in versions[1:]:
248248
timestamp = datetime.utcnow().isoformat(timespec='seconds')
249-
print(f"{timestamp} Upgrade to:: {version_def.version}")
249+
print(f"{timestamp} Upgrade to: {version_def.version}")
250250
self.assert_data_persistence(version_def, nodes, digest, paths)
251251
# restart with latest version
252252
version_def = versions[-1]
@@ -265,6 +265,11 @@ def assert_data_persistence(self,
265265
assert_busy(lambda: self.assert_nodes(conn, nodes))
266266
cursor = conn.cursor()
267267
wait_for_active_shards(cursor, 0)
268+
version = version_def.version.replace(".", "_")
269+
cursor.execute(CREATE_DOC_TABLE.replace(
270+
"CREATE TABLE t1 (",
271+
f'CREATE TABLE IF NOT EXISTS versioned."t{version}" ('
272+
))
268273
cursor.execute('ALTER TABLE doc.t1 SET ("refresh_interval" = 4000)')
269274
run_selects(cursor, version_def.version)
270275
container = conn.get_blob_container('b1')
@@ -277,6 +282,12 @@ def assert_data_persistence(self,
277282
cursor.execute("select * from sys.privileges")
278283
self.assertEqual(cursor.fetchall(), [["TABLE", "trillian", "crate", "doc.t1", "GRANT", "DQL"]])
279284

285+
cursor.execute("select table_name from information_schema.tables where table_schema = 'versioned'")
286+
tables = [row[0] for row in cursor.fetchall()]
287+
for table in tables:
288+
cursor.execute(f'select * from versioned."{table}"')
289+
cursor.execute(f'insert into versioned."{table}" (id, col_int) values (?, ?)', [str(uuid4()), 1])
290+
280291
# older versions had a bug that caused this to fail
281292
if version in ('latest-nightly', '3.2'):
282293
# Test that partition and dynamic columns can be created

0 commit comments

Comments
 (0)