Skip to content

Commit de6a297

Browse files
committed
Fix get_enable_high_log_scale_mode to return False instead of None for backward compatibility
1 parent c1eb57c commit de6a297

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2860,6 +2860,9 @@ def get_enable_high_log_scale_mode(self) -> Union[bool, None]:
28602860
return True
28612861

28622862
# If container network logs are not being enabled, return the original value
2863+
# Return False if not explicitly set to maintain backward compatibility with base class
2864+
if enable_high_log_scale_mode is None:
2865+
return False
28632866
return enable_high_log_scale_mode
28642867

28652868
def _get_enable_vpa(self, enable_validation: bool = False) -> bool:

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4578,15 +4578,33 @@ def test_get_disable_gateway_api(self):
45784578
self.assertEqual(disable_gateway_api_3, False)
45794579

45804580
def test_get_enable_high_log_scale_mode_default(self):
4581-
"""Test default behavior when no container network logs or high log scale mode is specified."""
4581+
"""Test default behavior when no container network logs or high log scale mode is specified.
4582+
4583+
When enable_high_log_scale_mode is not explicitly set and container network logs are not enabled,
4584+
the method should return False (not None) to maintain backward compatibility with the base class.
4585+
"""
45824586
ctx = AKSPreviewManagedClusterContext(
45834587
self.cmd,
45844588
AKSManagedClusterParamDict({}),
45854589
self.models,
45864590
decorator_mode=DecoratorMode.CREATE,
45874591
)
45884592
result = ctx.get_enable_high_log_scale_mode()
4589-
self.assertIsNone(result)
4593+
self.assertFalse(result)
4594+
4595+
def test_get_enable_high_log_scale_mode_explicit_false_without_cnl(self):
4596+
"""Test when user explicitly sets enable_high_log_scale_mode to False without container network logs.
4597+
4598+
This should return False without raising any errors since container network logs are not enabled.
4599+
"""
4600+
ctx = AKSPreviewManagedClusterContext(
4601+
self.cmd,
4602+
AKSManagedClusterParamDict({"enable_high_log_scale_mode": False}),
4603+
self.models,
4604+
decorator_mode=DecoratorMode.CREATE,
4605+
)
4606+
result = ctx.get_enable_high_log_scale_mode()
4607+
self.assertFalse(result)
45904608

45914609
def test_get_enable_high_log_scale_mode_explicit_true(self):
45924610
"""Test when user explicitly enables high log scale mode."""

0 commit comments

Comments
 (0)