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

{Role} Bump role_definitions API version to 2022-05-01-preview #26577

Merged
merged 2 commits into from
Aug 29, 2023

Conversation

jiasli
Copy link
Member

@jiasli jiasli commented Jun 1, 2023

Related command
az role

Description
Close #26429

Bump role_definitions API version to 2022-05-01-preview

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jun 1, 2023

️✔️AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.10
️✔️3.9
️✔️ams
️✔️latest
️✔️3.10
️✔️3.9
️✔️apim
️✔️latest
️✔️3.10
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.10
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️aro
️✔️latest
️✔️3.10
️✔️3.9
️✔️backup
️✔️latest
️✔️3.10
️✔️3.9
️✔️batch
️✔️latest
️✔️3.10
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.10
️✔️3.9
️✔️billing
️✔️latest
️✔️3.10
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.10
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.10
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️config
️✔️latest
️✔️3.10
️✔️3.9
️✔️configure
️✔️latest
️✔️3.10
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.10
️✔️3.9
️✔️container
️✔️latest
️✔️3.10
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.10
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️dla
️✔️latest
️✔️3.10
️✔️3.9
️✔️dls
️✔️latest
️✔️3.10
️✔️3.9
️✔️dms
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.10
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.10
️✔️3.9
️✔️find
️✔️latest
️✔️3.10
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.10
️✔️3.9
️✔️identity
️✔️latest
️✔️3.10
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️kusto
️✔️latest
️✔️3.10
️✔️3.9
️✔️lab
️✔️latest
️✔️3.10
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️maps
️✔️latest
️✔️3.10
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.10
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.10
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.10
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.10
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.10
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.10
️✔️3.9
️✔️profile
️✔️latest
️✔️3.10
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.10
️✔️3.9
️✔️redis
️✔️latest
️✔️3.10
️✔️3.9
️✔️relay
️✔️latest
️✔️3.10
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️role
️✔️latest
️✔️3.10
️✔️3.9
️✔️search
️✔️latest
️✔️3.10
️✔️3.9
️✔️security
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.10
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.10
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.10
️✔️3.9
️✔️sql
️✔️latest
️✔️3.10
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.10
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.10
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️util
️✔️latest
️✔️3.10
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jun 1, 2023

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@jiasli jiasli self-assigned this Jun 1, 2023
@ghost ghost requested a review from yonzhan June 1, 2023 05:41
@yonzhan
Copy link
Collaborator

yonzhan commented Jun 1, 2023

Role

@jiasli
Copy link
Member Author

jiasli commented Aug 14, 2023

random_config_dir=True added by #25689 makes tests under RoleAssignmentScenarioTest fail during live run, because the login context is lost:

self = <azure.cli.core._profile.Profile object at 0x7f36ec4d7b50>
subscription = None

    def get_subscription(self, subscription=None):  # take id or name
        subscriptions = self.load_cached_subscriptions()
        if not subscriptions:
>           raise CLIError(_AZ_LOGIN_MESSAGE)
E           knack.util.CLIError: Please run 'az login' to setup account.

This needs to be solved by #26475.

