Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 11 additions & 24 deletions tests/bwc/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,22 +258,20 @@ def _do_upgrade(self,
assert_busy(lambda: self.assert_green(conn, 'blob', 'b1'))
self.assertIsNotNone(container.get(digest))

accumulated_dynamic_column_names: list[str] = []
self._process_on_stop()
for version_def in versions[1:]:
timestamp = datetime.utcnow().isoformat(timespec='seconds')
print(f"{timestamp} Upgrade to: {version_def.version}")
self.assert_data_persistence(version_def, nodes, digest, paths, accumulated_dynamic_column_names)
self.assert_data_persistence(version_def, nodes, digest, paths)
# restart with latest version
version_def = versions[-1]
self.assert_data_persistence(version_def, nodes, digest, paths, accumulated_dynamic_column_names)
self.assert_data_persistence(version_def, nodes, digest, paths)

def assert_data_persistence(self,
version_def: VersionDef,
nodes: int,
digest: str,
paths: Iterable[str],
accumulated_dynamic_column_names: list[str]):
paths: Iterable[str]):
env = prepare_env(version_def.java_home)
version = version_def.version
cluster = self._new_cluster(version, nodes, data_paths=paths, settings=self.CLUSTER_SETTINGS, env=env)
Expand Down Expand Up @@ -305,26 +303,15 @@ def assert_data_persistence(self,
cursor.execute(f'select * from versioned."{table}"')
cursor.execute(f'insert into versioned."{table}" (id, col_int) values (?, ?)', [str(uuid4()), 1])

# to trigger `alter` stmt bug(https://github.com/crate/crate/pull/17178) that falsely updated the table's
# version created setting that resulted in oids instead of column names in resultsets
cursor.execute('ALTER TABLE doc.parted SET ("refresh_interval" = 900)')

# older versions had a bug that caused this to fail
# Test that partition and dynamic columns can be created
key = "t_" + version.replace('.', '_')
obj = {key: True}
args = (str(uuid4()), version, obj)
cursor.execute(
'INSERT INTO doc.parted (id, version, cols) VALUES (?, ?, ?)',
args
)
cursor.execute('REFRESH TABLE doc.parted')
accumulated_dynamic_column_names.append(key)
cursor.execute('SELECT cols FROM doc.parted')
result = cursor.fetchall()
for row in result:
for name in row[0].keys():
self.assertIn(name, accumulated_dynamic_column_names)
if version in ('latest-nightly', '3.2'):
# Test that partition and dynamic columns can be created
obj = {"t_" + version.replace('.', '_'): True}
args = (str(uuid4()), version, obj)
cursor.execute(
'INSERT INTO doc.parted (id, version, cols) values (?, ?, ?)',
args
)
self._process_on_stop()

def assert_green(self, conn: Connection, schema: str, table_name: str):
Expand Down