@@ -576,6 +576,34 @@ def test_events(get_current_datetime, dd_run_check, aggregator, instance, collec
576576 assert len (aggregator .events ) == len (expected_events )
577577
578578
579+ @pytest .mark .parametrize (
580+ ('infrastructure_mode' , 'expected_count' ),
581+ [
582+ pytest .param ('basic' , 2 , id = 'basic mode adds infra_mode tag' ),
583+ pytest .param ('full' , 0 , id = 'full mode does not add infra_mode tag' ),
584+ pytest .param (None , 0 , id = 'unset mode does not add infra_mode tag' ),
585+ ],
586+ )
587+ @pytest .mark .usefixtures ('mock_http_get' )
588+ def test_infra_mode_tag (dd_run_check , aggregator , instance , infrastructure_mode , expected_count ):
589+ instance = copy .deepcopy (instance )
590+ if infrastructure_mode is not None :
591+ instance ['infrastructure_mode' ] = infrastructure_mode
592+ check = ProxmoxCheck ('proxmox' , {}, [instance ])
593+ dd_run_check (check )
594+
595+ aggregator .assert_metric_has_tag_prefix ('proxmox.cpu' , 'infra_mode:' , count = expected_count )
596+
597+ # assert that no container metrics have an infra_mode tag
598+ for metric in aggregator .metrics ('proxmox.cpu' ):
599+ if 'proxmox_type:container' in metric .tags :
600+ assert not any (t .startswith ('infra_mode:' ) for t in metric .tags )
601+ # assert only the cpu metric has an infra_mode tag
602+ for metric_name in ALL_METRICS :
603+ if metric_name != 'proxmox.cpu' :
604+ aggregator .assert_metric_has_tag_prefix (metric_name , 'infra_mode:' , count = 0 )
605+
606+
579607@pytest .mark .parametrize (
580608 ('resource_filters, expected_vms, expected_nodes' ),
581609 [
0 commit comments