Skip to content

Commit 41ba9a6

Browse files
Jenny LiuJenny Liu
authored andcommitted
Add test case for --enable-azure-monitor-logs with container network logs
Case 8: Tests that --enable-azure-monitor-logs is recognized as enabling the monitoring addon during cluster create when combined with --enable-container-network-logs and --enable-acns.
1 parent 21e5ce8 commit 41ba9a6

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

src/aks-preview/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ To release a new version, please select a new version number (usually plus 1 to
1111

1212
Pending
1313
+++++++
14+
* `az aks create/update`: Add `--enable-azure-monitor-logs` support to container network logs validation.
1415

1516
19.0.0b22
1617
+++++++

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12390,6 +12390,51 @@ def test_enable_container_network_logs(self):
1239012390
with self.assertRaises(RequiredArgumentMissingError):
1239112391
dec_10.update_monitoring_profile_flow_logs(mc_10)
1239212392

12393+
# Case 11: enable_acns, enable_azure_monitor_logs, enable container_network_logs for ClusterCreate context
12394+
# Tests that --enable-azure-monitor-logs is recognized as enabling monitoring addon
12395+
dec_11 = AKSPreviewManagedClusterCreateDecorator(
12396+
self.cmd,
12397+
self.client,
12398+
{
12399+
"name": "test_name",
12400+
"resource_group_name": "test_rg_name",
12401+
"location": "test_location",
12402+
"vnet_subnet_id": "test_vnet_subnet_id",
12403+
"enable_azure_monitor_logs": True,
12404+
"workspace_resource_id": "test_workspace_resource_id",
12405+
"enable_msi_auth_for_monitoring": True,
12406+
"enable_acns": True,
12407+
"enable_container_network_logs": True,
12408+
},
12409+
CUSTOM_MGMT_AKS_PREVIEW,
12410+
)
12411+
mc_11 = self.models.ManagedCluster(
12412+
location="test_location",
12413+
network_profile=self.models.ContainerServiceNetworkProfile(
12414+
network_plugin="azure",
12415+
network_plugin_mode="overlay",
12416+
network_dataplane="cilium",
12417+
pod_cidr="100.64.0.0/16",
12418+
service_cidr="192.168.0.0/16",
12419+
),
12420+
)
12421+
dec_11.context.set_intermediate("subscription_id", "test_subscription_id")
12422+
dec_11.context.attach_mc(mc_11)
12423+
external_functions = dec_11.context.external_functions
12424+
with patch.object(external_functions, 'ensure_container_insights_for_monitoring', return_value=None):
12425+
dec_mc_11 = dec_11.set_up_addon_profiles(mc_11)
12426+
ground_truth_mc_11 = {
12427+
CONST_MONITORING_ADDON_NAME: self.models.ManagedClusterAddonProfile(
12428+
enabled=True,
12429+
config={
12430+
CONST_MONITORING_LOG_ANALYTICS_WORKSPACE_RESOURCE_ID: "/test_workspace_resource_id",
12431+
CONST_MONITORING_USING_AAD_MSI_AUTH: "true",
12432+
"enableRetinaNetworkFlags": "True",
12433+
},
12434+
),
12435+
}
12436+
self.assertEqual(dec_mc_11.addon_profiles["omsagent"], ground_truth_mc_11["omsagent"])
12437+
1239312438
def test_update_node_provisioning_profile(self):
1239412439
dec_0 = AKSPreviewManagedClusterUpdateDecorator(
1239512440
self.cmd,

0 commit comments

Comments
 (0)