From 06836a87a72c6197dd55a347dc52da3a647f2b17 Mon Sep 17 00:00:00 2001 From: Fuming Zhang Date: Fri, 7 Apr 2023 18:07:12 +0800 Subject: [PATCH 1/5] fix test --- .../acs/tests/hybrid_2020_09_01/test_custom.py | 6 +++--- .../cli/command_modules/acs/tests/latest/test_custom.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py b/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py index 521e2f77396..ed66f342dec 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py @@ -645,7 +645,7 @@ def test_k8s_install_kubelogin_emit_warnings(self, logger_mock, mock_url_retriev try: temp_dir = os.path.realpath(tempfile.mkdtemp()) # tempfile.TemporaryDirectory() is no available on 2.7 test_location = os.path.join(temp_dir, 'kubelogin') - k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location) + k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location, arch="amd64") self.assertEqual(mock_url_retrieve.call_count, 1) # 3 warnings, 1st for arch, 2nd for download result, 3rd for updating PATH self.assertEqual(logger_mock.warning.call_count, 3) # 3 warnings, one for download result @@ -659,7 +659,7 @@ def test_k8s_install_kubelogin_create_installation_dir(self, logger_mock, mock_u try: temp_dir = tempfile.mkdtemp() # tempfile.TemporaryDirectory() is no available on 2.7 test_location = os.path.join(temp_dir, 'foo', 'kubelogin') - k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location) + k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location, arch="amd64") self.assertTrue(os.path.exists(test_location)) finally: shutil.rmtree(temp_dir) @@ -688,7 +688,7 @@ def test_k8s_install_kubelogin_with_custom_source_url(self, logger_mock, mock_ur test_location = os.path.join(temp_dir, 'foo', 'kubelogin') test_ver = '1.2.6' test_source_url = 'http://url2' - k8s_install_kubelogin(mock.MagicMock(), client_version=test_ver, install_location=test_location, source_url=test_source_url) + k8s_install_kubelogin(mock.MagicMock(), client_version=test_ver, install_location=test_location, source_url=test_source_url, arch="amd64") mock_url_retrieve.assert_called_with(mockUrlretrieveUrlValidator(test_source_url, test_ver), mock.ANY) finally: shutil.rmtree(temp_dir) diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py index 872d6fedb7c..07df5892b95 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py @@ -629,7 +629,7 @@ def test_k8s_install_kubelogin_emit_warnings(self, logger_mock, mock_url_retriev try: temp_dir = os.path.realpath(tempfile.mkdtemp()) # tempfile.TemporaryDirectory() is no available on 2.7 test_location = os.path.join(temp_dir, 'kubelogin') - k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location) + k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location, arch="amd64") self.assertEqual(mock_url_retrieve.call_count, 1) # 3 warnings, 1st for arch, 2nd for download result, 3rd for updating PATH self.assertEqual(logger_mock.warning.call_count, 3) # 3 warnings, one for download result @@ -643,7 +643,7 @@ def test_k8s_install_kubelogin_create_installation_dir(self, logger_mock, mock_u try: temp_dir = tempfile.mkdtemp() # tempfile.TemporaryDirectory() is no available on 2.7 test_location = os.path.join(temp_dir, 'foo', 'kubelogin') - k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location) + k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location, arch="amd64") self.assertTrue(os.path.exists(test_location)) finally: shutil.rmtree(temp_dir) @@ -672,7 +672,7 @@ def test_k8s_install_kubelogin_with_custom_source_url(self, logger_mock, mock_ur test_location = os.path.join(temp_dir, 'foo', 'kubelogin') test_ver = '1.2.6' test_source_url = 'http://url2' - k8s_install_kubelogin(mock.MagicMock(), client_version=test_ver, install_location=test_location, source_url=test_source_url) + k8s_install_kubelogin(mock.MagicMock(), client_version=test_ver, install_location=test_location, source_url=test_source_url, arch="amd64") mock_url_retrieve.assert_called_with(MockUrlretrieveUrlValidator(test_source_url, test_ver), mock.ANY) finally: shutil.rmtree(temp_dir) From 2b0ce53779779c4a54c7e21c80dff26f229ee782 Mon Sep 17 00:00:00 2001 From: Fuming Zhang Date: Fri, 7 Apr 2023 18:53:48 +0800 Subject: [PATCH 2/5] fix 2 --- .../command_modules/acs/tests/hybrid_2020_09_01/test_custom.py | 2 +- .../azure/cli/command_modules/acs/tests/latest/test_custom.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py b/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py index ed66f342dec..597aa81ce3e 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py @@ -647,7 +647,7 @@ def test_k8s_install_kubelogin_emit_warnings(self, logger_mock, mock_url_retriev test_location = os.path.join(temp_dir, 'kubelogin') k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location, arch="amd64") self.assertEqual(mock_url_retrieve.call_count, 1) - # 3 warnings, 1st for arch, 2nd for download result, 3rd for updating PATH + # 2 warnings, 1st for download result, 2nd for updating PATH self.assertEqual(logger_mock.warning.call_count, 3) # 3 warnings, one for download result finally: shutil.rmtree(temp_dir) diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py index 07df5892b95..9e4146b5055 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py @@ -631,7 +631,7 @@ def test_k8s_install_kubelogin_emit_warnings(self, logger_mock, mock_url_retriev test_location = os.path.join(temp_dir, 'kubelogin') k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location, arch="amd64") self.assertEqual(mock_url_retrieve.call_count, 1) - # 3 warnings, 1st for arch, 2nd for download result, 3rd for updating PATH + # 2 warnings, 1st for download result, 2nd for updating PATH self.assertEqual(logger_mock.warning.call_count, 3) # 3 warnings, one for download result finally: shutil.rmtree(temp_dir) From 390884c7f2ad85a16f547a462af272e5a8170b24 Mon Sep 17 00:00:00 2001 From: Fuming Zhang Date: Fri, 7 Apr 2023 19:05:07 +0800 Subject: [PATCH 3/5] fix 3 --- .../command_modules/acs/tests/hybrid_2020_09_01/test_custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py b/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py index 597aa81ce3e..fd3e7e70ecb 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_custom.py @@ -648,7 +648,7 @@ def test_k8s_install_kubelogin_emit_warnings(self, logger_mock, mock_url_retriev k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location, arch="amd64") self.assertEqual(mock_url_retrieve.call_count, 1) # 2 warnings, 1st for download result, 2nd for updating PATH - self.assertEqual(logger_mock.warning.call_count, 3) # 3 warnings, one for download result + self.assertEqual(logger_mock.warning.call_count, 2) # 3 warnings, one for download result finally: shutil.rmtree(temp_dir) From 23185e75e764ac5a8f79d7a25b10c8f264507223 Mon Sep 17 00:00:00 2001 From: Fuming Zhang Date: Fri, 7 Apr 2023 19:21:13 +0800 Subject: [PATCH 4/5] fix 4 --- .../azure/cli/command_modules/acs/tests/latest/test_custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py index 9e4146b5055..00a3518bdf8 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py @@ -632,7 +632,7 @@ def test_k8s_install_kubelogin_emit_warnings(self, logger_mock, mock_url_retriev k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location, arch="amd64") self.assertEqual(mock_url_retrieve.call_count, 1) # 2 warnings, 1st for download result, 2nd for updating PATH - self.assertEqual(logger_mock.warning.call_count, 3) # 3 warnings, one for download result + self.assertEqual(logger_mock.warning.call_count, 2) # 2 warnings, one for download result finally: shutil.rmtree(temp_dir) From 1b9d1d39af6d8d77d876890bd28f8b32fef764e5 Mon Sep 17 00:00:00 2001 From: Fuming Zhang Date: Mon, 10 Apr 2023 09:46:53 +0800 Subject: [PATCH 5/5] Trigger Build