Skip to content

Commit 6bc8769

Browse files
author
Lily Pan
committed
fix tests
1 parent 90c94cb commit 6bc8769

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5332,18 +5332,14 @@ def update_vmas_to_vms(self, mc: ManagedCluster) -> ManagedCluster:
53325332

53335333
return mc
53345334

5335-
def update_http_proxy_config(self, mc: ManagedCluster) -> ManagedCluster:
5335+
def update_http_proxy_enabled(self, mc: ManagedCluster) -> ManagedCluster:
53365336
"""Update http proxy config for the ManagedCluster object.
53375337
53385338
:return: the ManagedCluster object
53395339
"""
53405340
self._ensure_mc(mc)
53415341

53425342
if self.context.get_disable_http_proxy():
5343-
if not mc.http_proxy_config:
5344-
raise UnknownError(
5345-
"Unexpectedly get an empty http proxy config in the process of disabling http proxy."
5346-
)
53475343
if mc.http_proxy_config is None:
53485344
mc.http_proxy_config = (
53495345
self.models.ManagedClusterHTTPProxyConfig() # pylint: disable=no-member
@@ -5428,7 +5424,7 @@ def update_mc_profile_preview(self) -> ManagedCluster:
54285424
# update VMAS to VMS
54295425
mc = self.update_vmas_to_vms(mc)
54305426
# update http proxy config
5431-
mc = self.update_http_proxy_config(mc)
5427+
mc = self.update_http_proxy_enabled(mc)
54325428

54335429
return mc
54345430

src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6141,7 +6141,7 @@ def test_aks_create_and_update_with_http_proxy_config(
61416141
self.cmd(
61426142
disable_cmd,
61436143
checks=[
6144-
self.check("httpProxyConfig.enabled", "false"),
6144+
self.check("httpProxyConfig.enabled", False),
61456145
],
61466146
)
61476147

src/aks-preview/azext_aks_preview/tests/latest/test_managed_cluster_decorator.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6503,7 +6503,6 @@ def test_update_http_proxy_config(self):
65036503
ground_truth_mc_1 = self.models.ManagedCluster(
65046504
location="test_location",
65056505
http_proxy_config={
6506-
"enabled": "True",
65076506
"httpProxy": "http://cli-proxy-vm:3128/",
65086507
"httpsProxy": "https://cli-proxy-vm:3129/",
65096508
"noProxy": ["localhost", "127.0.0.1"],
@@ -6512,7 +6511,7 @@ def test_update_http_proxy_config(self):
65126511
)
65136512
self.assertEqual(dec_mc_1, ground_truth_mc_1)
65146513

6515-
# custom value
6514+
# custom value
65166515
dec_2 = AKSPreviewManagedClusterUpdateDecorator(
65176516
self.cmd,
65186517
self.client,
@@ -6526,13 +6525,13 @@ def test_update_http_proxy_config(self):
65266525
dec_2.context.attach_mc(mc_2)
65276526
# fail on passing the wrong mc object
65286527
with self.assertRaises(CLIInternalError):
6529-
dec_2.update_http_proxy_config(None)
6530-
dec_mc_2 = dec_2.update_http_proxy_config(mc_2)
6528+
dec_2.update_http_proxy_enabled(None)
6529+
dec_mc_2 = dec_2.update_http_proxy_enabled(mc_2)
65316530

65326531
ground_truth_mc_2 = self.models.ManagedCluster(
65336532
location="test_location",
65346533
http_proxy_config={
6535-
"enabled": "False",
6534+
"enabled": False,
65366535
"httpProxy": "http://cli-proxy-vm:3128/",
65376536
"httpsProxy": "https://cli-proxy-vm:3129/",
65386537
"noProxy": ["localhost", "127.0.0.1"],

0 commit comments

Comments
 (0)