From fdcc9e32a00044e114703a000bd1756113c9d8cd Mon Sep 17 00:00:00 2001 From: Yutong Zhang <90831468+yutongzhang-microsoft@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:46:37 +0800 Subject: [PATCH] Add device type mark in some modules. (#12496) What is the motivation for this PR? In this PR, I add mark pytest.mark.device_type('physical') in some modules, which means the module can only be ran on physical testbeds. The reasons are below: * generic_config_updater/test_pfcwd_status.py * PFCWD needs some counters, and these counters don't support kvm testbeds. * generic_config_updater/test_pg_headroom_update.py In this test, it needs to execute command sonic-db-cli CONFIG_DB keys *BUFFER_PROFILE\\|pg_lossless* on DUT and gets the return value, but there the table BUFFER_PROFILE doesn't exist on kvm, thus this command returns None. * platform_tests/api All the cases under platform_tests/api don't support kvm testbeds * platform_tests/daemon The features to be tested under this folder are not enabled in x86_64-kvm_x86_64-r0. How did you do it? Add the mark pytest.mark.device_type('physical') in the module which only support physical testbed. --- .azure-pipelines/pr_test_scripts.yaml | 6 ------ tests/generic_config_updater/test_pfcwd_status.py | 1 + tests/generic_config_updater/test_pg_headroom_update.py | 1 + tests/platform_tests/api/test_chassis.py | 3 ++- tests/platform_tests/api/test_chassis_fans.py | 3 ++- tests/platform_tests/api/test_component.py | 3 ++- tests/platform_tests/api/test_fan_drawer.py | 3 ++- tests/platform_tests/api/test_fan_drawer_fans.py | 3 ++- tests/platform_tests/api/test_module.py | 3 ++- tests/platform_tests/api/test_psu.py | 1 + tests/platform_tests/api/test_psu_fans.py | 3 ++- tests/platform_tests/api/test_sfp.py | 3 ++- tests/platform_tests/api/test_thermal.py | 3 ++- tests/platform_tests/api/test_watchdog.py | 3 ++- tests/platform_tests/daemon/test_chassisd.py | 1 + tests/platform_tests/daemon/test_fancontrol.py | 1 + tests/platform_tests/daemon/test_ledd.py | 1 + tests/platform_tests/daemon/test_pcied.py | 1 + tests/platform_tests/daemon/test_psud.py | 1 + tests/platform_tests/daemon/test_syseepromd.py | 1 + 20 files changed, 29 insertions(+), 16 deletions(-) diff --git a/.azure-pipelines/pr_test_scripts.yaml b/.azure-pipelines/pr_test_scripts.yaml index 13dc669078..9db13f8aa5 100644 --- a/.azure-pipelines/pr_test_scripts.yaml +++ b/.azure-pipelines/pr_test_scripts.yaml @@ -52,7 +52,6 @@ t0: - generic_config_updater/test_mmu_dynamic_threshold_config_update.py - generic_config_updater/test_monitor_config.py - generic_config_updater/test_ntp.py - - generic_config_updater/test_pfcwd_interval.py - generic_config_updater/test_portchannel_interface.py - generic_config_updater/test_syslog.py - generic_config_updater/test_vlan_interface.py @@ -76,13 +75,8 @@ t0: - pc/test_lag_2.py - pc/test_po_cleanup.py - pc/test_po_update.py - - platform_tests/api/test_module.py - platform_tests/broadcom/test_ser.py - platform_tests/counterpoll/test_counterpoll_watermark.py - - platform_tests/daemon/test_fancontrol.py - - platform_tests/daemon/test_ledd.py - - platform_tests/daemon/test_psud.py - - platform_tests/daemon/test_syseepromd.py - platform_tests/fwutil/test_fwutil.py - platform_tests/link_flap/test_cont_link_flap.py - platform_tests/mellanox/test_check_sfp_eeprom.py diff --git a/tests/generic_config_updater/test_pfcwd_status.py b/tests/generic_config_updater/test_pfcwd_status.py index d0429c2a26..7af82555a9 100644 --- a/tests/generic_config_updater/test_pfcwd_status.py +++ b/tests/generic_config_updater/test_pfcwd_status.py @@ -14,6 +14,7 @@ pytestmark = [ pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] logger = logging.getLogger(__name__) diff --git a/tests/generic_config_updater/test_pg_headroom_update.py b/tests/generic_config_updater/test_pg_headroom_update.py index c567fc8295..036537c785 100644 --- a/tests/generic_config_updater/test_pg_headroom_update.py +++ b/tests/generic_config_updater/test_pg_headroom_update.py @@ -12,6 +12,7 @@ pytestmark = [ pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] logger = logging.getLogger(__name__) diff --git a/tests/platform_tests/api/test_chassis.py b/tests/platform_tests/api/test_chassis.py index 38c57d4b64..39cddb318e 100644 --- a/tests/platform_tests/api/test_chassis.py +++ b/tests/platform_tests/api/test_chassis.py @@ -28,7 +28,8 @@ pytestmark = [ pytest.mark.disable_loganalyzer, # disable automatic loganalyzer - pytest.mark.topology('any') + pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] REGEX_MAC_ADDRESS = r'^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$' diff --git a/tests/platform_tests/api/test_chassis_fans.py b/tests/platform_tests/api/test_chassis_fans.py index b11e8e799c..5c1a301376 100644 --- a/tests/platform_tests/api/test_chassis_fans.py +++ b/tests/platform_tests/api/test_chassis_fans.py @@ -21,7 +21,8 @@ pytestmark = [ pytest.mark.disable_loganalyzer, # disable automatic loganalyzer - pytest.mark.topology('any') + pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] FAN_DIRECTION_INTAKE = "intake" diff --git a/tests/platform_tests/api/test_component.py b/tests/platform_tests/api/test_component.py index 4411699d86..826be7eaa5 100644 --- a/tests/platform_tests/api/test_component.py +++ b/tests/platform_tests/api/test_component.py @@ -21,7 +21,8 @@ pytestmark = [ pytest.mark.disable_loganalyzer, # disable automatic loganalyzer - pytest.mark.topology('any') + pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] image_list = [ diff --git a/tests/platform_tests/api/test_fan_drawer.py b/tests/platform_tests/api/test_fan_drawer.py index 3456e93f32..f9b67de1cd 100644 --- a/tests/platform_tests/api/test_fan_drawer.py +++ b/tests/platform_tests/api/test_fan_drawer.py @@ -20,7 +20,8 @@ pytestmark = [ pytest.mark.disable_loganalyzer, # disable automatic loganalyzer - pytest.mark.topology('any') + pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] STATUS_LED_COLOR_GREEN = "green" diff --git a/tests/platform_tests/api/test_fan_drawer_fans.py b/tests/platform_tests/api/test_fan_drawer_fans.py index 932e4b90db..744c681366 100644 --- a/tests/platform_tests/api/test_fan_drawer_fans.py +++ b/tests/platform_tests/api/test_fan_drawer_fans.py @@ -22,7 +22,8 @@ pytestmark = [ pytest.mark.disable_loganalyzer, # disable automatic loganalyzer - pytest.mark.topology('any') + pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] FAN_DIRECTION_INTAKE = "intake" diff --git a/tests/platform_tests/api/test_module.py b/tests/platform_tests/api/test_module.py index 6481a804a5..5cea9a895c 100644 --- a/tests/platform_tests/api/test_module.py +++ b/tests/platform_tests/api/test_module.py @@ -23,7 +23,8 @@ pytestmark = [ pytest.mark.disable_loganalyzer, # disable automatic loganalyzer - pytest.mark.topology('any') + pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] REGEX_MAC_ADDRESS = r'^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$' diff --git a/tests/platform_tests/api/test_psu.py b/tests/platform_tests/api/test_psu.py index 7492186a61..877187b40d 100644 --- a/tests/platform_tests/api/test_psu.py +++ b/tests/platform_tests/api/test_psu.py @@ -24,6 +24,7 @@ pytestmark = [ pytest.mark.topology('any'), + pytest.mark.device_type('physical'), pytest.mark.disable_loganalyzer # disable automatic loganalyzer ] diff --git a/tests/platform_tests/api/test_psu_fans.py b/tests/platform_tests/api/test_psu_fans.py index 4f3823cc7d..f348ecb40a 100644 --- a/tests/platform_tests/api/test_psu_fans.py +++ b/tests/platform_tests/api/test_psu_fans.py @@ -22,7 +22,8 @@ pytestmark = [ pytest.mark.disable_loganalyzer, # disable automatic loganalyzer - pytest.mark.topology('any') + pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] FAN_DIRECTION_INTAKE = "intake" diff --git a/tests/platform_tests/api/test_sfp.py b/tests/platform_tests/api/test_sfp.py index 56dab31fbc..f502d2c7f8 100644 --- a/tests/platform_tests/api/test_sfp.py +++ b/tests/platform_tests/api/test_sfp.py @@ -27,7 +27,8 @@ pytestmark = [ pytest.mark.disable_loganalyzer, # disable automatic loganalyzer - pytest.mark.topology('any') + pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] diff --git a/tests/platform_tests/api/test_thermal.py b/tests/platform_tests/api/test_thermal.py index 00c811a36e..5373320c8e 100644 --- a/tests/platform_tests/api/test_thermal.py +++ b/tests/platform_tests/api/test_thermal.py @@ -20,7 +20,8 @@ pytestmark = [ pytest.mark.disable_loganalyzer, # disable automatic loganalyzer - pytest.mark.topology('any') + pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] diff --git a/tests/platform_tests/api/test_watchdog.py b/tests/platform_tests/api/test_watchdog.py index c59874cdd4..8d45fcf4b6 100644 --- a/tests/platform_tests/api/test_watchdog.py +++ b/tests/platform_tests/api/test_watchdog.py @@ -12,7 +12,8 @@ pytestmark = [ pytest.mark.disable_loganalyzer, # disable automatic loganalyzer - pytest.mark.topology('any') + pytest.mark.topology('any'), + pytest.mark.device_type('physical') ] logger = logging.getLogger(__name__) diff --git a/tests/platform_tests/daemon/test_chassisd.py b/tests/platform_tests/daemon/test_chassisd.py index f6aa998dd8..bf3d1ce36a 100644 --- a/tests/platform_tests/daemon/test_chassisd.py +++ b/tests/platform_tests/daemon/test_chassisd.py @@ -21,6 +21,7 @@ pytestmark = [ pytest.mark.topology('t2'), + pytest.mark.device_type('physical') ] expected_running_status = "RUNNING" diff --git a/tests/platform_tests/daemon/test_fancontrol.py b/tests/platform_tests/daemon/test_fancontrol.py index 847e051501..d679edd6b8 100644 --- a/tests/platform_tests/daemon/test_fancontrol.py +++ b/tests/platform_tests/daemon/test_fancontrol.py @@ -19,6 +19,7 @@ pytestmark = [ pytest.mark.topology('any'), + pytest.mark.device_type('physical'), pytest.mark.sanity_check(skip_sanity=True), pytest.mark.disable_loganalyzer ] diff --git a/tests/platform_tests/daemon/test_ledd.py b/tests/platform_tests/daemon/test_ledd.py index f3445d70f3..99358488a7 100644 --- a/tests/platform_tests/daemon/test_ledd.py +++ b/tests/platform_tests/daemon/test_ledd.py @@ -21,6 +21,7 @@ pytestmark = [ pytest.mark.topology('any'), + pytest.mark.device_type('physical'), pytest.mark.sanity_check(skip_sanity=True), pytest.mark.disable_loganalyzer ] diff --git a/tests/platform_tests/daemon/test_pcied.py b/tests/platform_tests/daemon/test_pcied.py index e506a046d4..a59c100c0e 100644 --- a/tests/platform_tests/daemon/test_pcied.py +++ b/tests/platform_tests/daemon/test_pcied.py @@ -21,6 +21,7 @@ pytestmark = [ pytest.mark.topology('any'), + pytest.mark.device_type('physical'), pytest.mark.sanity_check(skip_sanity=True), pytest.mark.disable_loganalyzer ] diff --git a/tests/platform_tests/daemon/test_psud.py b/tests/platform_tests/daemon/test_psud.py index 61e8cb25a2..7c20ca45a8 100644 --- a/tests/platform_tests/daemon/test_psud.py +++ b/tests/platform_tests/daemon/test_psud.py @@ -20,6 +20,7 @@ pytestmark = [ pytest.mark.topology('any'), + pytest.mark.device_type('physical'), pytest.mark.sanity_check(skip_sanity=True), pytest.mark.disable_loganalyzer ] diff --git a/tests/platform_tests/daemon/test_syseepromd.py b/tests/platform_tests/daemon/test_syseepromd.py index b83238c669..3005745478 100644 --- a/tests/platform_tests/daemon/test_syseepromd.py +++ b/tests/platform_tests/daemon/test_syseepromd.py @@ -20,6 +20,7 @@ pytestmark = [ pytest.mark.topology('any'), + pytest.mark.device_type('physical'), pytest.mark.sanity_check(skip_sanity=True), pytest.mark.disable_loganalyzer ]