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

deploy manifest bundle test #395

Merged
merged 9 commits into from
Apr 27, 2023
Merged

deploy manifest bundle test #395

merged 9 commits into from
Apr 27, 2023

Conversation

bcwu
Copy link
Contributor

@bcwu bcwu commented Mar 28, 2023

Intent

Add deploy manifest bundle test as part of #376

@github-actions
Copy link

github-actions bot commented Mar 28, 2023

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
4163 2589 62% 0% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: fcff994 by action🐍

@@ -1804,3 +1804,39 @@ def test_make_html_bundle():
"manifest.json",
]
assert multi_file_index_dir_extras_ans == json.loads(tar.extractfile("manifest.json").read().decode("utf-8"))


pyshiny_manifest_dir = os.path.join(cur_dir, "./testdata/pyshiny_with_manifest")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like this variable is being used.



pyshiny_manifest_dir = os.path.join(cur_dir, "./testdata/pyshiny_with_manifest")
pyshiny_manifest_file = os.path.join(cur_dir, "./testdata/pyshiny_with_manifest/manifest.json")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable doesn't need to be defined globally.

pyshiny_manifest_file = os.path.join(cur_dir, "./testdata/pyshiny_with_manifest/manifest.json")


def test_make_manifest_bundle():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unit test is leaky.

It testing that the subsequent calls to other methods (bundle_add_file, read_manifest_file, etc) are working as expected, more so than testing the guts of make_manifest_bundle. The subsequent calls should be mocked, and this test should validate that the logic internal to make_manifest_bundle is working as expected.

For example, what happens if the 'files' key is missing in the manifest object?

I haven't looked, but there should be other unit tests that bundle_add_file, etc, are working correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent is to replace manifest and bundle related functions with the Manifest and Bundle classes, so the purpose of these specific tests are to document existing end to end behaviors. A refactored make_manifest_bundle most likely won't have the same logic, but its outputs must still be consistent with the existing behavior.

@bcwu bcwu requested review from mmarchetti and removed request for mmarchetti April 11, 2023 14:59
@mmarchetti
Copy link
Contributor

This test is a good addition, but limited to the happy path. Can you add some failure cases to the tests? For example, one of the main failure modes I'd expect to see with manifest-based deployments is missing files - ones that existed when the manifest was created but don't any more. Are there other scenarios that might (reasonably) arise in a real client environment that could break manifest deployments?

tests/test_bundle.py Outdated Show resolved Hide resolved
tests/test_bundle.py Outdated Show resolved Hide resolved
@bcwu bcwu merged commit 005959d into master Apr 27, 2023
@bcwu bcwu deleted the bcwu-deploy-manifest-tests branch April 27, 2023 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants