Skip to content

Commit

Permalink
Fixed deploy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-bdufour committed Jun 13, 2024
1 parent 166eae5 commit c5f0361
Showing 1 changed file with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions tests_integration/nativeapp/test_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def test_nativeapp_deploy_looks_for_prefix_matches(
)
project_definition_file["native_app"]["artifacts"].append("src")
project_definition_file["native_app"]["artifacts"].append(
"lib/parent/child"
{"src": "lib/parent", "dest": "parent-lib"}
)
snowflake_yml.write_text(yaml.dump(project_definition_file))

Expand All @@ -510,7 +510,7 @@ def test_nativeapp_deploy_looks_for_prefix_matches(
touch(str(project_dir / "lib/parent/child/b.py"))
touch(str(project_dir / "lib/parent/child/c/c.py"))

result = runner.invoke_with_connection_json(
result = runner.invoke_with_connection(
["app", "deploy", "-r", "app"],
env=TEST_ENV,
)
Expand All @@ -527,55 +527,72 @@ def test_nativeapp_deploy_looks_for_prefix_matches(
stage_files.json, {"name": "stage/setup_script.sql"}
)
assert contains_row_with(stage_files.json, {"name": "stage/README.md"})
assert not_contains_row_with(stage_files.json, {"name": "src/main.py"})
assert not_contains_row_with(
stage_files.json, {"name": "stage/src/main.py"}
)
assert not_contains_row_with(
stage_files.json, {"name": "stage/parent-lib/child/c/c.py"}
)

result = runner.invoke_with_connection_json(
result = runner.invoke_with_connection(
["app", "deploy", "-r", "lib/parent/child/c"],
env=TEST_ENV,
)
assert result.exit_code == 0
stage_files = runner.invoke_with_connection_json(
["stage", "list-files", f"{package_name}.{stage_name}"],
env=TEST_ENV,
)
assert contains_row_with(
stage_files.json, {"name": "lib/parent/child/c/c.py"}
stage_files.json, {"name": "stage/parent-lib/child/c/c.py"}
)
assert not_contains_row_with(
stage_files.json, {"name": "lib/parent/child/a.py"}
stage_files.json, {"name": "stage/parent-lib/child/a.py"}
)
assert not_contains_row_with(
stage_files.json, {"name": "lib/parent/child/b.py"}
stage_files.json, {"name": "stage/parent-lib/child/b.py"}
)

result = runner.invoke_with_connection_json(
result = runner.invoke_with_connection(
["app", "deploy", "lib/parent/child/a.py"],
env=TEST_ENV,
)
assert result.exit_code == 0
stage_files = runner.invoke_with_connection_json(
["stage", "list-files", f"{package_name}.{stage_name}"],
env=TEST_ENV,
)
assert contains_row_with(
stage_files.json, {"name": "lib/parent/child/c/c.py"}
stage_files.json, {"name": "stage/parent-lib/child/c/c.py"}
)
assert contains_row_with(
stage_files.json, {"name": "lib/parent/child/a.py"}
stage_files.json, {"name": "stage/parent-lib/child/a.py"}
)
assert not_contains_row_with(
stage_files.json, {"name": "lib/parent/child/b.py"}
stage_files.json, {"name": "stage/parent-lib/child/b.py"}
)

result = runner.invoke_with_connection_json(
result = runner.invoke_with_connection(
["app", "deploy", "lib", "-r"],
env=TEST_ENV,
)
assert result.exit_code == 0
stage_files = runner.invoke_with_connection_json(
["stage", "list-files", f"{package_name}.{stage_name}"],
env=TEST_ENV,
)
assert contains_row_with(
stage_files.json, {"name": "lib/parent/child/c/c.py"}
stage_files.json, {"name": "stage/parent-lib/child/c/c.py"}
)
assert contains_row_with(
stage_files.json, {"name": "lib/parent/child/a.py"}
stage_files.json, {"name": "stage/parent-lib/child/a.py"}
)
assert contains_row_with(
stage_files.json, {"name": "lib/parent/child/b.py"}
stage_files.json, {"name": "stage/parent-lib/child/b.py"}
)

finally:
result = runner.invoke_with_connection_json(
result = runner.invoke_with_connection(
["app", "teardown", "--force"],
env=TEST_ENV,
)
Expand Down

0 comments on commit c5f0361

Please sign in to comment.