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

SNOW-874787: Prevent future flakiness of packaging tests #967

Merged

Conversation

sfc-gh-vnayak
Copy link
Contributor

Please answer these questions before submitting your pull requests. Thanks!

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes #NNNN

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
  3. Please describe how your code solves the related issue.

    Please write a short description of how your code change solves the related issue.

@sfc-gh-vnayak sfc-gh-vnayak self-assigned this Jul 24, 2023
@sfc-gh-vnayak sfc-gh-vnayak added the NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md label Jul 24, 2023
valid_packages = self._get_available_versions_for_packages(
package_names=[v[0] for v in package_dict.values()],
package_table_name=package_table,
validate_package=validate_package,
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the code now sits in a utility function, it can be patched easily.

The goal here is to patch _get_available_versions_for_packages for certain package inputs (sktime, scikit-fuzzy) so that they are seen as custom packages forever (regardless of whether they are eventually added to Anaconda)

def get_available_versions_for_packages_patched(session):
# Save a reference to the original function
original_function = session._get_available_versions_for_packages
sentinel_version = "0.0.1"
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 sentinel version will be returned for sktime and scikit_fuzzy, if either of those packages are present.

IS_IN_STORED_PROC,
reason="Subprocess calls are not allowed within stored procedures",
)
def test_add_requirements_unsupported_usable_by_sproc(session, resources_path):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is moved into test_packaging.py from test_stored_procedure.py file as it references the scikit-fuzzy package

@sfc-gh-vnayak sfc-gh-vnayak marked this pull request as ready for review July 24, 2023 20:04
@sfc-gh-vnayak sfc-gh-vnayak requested a review from a team as a code owner July 24, 2023 20:04
@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Merging #967 (cfd728e) into main (d4589e7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #967   +/-   ##
=======================================
  Coverage   98.37%   98.37%           
=======================================
  Files          51       51           
  Lines        9180     9183    +3     
  Branches     1665     1666    +1     
=======================================
+ Hits         9031     9034    +3     
  Misses         59       59           
  Partials       90       90           
Files Changed Coverage Δ
src/snowflake/snowpark/session.py 98.84% <100.00%> (+<0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Comment on lines +626 to +627
# TODO: Use the database from fully qualified UDF name
if not session.get_current_database():
Copy link
Contributor

Choose a reason for hiding this comment

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

do you want to take care of the todo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what the TODO is about, it was in the codebase prior to my changes.

@sfc-gh-vnayak sfc-gh-vnayak merged commit e3e6094 into main Jul 24, 2023
41 of 42 checks passed
@sfc-gh-vnayak sfc-gh-vnayak deleted the vnayak-SNOW-874787-reduce-flakiness-of-package-tests branch July 24, 2023 22:30
@github-actions github-actions bot locked and limited conversation to collaborators Jul 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants