Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-pjafari committed Dec 18, 2024
1 parent a225d44 commit b94bad5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 28 deletions.
4 changes: 2 additions & 2 deletions tests_integration/nativeapp/__snapshots__/test_deploy.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
Local changes to be deployed:
added: app/v2/README.md -> README.md
added: app/v2/manifest.yml -> manifest.yml
added: app/v2/setup_script.sql -> setup_script.sql
added: app/v2/setup.sql -> setup.sql
Updating the Snowflake stage from your local @@DEPLOY_ROOT@@/v2 directory.
Validating Snowflake Native App setup script.
Deployed successfully. Application package and stage are up-to-date.
Expand Down Expand Up @@ -230,7 +230,7 @@
Local changes to be deployed:
added: app/v1/README.md -> README.md
added: app/v1/manifest.yml -> manifest.yml
added: app/v1/setup_script.sql -> setup_script.sql
added: app/v1/setup.sql -> setup.sql
Updating the Snowflake stage from your local @@DEPLOY_ROOT@@/v1 directory.
Validating Snowflake Native App setup script.
Deployed successfully. Application package and stage are up-to-date.
Expand Down
9 changes: 6 additions & 3 deletions tests_integration/nativeapp/test_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
from tests_integration.testing_utils import (
assert_that_result_failed_with_message_containing,
)
from tests_integration.testing_utils.project_fixtures import *
from tests_integration.testing_utils.project_fixtures import (
setup_v2_project_w_subdir_w_snowpark,
setup_v2_project_w_subdir,
)


@pytest.fixture
Expand Down Expand Up @@ -336,7 +339,7 @@ def test_nativeapp_can_bundle_with_subdirs(

deploy_root = Path(project_root, "output", "deploy", subdir)
assert Path(deploy_root, "manifest.yml").is_file()
assert Path(deploy_root, "setup_script.sql").is_file()
assert Path(deploy_root, "setup.sql").is_file()
assert Path(deploy_root, "README.md").is_file()


Expand All @@ -356,7 +359,7 @@ def test_nativeapp_bundle_subdirs_dont_overwrite(
for subdir in ["v1", "v2"]:
deploy_root = Path(project_root, "output", "deploy", subdir)
assert Path(deploy_root, "manifest.yml").is_file()
assert Path(deploy_root, "setup_script.sql").is_file()
assert Path(deploy_root, "setup.sql").is_file()
assert Path(deploy_root, "README.md").is_file()
assert Path(deploy_root, f"module-echo-{subdir}").is_dir()
assert Path(
Expand Down
8 changes: 3 additions & 5 deletions tests_integration/nativeapp/test_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from snowflake.cli.api.project.util import TEST_RESOURCE_SUFFIX_VAR
from tests.nativeapp.utils import touch
from tests_integration.testing_utils.project_fixtures import *
from tests_integration.testing_utils.project_fixtures import setup_v2_project_w_subdir
from tests.project.fixtures import *
from tests_integration.test_utils import (
contains_row_with,
Expand Down Expand Up @@ -378,7 +378,7 @@ def test_nativeapp_deploy_files_w_stage_subdir(
[
*split("app deploy --package-entity-id=pkg_v2"),
"app/v2/manifest.yml",
"app/v2/setup_script.sql",
"app/v2/setup.sql",
"app/v2/README.md",
]
)
Expand All @@ -392,9 +392,7 @@ def test_nativeapp_deploy_files_w_stage_subdir(
["stage", "list-files", f"{package_name}.{stage_name}"]
)
assert contains_row_with(stage_files.json, {"name": "stage/v2/manifest.yml"})
assert contains_row_with(
stage_files.json, {"name": "stage/v2/setup_script.sql"}
)
assert contains_row_with(stage_files.json, {"name": "stage/v2/setup.sql"})
assert contains_row_with(stage_files.json, {"name": "stage/v2/README.md"})
assert not_contains_row_with(stage_files.json, {"name": "stage/v2/file.txt"})

Expand Down
2 changes: 1 addition & 1 deletion tests_integration/nativeapp/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
)
from tests.project.fixtures import *
from tests_integration.test_utils import contains_row_with, row_from_snowflake_session
from tests_integration.testing_utils.project_fixtures import *
from tests_integration.testing_utils.project_fixtures import setup_v2_project_w_subdir

# A minimal set of fields to compare when checking version output
VERSION_FIELDS_TO_OUTPUT = [
Expand Down
23 changes: 6 additions & 17 deletions tests_integration/testing_utils/project_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,11 @@
ProjectV2Factory,
ApplicationPackageEntityModelFactory,
ApplicationEntityModelFactory,
ManifestFactory,
)


MANIFEST_BASIC = dedent(
"""\
manifest_version: 1
version:
name: dev
artifacts:
setup_script: setup_script.sql
readme: README.md
extension_code: true
"""
)
MANIFEST_BASIC = ManifestFactory()

PYTHON_W_SNOWPARK = dedent(
"""\
Expand Down Expand Up @@ -72,10 +61,10 @@ def wrapper():
files={
"app/v1/manifest.yml": MANIFEST_BASIC,
"app/v1/README.md": readme_v1,
"app/v1/setup_script.sql": "SELECT 1;",
"app/v1/setup.sql": "SELECT 1;",
"app/v2/manifest.yml": MANIFEST_BASIC,
"app/v2/README.md": readme_v2,
"app/v2/setup_script.sql": "SELECT 1;",
"app/v2/setup.sql": "SELECT 1;",
},
)
return project_name, temp_dir
Expand Down Expand Up @@ -124,11 +113,11 @@ def wrapper():
files={
"app/v1/manifest.yml": MANIFEST_BASIC,
"app/v1/README.md": "\n",
"app/v1/setup_script.sql": setup_script,
"app/v1/setup.sql": setup_script,
"app/v1/module-echo-v1/echo-v1.py": PYTHON_W_SNOWPARK,
"app/v2/manifest.yml": MANIFEST_BASIC,
"app/v2/README.md": "\n",
"app/v2/setup_script.sql": setup_script,
"app/v2/setup.sql": setup_script,
"app/v2/module-echo-v2/echo-v2.py": PYTHON_W_SNOWPARK,
},
)
Expand Down

0 comments on commit b94bad5

Please sign in to comment.