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

azure-cli-core: Test failure in TestClientFactory.test_get_mgmt_service_client #23014

Open
major opened this issue Jun 24, 2022 · 3 comments
Open
Assignees
Labels
Account az login/account Auto-Assign Auto assign by bot customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request Packaging/RPM
Milestone

Comments

@major
Copy link
Contributor

major commented Jun 24, 2022

Related command
This is a failure while running azure-cli tests during RPM packaging in Fedora Linux.

Describe the bug
When I run tests for the azure-cli-core package, I get the following test failure:

________________ TestClientFactory.test_get_mgmt_service_client ________________
[gw3] linux -- Python 3.11.0 /usr/bin/python3

self = <azure.cli.core.commands.tests.test_client_factory.TestClientFactory testMethod=test_get_mgmt_service_client>

    def test_get_mgmt_service_client(self):
        cli = DummyCli()
>       client = get_mgmt_service_client(cli, ResourceType.MGMT_RESOURCE_RESOURCES)

src/azure-cli-core/azure/cli/core/commands/tests/test_client_factory.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/azure-cli-core/azure/cli/core/commands/client_factory.py:70: in get_mgmt_service_client
    client, _ = _get_mgmt_service_client(cli_ctx, client_type, subscription_id=subscription_id,
src/azure-cli-core/azure/cli/core/commands/client_factory.py:212: in _get_mgmt_service_client
    cred, subscription_id, _ = profile.get_login_credentials(subscription_id=subscription_id, resource=resource,
src/azure-cli-core/azure/cli/core/_profile.py:314: in get_login_credentials
    account = self.get_subscription(subscription_id)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <azure.cli.core._profile.Profile object at 0x7f4d431bb590>
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.

src/azure-cli-core/azure/cli/core/_profile.py:546: CLIError

To Reproduce
I run pytest src/azure-cli-core during an RPM build of azure-cli 2.37.0.

Expected behavior
I expected the test to pass. I even tried to add configuration files in ~/.azure, but this did not help.

Environment summary
Python 3.10.5 and 3.11.0b3 on Fedora Linux 36 and 37. The Debian package scripts skip this test, so I assume there is trouble with it there as well.

@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Account az login/account labels Jun 24, 2022
@ghost ghost assigned jiasli Jun 24, 2022
@ghost ghost added this to the Backlog milestone Jun 24, 2022
@major major changed the title Test failure: TestClientFactory.test_get_mgmt_service_client azure-cli-core: Test failure in TestClientFactory.test_get_mgmt_service_client Jun 24, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented Jun 25, 2022

@jiasli for awareness

@jiasli
Copy link
Member

jiasli commented Jun 27, 2022

Fedora RPM is not official supported yet (#22278), we are experiencing with Fedora 35 and 36 but encountered some difficulties (#22945) due to the Python library location change: https://docs.fedoraproject.org/en-US/fedora/latest/release-notes/developers/Development_Python/

@major
Copy link
Contributor Author

major commented Jun 27, 2022

I'm the current Fedora package maintainer for azure-cli and I'm doing my best to keep it updated, tested, and packaged. 😉

However, I run into this failing test whether I am doing the testing inside or outside an RPM build. This test is also skipped in the Debian package, so I would assume they are having issues with it, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account Auto-Assign Auto assign by bot customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request Packaging/RPM
Projects
None yet
Development

No branches or pull requests

3 participants