Skip to content

fix: unit tests for KIX and remove regional calls to boto #2640

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

Merged
merged 2 commits into from
Sep 15, 2021
Merged

fix: unit tests for KIX and remove regional calls to boto #2640

merged 2 commits into from
Sep 15, 2021

Conversation

shreyapandit
Copy link
Contributor

Issue #, if available:
https://tiny.amazon.com/1eo2abrqk

Description of changes:

Need to add KIX regional account ids for unit tests that are missing the same, and use local config for unit tests

Testing done:

Ran all unit tests

================== test session starts ===================================
platform darwin -- Python 3.8.3, pytest-6.0.2, py-1.10.0, pluggy-0.13.1
cachedir: .tox/py38/.pytest_cache
rootdir: /Users/pandishr/MLFrameworks/sagemaker-python-sdk, configfile: tox.ini
plugins: cov-2.12.1, xdist-2.3.0, rerunfailures-10.1, timeout-1.4.2, forked-1.3.0

==========5003 passed, 447 skipped, 1 xfailed, 1 xpassed, 3046 warnings in ==================

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

  • I have read the CONTRIBUTING doc
  • I used the commit message format described in CONTRIBUTING
  • I have passed the region in to all S3 and STS clients that I've initialized as part of this change.
  • I have updated any necessary documentation, including READMEs and API docs (if appropriate)

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)
  • I have used unique_name_from_base to create resource names in integ tests (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

algo = "lda"
accounts = _accounts_for_algo(algo)

for region in regions.regions():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactoring this test since it is a duplicacy and the LDA param can be instead pulled into the config and tested from above

uri = image_uris.retrieve(algo, region)
assert expected_uris.algo_uri(algo, accounts[region], region) == uri
else:
with pytest.raises(ValueError) as e:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing these if/else blocks because 1. The if is really filtering the regions and can be combined with the loop above, and since we are removing use of boto regions anyways this makes no sense.

The ValueError raised in else is not something that should be done in a test, especially if we are checking only supported regions, and seems redundant.

@ahsan-z-khan ahsan-z-khan changed the title remove boto region fetch call and use locals where applicable fix: remove boto region fetch call and use locals where applicable Sep 14, 2021
@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: 3d4ca89
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@shreyapandit shreyapandit changed the title fix: remove boto region fetch call and use locals where applicable fix: fixes unit tests for KIX and remove regional calls to boto Sep 14, 2021
@@ -78,7 +77,7 @@

@pytest.mark.parametrize("xgboost_framework_version", XGBOOST_FRAMEWORK_CPU_GPU_VERSIONS)
def test_xgboost_framework(xgboost_framework_version):
for region in regions.regions():
for region in FRAMEWORK_REGISTRIES.keys():
Copy link
Member

Choose a reason for hiding this comment

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

If we are removing regions.region what are we testing here now? Seems to me we are testing image_uris.retrieve() to expected_uris.framework_uri() which is unnecessary.

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: 3535d91
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@shreyapandit shreyapandit changed the title fix: fixes unit tests for KIX and remove regional calls to boto fix: unit tests for KIX and remove regional calls to boto Sep 15, 2021
@navinsoni navinsoni merged commit 985005e into aws:master Sep 15, 2021
jerrypeng7773 pushed a commit to jerrypeng7773/sagemaker-python-sdk that referenced this pull request Sep 24, 2021
* remove boto region fetch call and use locals where applicable
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.

4 participants