-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Update TextAnalytics to enable live testing in sovereign clouds for multiple services #22461
Conversation
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
@@ -47,6 +47,17 @@ | |||
# pre-apply the client_cls positional argument so it needn't be explicitly passed below | |||
TextAnalyticsClientPreparer = functools.partial(_TextAnalyticsClientPreparer, TextAnalyticsClient) | |||
|
|||
TextAnalyticsCustomPreparer = functools.partial( | |||
TextAnalyticsPreparer, | |||
textanalytics_custom_text_endpoint="https://fakeendpoint.cognitiveservices.azure.com", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these variables moved from the testcase to the test files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, they needed to be separated since these env vars don't exist in the UsGov/China cloud.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kristapratico @iscai-msft If I don't remove these variables, I'll get an error when rerun textanalytics weekly pipeline. Error message: azure_devtools.scenario_tests.preparers:preparers.py:82 Preparer failure when creating resource PowerShellPreparer for test <test_auth.TestAuth object at 0x111e26190>: 'TEXTANALYTICS_CUSTOM_TEXT_ENDPOINT'
For more details please check here.
For example test_auth.py::TestAuth::test_active_directory_auth
, I have debugged this test locally. When the code is executed to devtools_testutils/powershell_preparer.py , it will get the corresponding values of these variables ( in TextAnalyticsPreparer) from the environment variables one by one, if not, an exception will be thrown. Because the values of these variables are not passed in UsGov/China cloud, the test will fail before the testcase actually runs.
So I moved variables from the testcase to the test files. Or do you have better suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all your work on this @v-xuto!
@benbp Please review this PR when you are free. Thanks. |
Thank you @v-xuto! |
…into add_back_error_message * 'main' of https://github.com/Azure/azure-sdk-for-python: switch error str tests to in (Azure#22016) drop py27 support (Azure#22531) Update TextAnalytics to enable live testing in sovereign clouds for multiple services (Azure#22461) fix: body is too long when create github release (Azure#22522) [AutoRelease] t2-labservices-2022-01-10-05622 (Azure#22401) [ACR] Change to support python3.6 or above only (Azure#22325) Sync eng/common directory with azure-sdk-tools for PR 2554 (Azure#22515) [purview catalog] regen with guids rest name fix (Azure#22495) Migrate EG tests to test proxy (Azure#21772) [Test Proxy] Normalize paths in test IDs (Azure#22508) Add packages to $PackageExclusions which do not build properly in Docs CI (Azure#22493) Update Manifest Publishing (Azure#22476) Issue Azure#9324 by DaisyCisneros (Azure#21824)
…ultiple services (Azure#22461)
These changes enable textanalytics to run live tests against Public, UsGov and China.
So update
text_analytics = TextAnalyticsClient(textanalytics_test_endpoint, token)
in test_auth.py(async)to:
move
MatrixReplace: - TestSamples=.*/true
to the PublicCloud config in test.yaml, and skip these tests related to envtextanalytics_custom_text_endpoint
in usgov and china clouds.Besides, in order to solve the error:
KeyError: 'TEXTANALYTICS_CUSTOM_TEXT_ENDPOINT'
in most tests,add code
TextAnalyticsCustomPreparer
in filestest_analyze.py(async)
and updateTextAnalyticsPreparer
intestcase.py
.Pipeline results:
https://dev.azure.com/azure-sdk/internal/_build/results?buildId=1289623&view=results
@benbp, @kristapratico, @jameszliao-msft, @lmazuel, @meeraharidasa , @mayurid, @abhahn for notification.