From 1ea29a176b140889c3e92d22249108c55ad0f1c5 Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Thu, 25 Feb 2021 16:47:35 -0800 Subject: [PATCH] Remove bounds in thermal tests (#2995) Description of PR Summary: Fixes platform API test failure due to thermals with low thresholds too low or high thresholds too high. Thermals vary vastly with low bounds being -55 or lower, and high bounds with 115 or higher. It's hard to set a good threshold while still making the test useful. Approach What is the motivation for this PR? In Arista's testing we found thermal sensors that do not conform to existing checks. Co-authored-by: Zhi Yuan Carl Zhao --- tests/platform_tests/api/test_thermal.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/tests/platform_tests/api/test_thermal.py b/tests/platform_tests/api/test_thermal.py index 839391718c4..6215711989d 100644 --- a/tests/platform_tests/api/test_thermal.py +++ b/tests/platform_tests/api/test_thermal.py @@ -141,9 +141,7 @@ def test_get_temperature(self, duthost, localhost, platform_api_conn): temperature = thermal.get_temperature(platform_api_conn, i) if self.expect(temperature is not None, "Unable to retrieve Thermal {} temperature".format(i)): - if self.expect(isinstance(temperature, float), "Thermal {} temperature appears incorrect".format(i)): - self.expect(temperature >= 0 and temperature <= 100, - "Thermal {} temperature {} reading is not within range".format(i, temperature)) + self.expect(isinstance(temperature, float), "Thermal {} temperature appears incorrect".format(i)) self.assert_expectations() def test_get_low_threshold(self, duthost, localhost, platform_api_conn): @@ -152,9 +150,7 @@ def test_get_low_threshold(self, duthost, localhost, platform_api_conn): low_threshold = thermal.get_low_threshold(platform_api_conn, i) if self.expect(low_threshold is not None, "Unable to retrieve Thermal {} low threshold".format(i)): - if self.expect(isinstance(low_threshold, float), "Thermal {} low threshold appears incorrect".format(i)): - self.expect(low_threshold >= 0 and low_threshold <= 100, - "Thermal {} low threshold {} reading is not within range".format(i, low_threshold)) + self.expect(isinstance(low_threshold, float), "Thermal {} low threshold appears incorrect".format(i)) self.assert_expectations() def test_get_high_threshold(self, duthost, localhost, platform_api_conn): @@ -163,9 +159,7 @@ def test_get_high_threshold(self, duthost, localhost, platform_api_conn): high_threshold = thermal.get_high_threshold(platform_api_conn, i) if self.expect(high_threshold is not None, "Unable to retrieve Thermal {} high threshold".format(i)): - if self.expect(isinstance(high_threshold, float), "Thermal {} high threshold appears incorrect".format(i)): - self.expect(high_threshold > 0 and high_threshold <= 100, - "Thermal {} high threshold {} reading is not within range".format(i, high_threshold)) + self.expect(isinstance(high_threshold, float), "Thermal {} high threshold appears incorrect".format(i)) self.assert_expectations() def test_get_low_critical_threshold(self, duthost, localhost, platform_api_conn): @@ -174,9 +168,7 @@ def test_get_low_critical_threshold(self, duthost, localhost, platform_api_conn) low_critical_threshold = thermal.get_low_critical_threshold(platform_api_conn, i) if self.expect(low_critical_threshold is not None, "Unable to retrieve Thermal {} low critical threshold".format(i)): - if self.expect(isinstance(low_critical_threshold, float), "Thermal {} low threshold appears incorrect".format(i)): - self.expect(low_critical_threshold >= 0 and low_critical_threshold <= 110, - "Thermal {} low critical threshold {} reading is not within range".format(i, low_critical_threshold)) + self.expect(isinstance(low_critical_threshold, float), "Thermal {} low threshold appears incorrect".format(i)) self.assert_expectations() def test_get_high_critical_threshold(self, duthost, localhost, platform_api_conn): @@ -185,9 +177,7 @@ def test_get_high_critical_threshold(self, duthost, localhost, platform_api_conn high_critical_threshold = thermal.get_high_critical_threshold(platform_api_conn, i) if self.expect(high_critical_threshold is not None, "Unable to retrieve Thermal {} high critical threshold".format(i)): - if self.expect(isinstance(high_critical_threshold, float), "Thermal {} high threshold appears incorrect".format(i)): - self.expect(high_critical_threshold > 0 and high_critical_threshold <= 110, - "Thermal {} high critical threshold {} reading is not within range".format(i, high_critical_threshold)) + self.expect(isinstance(high_critical_threshold, float), "Thermal {} high threshold appears incorrect".format(i)) self.assert_expectations() def test_set_low_threshold(self, duthost, localhost, platform_api_conn):