Skip to content

Commit 701a4d7

Browse files
pmkccopybara-github
authored andcommitted
Stop using pip to install azure-cli on ARM.
PiperOrigin-RevId: 830634171
1 parent 2a17bf7 commit 701a4d7

File tree

2 files changed

+9
-25
lines changed

2 files changed

+9
-25
lines changed

perfkitbenchmarker/linux_packages/azure_cli.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ def _PipInstall(vm):
7373
vm: Virtual Machine to install on.
7474
"""
7575
vm.Install('pip')
76-
# azure-cli updated requirements.txt dependency, but not setupu.py:
77-
# https://github.com/Azure/azure-cli/pull/26671
78-
vm.RemoteCommand('sudo pip3 install --upgrade azure-cli pyOpenSSL>=23.2.0')
76+
vm.RemoteCommand('sudo pip3 install --upgrade azure-cli')
7977

8078

8179
# https://packages.microsoft.com/repos/azure-cli/dists/
@@ -94,7 +92,7 @@ def AptInstall(vm):
9492
Args:
9593
vm: Virtual Machine to install on.
9694
"""
97-
if vm.is_aarch64 or vm.OS_TYPE not in SUPPORTED_APT_DISTROS:
95+
if vm.OS_TYPE not in SUPPORTED_APT_DISTROS:
9896
_PipInstall(vm)
9997
return
10098

tests/linux_packages/azure_cli_test.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
class AzureCliTest(unittest.TestCase):
2222

2323
def setUp(self):
24-
self.vm = mock.Mock()
24+
self.vm = mock.MagicMock(autospec=True)
25+
self.maxDiff = None
2526

2627
def assertCallArgsEqual(self, call_args_singles, mock_method):
2728
"""Compare the list of single arguments to all mocked calls in mock_method.
@@ -40,7 +41,7 @@ def assertCallArgsEqual(self, call_args_singles, mock_method):
4041
"""
4142
# convert from ['a', 'b'] into [(('a',),), (('b',),)]
4243
expected = [((arg,),) for arg in call_args_singles]
43-
self.assertEqual(expected, mock_method.call_args_list)
44+
self.assertSequenceEqual(expected, mock_method.call_args_list)
4445

4546
def assertInstallPackageCommandsEqual(self, expected_packages):
4647
# tests the calls to vm.InstallPackages(str)
@@ -88,30 +89,15 @@ def testYumInstall(self):
8889
self.assertOnlyKnownMethodsCalled('RemoteCommand', 'InstallPackages')
8990

9091
def testAptInstall(self):
91-
self.vm.RemoteCommand.return_value = ('wheezy', '')
92+
self.vm.OS_TYPE = 'ubuntu2404'
9293
azure_cli.AptInstall(self.vm)
93-
if self.vm.is_aarch64:
94-
self.assertRemoteCommandsEqual(
95-
['sudo pip3 install --upgrade azure-cli pyOpenSSL>=23.2.0']
96-
)
97-
return
9894
self.assertRemoteCommandsEqual([
99-
'lsb_release -cs',
100-
(
101-
'echo "deb [arch=amd64]'
102-
' https://packages.microsoft.com/repos/azure-cli/ wheezy main"'
103-
' | sudo tee /etc/apt/sources.list.d/azure-cli.list'
104-
),
105-
(
106-
'curl -L https://packages.microsoft.com/keys/microsoft.asc |'
107-
' sudo apt-key add -'
108-
),
95+
'curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash',
10996
'sudo apt-get update',
11097
])
111-
self.assertInstallPackageCommandsEqual(['apt-transport-https', 'azure-cli'])
112-
self.assertVmInstallCommandsEqual(['python', 'lsb_release', 'curl'])
98+
self.assertInstallPackageCommandsEqual(['curl'])
11399
self.assertOnlyKnownMethodsCalled(
114-
'RemoteCommand', 'Install', 'InstallPackages'
100+
'RemoteCommand', 'InstallPackages'
115101
)
116102

117103

0 commit comments

Comments
 (0)