Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make version test resilient to new fields #1918

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 0 additions & 6 deletions tests_integration/nativeapp/__snapshots__/test_version.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,18 @@
list([
dict({
'comment': None,
'dropped_on': None,
'label': '',
'log_level': 'OFF',
'patch': 0,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
dict({
'comment': None,
'dropped_on': None,
'label': '',
'log_level': 'OFF',
'patch': 1,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
])
Expand Down
19 changes: 15 additions & 4 deletions tests_integration/nativeapp/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@
from tests_integration.test_utils import contains_row_with, row_from_snowflake_session


# A minimal set of fields to compare when checking version output
VERSION_FIELDS_TO_OUTPUT = [
"comment",
"label",
"patch",
"review_status",
"state",
"version",
]


def set_version_in_app_manifest(manifest_path: Path, version: Any, patch: Any = None):
with open(manifest_path, "r") as f:
manifest = safe_load(f)
Expand Down Expand Up @@ -373,10 +384,10 @@ def test_nativeapp_version_create_package_no_magic_comment(
# app package contains version v1 with 2 patches
actual = runner.invoke_with_connection_json(split(list_command))
for row in actual.json:
# Remove date field
row.pop("created_on", None)
# Remove metric_level field
row.pop("metric_level", None)
keys_to_remove = row.keys() - VERSION_FIELDS_TO_OUTPUT
for key in keys_to_remove:
del row[key]

assert actual.json == snapshot


Expand Down
Loading