Skip to content
Merged
Changes from 1 commit
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
21 changes: 6 additions & 15 deletions tests/bwc/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,6 @@ def get_test_paths():
yield versions


def path_repr(path: VersionDef) -> str:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was unused

"""
String representation of the upgrade path in the format::

from_version -> to_version
"""
versions = [v.version for v in path]
return f'{versions[0]} -> {versions[-1]}'


class StorageCompatibilityTest(NodeProvider, unittest.TestCase):

CLUSTER_SETTINGS = {
Expand Down Expand Up @@ -258,15 +248,16 @@ def _do_upgrade(self,

accumulated_dynamic_column_names: list[str] = []
self._process_on_stop()
for version_def in versions[1:]:
for idx, version_def in enumerate(versions[1:]):
timestamp = datetime.now(UTC).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(idx, version_def, nodes, digest, paths, accumulated_dynamic_column_names)

# restart with latest version
version_def = versions[-1]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In python the loop variables remain in scope with the values from the last iteration.

self.assert_data_persistence(version_def, nodes, digest, paths, accumulated_dynamic_column_names)
self.assert_data_persistence(idx, version_def, nodes, digest, paths, accumulated_dynamic_column_names)

def assert_data_persistence(self,
idx: int,
version_def: VersionDef,
nodes: int,
digest: str,
Expand All @@ -283,7 +274,7 @@ def assert_data_persistence(self,
version = version_def.version.replace(".", "_")
cursor.execute(CREATE_DOC_TABLE.replace(
"CREATE TABLE t1 (",
f'CREATE TABLE IF NOT EXISTS versioned."t{version}" ('
f'CREATE TABLE IF NOT EXISTS versioned."t{idx}" ('
))
cursor.execute('ALTER TABLE doc.t1 SET ("refresh_interval" = 4000)')
run_selects(cursor, version_def.version)
Expand Down