Skip to content

Commit

Permalink
Fix snow ws version drop using the wrong action (#1703)
Browse files Browse the repository at this point in the history
Fixes `snow ws version drop` accidentally performing the `VERSION_CREATE` action. Parametrized tests to use both `snow app version` and `snow ws version` commands, except for unsupported use-cases (`ws` command with a v1 project).
  • Loading branch information
sfc-gh-fcampbell authored Oct 11, 2024
1 parent 6823000 commit 0dbb551
Show file tree
Hide file tree
Showing 3 changed files with 286 additions and 68 deletions.
2 changes: 1 addition & 1 deletion src/snowflake/cli/_plugins/workspace/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def version_drop(
)
ws.perform_action(
entity_id,
EntityActions.VERSION_CREATE,
EntityActions.VERSION_DROP,
version=version,
interactive=interactive,
force=force,
Expand Down
234 changes: 234 additions & 0 deletions tests_integration/nativeapp/__snapshots__/test_version.ambr
Original file line number Diff line number Diff line change
@@ -1,4 +1,134 @@
# serializer version: 1
# name: test_nativeapp_version_create_package_no_magic_comment[app version create-app version list-app version drop-napp_init_v1]
list([
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 0,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 1,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
])
# ---
# name: test_nativeapp_version_create_package_no_magic_comment[app version create-app version list-app version drop-napp_init_v2]
list([
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 0,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 1,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
])
# ---
# name: test_nativeapp_version_create_package_no_magic_comment[app version create-app version list-ws version drop --entity-id=pkg-napp_init_v2]
list([
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 0,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 1,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
])
# ---
# name: test_nativeapp_version_create_package_no_magic_comment[app version create-ws version list --entity-id=pkg-app version drop-napp_init_v2]
list([
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 0,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 1,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
])
# ---
# name: test_nativeapp_version_create_package_no_magic_comment[app version create-ws version list --entity-id=pkg-ws version drop --entity-id=pkg-napp_init_v2]
list([
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 0,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 1,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
])
# ---
# name: test_nativeapp_version_create_package_no_magic_comment[app version list-napp_init_v1]
list([
dict({
Expand Down Expand Up @@ -51,6 +181,110 @@
}),
])
# ---
# name: test_nativeapp_version_create_package_no_magic_comment[ws version create --entity-id=pkg-app version list-app version drop-napp_init_v2]
list([
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 0,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 1,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
])
# ---
# name: test_nativeapp_version_create_package_no_magic_comment[ws version create --entity-id=pkg-app version list-ws version drop --entity-id=pkg-napp_init_v2]
list([
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 0,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 1,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
])
# ---
# name: test_nativeapp_version_create_package_no_magic_comment[ws version create --entity-id=pkg-ws version list --entity-id=pkg-app version drop-napp_init_v2]
list([
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 0,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 1,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
])
# ---
# name: test_nativeapp_version_create_package_no_magic_comment[ws version create --entity-id=pkg-ws version list --entity-id=pkg-ws version drop --entity-id=pkg-napp_init_v2]
list([
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 0,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
dict({
'comment': None,
'dropped_on': None,
'label': None,
'log_level': 'OFF',
'patch': 1,
'review_status': 'NOT_REVIEWED',
'state': 'READY',
'trace_level': 'OFF',
'version': 'V1',
}),
])
# ---
# name: test_nativeapp_version_create_package_no_magic_comment[ws version list --entity-id=pkg-napp_init_v2]
list([
dict({
Expand Down
Loading

0 comments on commit 0dbb551

Please sign in to comment.