azure-cli
azure-cli copied to clipboard
{CI} pre-install bicep in CI environment
Related command
Description
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature
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.
❌AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.11
️✔️3.9
️✔️ams
️✔️latest
️✔️3.11
️✔️3.9
️✔️apim
️✔️latest
️✔️3.11
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.11
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.11
️✔️3.9
️✔️aro
️✔️latest
️✔️3.11
️✔️3.9
️✔️backup
️✔️latest
️✔️3.11
️✔️3.9
️✔️batch
️✔️latest
️✔️3.11
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.11
️✔️3.9
️✔️billing
️✔️latest
️✔️3.11
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.11
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.11
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.11
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.11
️✔️3.9
️✔️config
️✔️latest
️✔️3.11
️✔️3.9
️✔️configure
️✔️latest
️✔️3.11
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.11
️✔️3.9
️✔️container
️✔️latest
️✔️3.11
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.11
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.11
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️dla
️✔️latest
️✔️3.11
️✔️3.9
️✔️dls
️✔️latest
️✔️3.11
️✔️3.9
️✔️dms
️✔️latest
️✔️3.11
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.11
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.11
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.11
️✔️3.9
️✔️find
️✔️latest
️✔️3.11
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.11
️✔️3.9
️✔️identity
️✔️latest
️✔️3.11
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️kusto
️✔️latest
️✔️3.11
️✔️3.9
️✔️lab
️✔️latest
️✔️3.11
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.11
️✔️3.9
️✔️maps
️✔️latest
️✔️3.11
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.11
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.11
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.11
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.11
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.11
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.11
️✔️3.9
️✔️profile
️✔️latest
️✔️3.11
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.11
️✔️3.9
️✔️redis
️✔️latest
️✔️3.11
️✔️3.9
️✔️relay
️✔️latest
️✔️3.11
️✔️3.9
❌resource
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
❌latest
❌3.11
Type Test Case Error Message Line Failed test_run_bicep_command_check_version self = <azure.cli.command_modules.resource.tests.latest.test_resource_bicep.TestBicep testMethod=test_run_bicep_command_check_version>
isfile_stub = <MagicMock name='isfile' id='140010097733072'>
get_bicep_installed_version_stub = <MagicMock name='get_bicep_installed_version' id='140010098293776'>
get_bicep_latest_release_tag_stub = <MagicMock name='get_bicep_latest_release_tag' id='140010098291408'>
ensure_bicep_installation_mock = <MagicMock name='ensure_bicep_installation' id='140010098376656'>
run_command_mock = <MagicMock name='run_command' id='140010098363088'>
warning_mock = <MagicMock name='warning' id='140010105588496'>
@mock.patch("azure.cli.command_modules.resource.bicep.logger.warning")
@mock.patch("azure.cli.command_modules.resource.bicep.run_command")
@mock.patch("azure.cli.command_modules.resource.bicep.ensure_bicep_installation")
@mock.patch("azure.cli.command_modules.resource.bicep.get_bicep_latest_release_tag")
@mock.patch("azure.cli.command_modules.resource.bicep.get_bicep_installed_version")
@mock.patch("os.path.isfile")
def test_run_bicep_command_check_version(
self,
isfile_stub,
get_bicep_installed_version_stub,
get_bicep_latest_release_tag_stub,
ensure_bicep_installation_mock,
run_command_mock,
warning_mock,
):
isfile_stub.return_value = True
get_bicep_installed_version_stub.return_value = semver.VersionInfo.parse("1.0.0")
get_bicep_latest_release_tag_stub.return_value = "v2.0.0"
self.cli_ctx.config.set_value("bicep", "check_version", "True")
self.cli_ctx.config.set_value("bicep", "use_binary_from_path", "false")
run_bicep_command(self.cli_ctx, ["--version"])
> warning_mock.assert_called_once_with(
'A new Bicep release is available: %s. Upgrade now by running "az bicep upgrade".',
"v2.0.0",
)
src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py:120:
_
self = <MagicMock name='warning' id='140010105588496'>
args = ('A new Bicep release is available: %s. Upgrade now by running "az bicep upgrade".', 'v2.0.0')
kwargs = {}, msg = "Expected 'warning' to be called once. Called 0 times."
def assert_called_once_with(self, /, *args, **kwargs):
"""assert that the mock was called exactly once and that that call was
with the specified arguments."""
if not self.call_count == 1:
msg = ("Expected '%s' to be called once. Called %s times.%s"
% (self._mock_name or 'mock',
self.call_count,
self._calls_repr()))
> raise AssertionError(msg)
E AssertionError: Expected 'warning' to be called once. Called 0 times.
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/unittest/mock.py:950: AssertionErrorazure/cli/command_modules/resource/tests/latest/test_resource_bicep.py:96 ❌3.9
Type Test Case Error Message Line Failed test_run_bicep_command_check_version self = <azure.cli.command_modules.resource.tests.latest.test_resource_bicep.TestBicep testMethod=test_run_bicep_command_check_version>
isfile_stub = <MagicMock name='isfile' id='139712817489760'>
get_bicep_installed_version_stub = <MagicMock name='get_bicep_installed_version' id='139712817666128'>
get_bicep_latest_release_tag_stub = <MagicMock name='get_bicep_latest_release_tag' id='139712819259232'>
ensure_bicep_installation_mock = <MagicMock name='ensure_bicep_installation' id='139712817491104'>
run_command_mock = <MagicMock name='run_command' id='139712817586288'>
warning_mock = <MagicMock name='warning' id='139712819285872'>
@mock.patch("azure.cli.command_modules.resource.bicep.logger.warning")
@mock.patch("azure.cli.command_modules.resource.bicep.run_command")
@mock.patch("azure.cli.command_modules.resource.bicep.ensure_bicep_installation")
@mock.patch("azure.cli.command_modules.resource.bicep.get_bicep_latest_release_tag")
@mock.patch("azure.cli.command_modules.resource.bicep.get_bicep_installed_version")
@mock.patch("os.path.isfile")
def test_run_bicep_command_check_version(
self,
isfile_stub,
get_bicep_installed_version_stub,
get_bicep_latest_release_tag_stub,
ensure_bicep_installation_mock,
run_command_mock,
warning_mock,
):
isfile_stub.return_value = True
get_bicep_installed_version_stub.return_value = semver.VersionInfo.parse("1.0.0")
get_bicep_latest_release_tag_stub.return_value = "v2.0.0"
self.cli_ctx.config.set_value("bicep", "check_version", "True")
self.cli_ctx.config.set_value("bicep", "use_binary_from_path", "false")
run_bicep_command(self.cli_ctx, ["--version"])
> warning_mock.assert_called_once_with(
'A new Bicep release is available: %s. Upgrade now by running "az bicep upgrade".',
"v2.0.0",
)
src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py:120:
_
self = <MagicMock name='warning' id='139712819285872'>
args = ('A new Bicep release is available: %s. Upgrade now by running "az bicep upgrade".', 'v2.0.0')
kwargs = {}, msg = "Expected 'warning' to be called once. Called 0 times."
def assert_called_once_with(self, /, *args, **kwargs):
"""assert that the mock was called exactly once and that that call was
with the specified arguments."""
if not self.call_count == 1:
msg = ("Expected '%s' to be called once. Called %s times.%s"
% (self._mock_name or 'mock',
self.call_count,
self._calls_repr()))
> raise AssertionError(msg)
E AssertionError: Expected 'warning' to be called once. Called 0 times.
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/unittest/mock.py:918: AssertionErrorazure/cli/command_modules/resource/tests/latest/test_resource_bicep.py:96 ️✔️role
️✔️latest
️✔️3.11
️✔️3.9
️✔️search
️✔️latest
️✔️3.11
️✔️3.9
️✔️security
️✔️latest
️✔️3.11
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.11
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.11
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.11
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.11
️✔️3.9
️✔️sql
️✔️latest
️✔️3.11
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.11
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.11
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️util
️✔️latest
️✔️3.11
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes
CI