Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ansible/roles/test/tasks/sensors_check.yml
20 changes: 20 additions & 0 deletions tests/test_sensors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pytest
import logging

def test_sensors(duthost, creds):
# Get platform name
platform = duthost.shell("show platform summary | grep Platform | awk '{print $2}'")['stdout']
Comment thread
Blueve marked this conversation as resolved.
Outdated

# Prepare check list
sensors_checks = creds['sensors_checks']

# Gather sensors
if platform not in sensors_checks.keys():
pytest.skip("Skip test due to not support check sensors for current platform({})".format(platform))

sensors_facts = duthost.sensors_facts(checks=sensors_checks[platform])['ansible_facts']
logging.debug("Output of sensors information: %s" % sensors_facts)

assert not sensors_facts['sensors']['alarm']
Comment thread
Blueve marked this conversation as resolved.
Outdated
if sensors_facts['sensors']['warning']:
logging.debug("Show warnings: %s" % sensors_facts['sensors']['warning'])