Skip to content

Commit

Permalink
Remove bounds in thermal tests (#2995)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
zzhiyuan and Zhi Yuan Carl Zhao authored Feb 26, 2021
1 parent 78d809d commit 1ea29a1
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions tests/platform_tests/api/test_thermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit 1ea29a1

Please sign in to comment.