-
Notifications
You must be signed in to change notification settings - Fork 3k
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
{Redis} Add support for 2022-06-01
API version
#24979
Conversation
Redis |
There're still two tests failing:
Also pls fix the credential scanner failure |
@evelyn-ys I have fixed the failing tests and credential scanning issue. |
2022-06-01
API version2022-06-01
API version
* upgrade azure-mgmt-redis to 14.1.0 * add preferred_data_archive_auth_method param * linked server updates * update redisVersion description * add sub for MI testing * update MI test to use begin_update * Changed update command to use begin_update as setter * use custom update setter * tests * formatting and comments * remove print statements * remove credentials * network test recordings
@@ -72,6 +74,11 @@ def cli_redis_update(cmd, instance, sku=None, vm_size=None): | |||
return update_params | |||
|
|||
|
|||
def custom_update_setter(client, resource_group_name, name, parameters): | |||
# Custom update setter is used to match behavior from when update was not a LRO | |||
return client.begin_update(resource_group_name, name, parameters).result(0) |
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.
According to the definition of azure.core.polling._poller.LROPoller.result
:
def result(self, timeout: Optional[float] = None) -> PollingReturnType_co:
"""Return the result of the long running operation, or
the result available after the specified timeout.
:param float timeout: Period of time to wait before getting back control.
:returns: The deserialized resource of the long running operation, if one is available.
:rtype: any or None
:raises ~azure.core.exceptions.HttpResponseError: Server problem with the query.
"""
self.wait(timeout)
return self._polling_method.resource()
The 0
in result(0)
makes the LROPoller
return immediately, causing intermittent CI failure:
2024-01-12T08:59:22.0016933Z =================================== FAILURES ===================================
2024-01-12T08:59:22.0017289Z ___________________ RedisCacheTests.test_redis_cache_update ____________________
2024-01-12T08:59:22.0019920Z [gw2] linux -- Python 3.11.5 /opt/az/bin/python3
2024-01-12T08:59:22.0020425Z /opt/az/lib/python3.11/site-packages/azure/cli/testsdk/base.py:145: in tearDown
2024-01-12T08:59:22.0020723Z super(ScenarioTest, self).tearDown()
2024-01-12T08:59:22.0020984Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2024-01-12T08:59:22.0021110Z
2024-01-12T08:59:22.0021390Z self = <command_modules.redis.tests.latest.test_redis_scenario.RedisCacheTests testMethod=test_redis_cache_update>
2024-01-12T08:59:22.0021580Z
2024-01-12T08:59:22.0021788Z def tearDown(self):
2024-01-12T08:59:22.0022010Z os.environ = self.original_env
2024-01-12T08:59:22.0022239Z # Autorest.Python 2.x
2024-01-12T08:59:22.0022527Z assert not [t for t in threading.enumerate() if t.name.startswith("AzureOperationPoller")], \
2024-01-12T08:59:22.0022994Z "You need to call 'result' or 'wait' on all AzureOperationPoller you have created"
2024-01-12T08:59:22.0023274Z # Autorest.Python 3.x
2024-01-12T08:59:22.0027370Z > assert not [t for t in threading.enumerate() if t.name.startswith("LROPoller")], \
2024-01-12T08:59:22.0028218Z "You need to call 'result' or 'wait' on all LROPoller you have created"
2024-01-12T08:59:22.0028728Z E AssertionError: You need to call 'result' or 'wait' on all LROPoller you have created
2024-01-12T08:59:22.0028890Z
2024-01-12T08:59:22.0029292Z /opt/az/lib/python3.11/site-packages/azure/cli/testsdk/scenario_tests/base.py:160: AssertionError
2024-01-12T08:59:22.0029744Z ------------- generated xml file: /azure_cli_test_result/redis.xml -------------
2024-01-12T08:59:22.0030074Z =========================== short test summary info ============================
2024-01-12T08:59:22.0030422Z FAILED tests/latest/test_redis_scenario.py::RedisCacheTests::test_redis_cache_update
No timeout should be given. result()
should be used instead, such as:
redis_resourse = client.begin_update(resource_group_name, cache_name, update_params).result() |
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.
Per the PR description:
Updating a cache (az redis update) is now a long running operation so it now calls begin_update instead of update. Implemented a customer setter function so as not to break current behavior.
I think it's be design to make the operation returning immediately. But they should use sdk_no_wait
instead of result(0)
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.
sdk_no_wait
turns off polling:
azure-cli/src/azure-cli-core/azure/cli/core/util.py
Lines 707 to 710 in a5198b5
def sdk_no_wait(no_wait, func, *args, **kwargs): | |
if no_wait: | |
kwargs.update({'polling': False}) | |
return func(*args, **kwargs) |
but result(0)
doesn't. result(0)
will make the result returned immediately, but SDK still keeps polling in the background.
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.
Hi @jiasli and @evelyn-ys, thanks for your work identifying this issue. Is the expectation that the service team make this change or is this going to be handled by the CLI team?
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.
appreciated that @austintolani you can create another PR to fix!
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.
Okay thanks @evelyn-ys. I am no longer on the Redis team so I don't think it's appropriate for me to make this change but I have forwarded this information to the Redis sub-team that owns the CLI.
Related command
az redis
Description
This PR adds supports for a new API version for Azure Cache for Redis (
2022-06-01
). Specifically, these changes include:azure-mgmt-redis
package to new version (14.1.0
), which updates all requests to use the new2022-06-01
API version--preferred-data-archive-method
toaz redis import
andaz redis export
operation.az redis server-link delete
) is now a long running operation so it now callsbegin_delete
instead ofdelete
. Linked server deletion behavior is unchanged for the user.az redis update
) is now a long running operation so it now callsbegin_update
instead ofupdate
. Implemented a customer setter function so as not to break current behavior.geoReplicatedPrimaryHostName
andprimaryHostName
.Testing Guide
Updating a cache (example below shows updating the SKU):
Linked server operations:
History Notes
[Redis]
az redis import/export
: Add new optional parameter--preferred-data-archive-method
[Redis]
az redis server-link
: Linked server has two new properties:geoReplicatedPrimaryHostName
andprimaryHostName
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.