Skip to content

Commit

Permalink
Fix app role None with ws commands (#1601)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-melnacouzi committed Sep 19, 2024
1 parent 209bc7e commit cb7bc80
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/snowflake/cli/_plugins/nativeapp/application_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def action_deploy(
app_name = model.fqn.identifier
debug_mode = model.debug
if model.meta:
app_role = getattr(model.meta, "role", ctx.default_role)
app_warehouse = getattr(model.meta, "warehouse", ctx.default_warehouse)
post_deploy_hooks = getattr(model.meta, "post_deploy", None)
app_role = model.meta.role or ctx.default_role
app_warehouse = model.meta.warehouse or ctx.default_warehouse
post_deploy_hooks = model.meta.post_deploy
else:
app_role = ctx.default_role
app_warehouse = ctx.default_warehouse
Expand Down
15 changes: 13 additions & 2 deletions tests_integration/nativeapp/test_post_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@


def run(runner, base_command, args):
# TODO Run "ws deploy --entity-id=app" once ApplicationEntity deploy is implemented
result = runner.invoke_with_connection_json(["app", "run"] + args)
if base_command == "ws":
result = runner.invoke_with_connection_json(
["ws", "deploy", "--entity-id", "app"] + args
)
else:
result = runner.invoke_with_connection_json(["app", "run"] + args)

assert result.exit_code == 0


Expand Down Expand Up @@ -92,6 +97,12 @@ def test_nativeapp_post_deploy(
is_versioned,
with_project_flag,
):

if base_command == "ws" and is_versioned:
pytest.skip(
"TODO: ws commands do not support deploying applications from versions yet"
)

version = "v1"
project_name = "myapp"
app_name = f"{project_name}_{default_username}{resource_suffix}"
Expand Down

0 comments on commit cb7bc80

Please sign in to comment.