A temporary workaround is to remove random_config_dir=True while live run the tests (#26273 (comment)).

@jiasli
Copy link
Member Author

jiasli commented Aug 16, 2023

test_create_image_version_with_region_cvm_encryption fails during live run. @zhoxing-ms, could you please help take a look?

        self.cmd('sig image-version delete -g {rg} --gallery-name {gallery} --gallery-image-definition {image} --gallery-image-version {version}')
        time.sleep(60)  # service end latency
        self.cmd('sig image-definition delete -g {rg} --gallery-name {gallery} --gallery-image-definition {image}')
>       self.cmd('sig delete -g {rg} --gallery-name {gallery}')

src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:5996:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/azure-cli-testsdk/azure/cli/testsdk/base.py:175: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:250: in __init__
    self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:313: in _in_process_execute
    raise ex.exception
../py310/lib/python3.10/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/__init__.py:663: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/__init__.py:726: in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
src/azure-cli-core/azure/cli/core/commands/__init__.py:708: in _run_job
    result = LongRunningOperation(cmd_copy.cli_ctx, 'Starting {}'.format(cmd_copy.name))(result)
src/azure-cli-core/azure/cli/core/commands/__init__.py:1013: in __call__
    raise exception
src/azure-cli-core/azure/cli/core/commands/__init__.py:1000: in __call__
    result = poller.result()
src/azure-cli-core/azure/cli/core/aaz/_poller.py:108: in result
    self.wait(timeout)
../py310/lib/python3.10/site-packages/azure/core/tracing/decorator.py:78: in wrapper_use_tracer
    return func(*args, **kwargs)
src/azure-cli-core/azure/cli/core/aaz/_poller.py:130: in wait
    raise self._exception
src/azure-cli-core/azure/cli/core/aaz/_poller.py:83: in _start
    for polling_method in self._polling_generator:
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/_delete.py:58: in _execute_operations
    yield self.GalleriesDelete(ctx=self.ctx)()
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/_delete.py:103: in __call__
    return self.on_error(session.http_response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <azure.cli.command_modules.vm.aaz.latest.sig._delete.Delete.GalleriesDelete object at 0x7ff5e2cf29e0>
response = <RequestsTransportResponse: 409 Conflict, Content-Type: application/json; charset=utf-8>

    def on_error(self, response):
        """ handle errors in response
        """
        # raise common http errors
        error_type = self.error_map.get(response.status_code)
        if error_type:
>           raise error_type(response=response)
E           azure.core.exceptions.ResourceExistsError: (CannotDeleteResource) Cannot delete resource while nested resources exist. Some existing nested resource IDs include: 'Microsoft.Compute/galleries/gallery_miw2d4gvielf/images/image1'. Please delete all nested resources before deleting this resource.
E           Code: CannotDeleteResource
E           Message: Cannot delete resource while nested resources exist. Some existing nested resource IDs include: 'Microsoft.Compute/galleries/gallery_miw2d4gvielf/images/image1'. Please delete all nested resources before deleting this resource.

src/azure-cli-core/azure/cli/core/aaz/_operation.py:329: ResourceExistsError

@zhoxing-ms
Copy link
Contributor

test_create_image_version_with_region_cvm_encryption fails during live run. @zhoxing-ms Xing Zhou FTE, could you please help take a look?

@yanzhudd will help take a look at this test issue~

@yanzhudd
Copy link
Contributor

yanzhudd commented Aug 16, 2023

test_create_image_version_with_region_cvm_encryption fails during live run. @zhoxing-ms, could you please help take a look?

Hi @jiasli
it could be fixed by add the following codes after sig image-definition delete:

        if self.is_live:
            time.sleep(30)

@jiasli
Copy link
Member Author

jiasli commented Aug 23, 2023

#27222 introduces merge conflicts and makes recordings for acs invalid.

@@ -5993,6 +5993,7 @@ def test_create_image_version_with_region_cvm_encryption(self, resource_group, r
self.cmd('sig image-version delete -g {rg} --gallery-name {gallery} --gallery-image-definition {image} --gallery-image-version {version}')
time.sleep(60) # service end latency
self.cmd('sig image-definition delete -g {rg} --gallery-name {gallery} --gallery-image-definition {image}')
time.sleep(60)
Copy link
Member Author

Choose a reason for hiding this comment

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

An extra sleep is added to fix #26577 (comment) according to #26577 (comment).

time.sleep is patched during playback mode, so there is no need to add if self.is_live: check:

def patch_time_sleep_api(unit_test):
def _time_sleep_skip(*_):
return
mock_in_unit_test(unit_test, 'time.sleep', _time_sleep_skip)

@@ -256,7 +256,7 @@ def test_role_definition_scenario(self):
class RoleAssignmentScenarioTest(RoleScenarioTestBase):

def __init__(self, *arg, **kwargs):
super().__init__(*arg, random_config_dir=True, **kwargs)
super().__init__(*arg, **kwargs)
Copy link
Member Author

@jiasli jiasli Aug 24, 2023

Choose a reason for hiding this comment

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

random_config_dir=True needs to be removed according to #26577 (comment)

@bebound, should I revert it? If not, playback test may fail. If yes, live test will certainly fail, so other team member can't live run role module's tests.

I can also temporarily disable test_role_assignment_handle_conflicted_assignments to eliminate the root cause which writes to config file.

Copy link
Contributor

Choose a reason for hiding this comment

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

My preferred solution is to merge #26475.
This is a good chance to test it works. It only affect test, even if it contains bugs, it will not affect user.

@jiasli jiasli marked this pull request as ready for review August 24, 2023 06:36

@ResourceGroupPreparer(name_prefix='cli_role_assign')
@AllowLargeResponse()
def test_role_assignment_handle_conflicted_assignments(self, resource_group):
Copy link
Member Author

Choose a reason for hiding this comment

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

test_role_assignment_handle_conflicted_assignments is the only test that writes to config file. I moved it to a dedicated RoleAssignmentWithConfigScenarioTest so that other tests in RoleAssignmentScenarioTest won't need random_config_dir.

@jiasli jiasli merged commit 689cf6d into Azure:dev Aug 29, 2023
54 checks passed
@jiasli jiasli deleted the role_definitions branch August 29, 2023 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Blocked RBAC az role
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AZCli to start consuming 2022-05-01-preview Version API for role definitions CRUD
6 participants