Power supply error logging test
Changes:
- Test to verify error logging when power supply module is
unplugged
- Fix logging list return.
Resolves openbmc/openbmc-test-automation#935
Change-Id: I033e0d5766ed41b46b7f794ddecab9b5735ee914
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/logging_utils.robot b/lib/logging_utils.robot
index 13aa603..c0c779c 100644
--- a/lib/logging_utils.robot
+++ b/lib/logging_utils.robot
@@ -32,7 +32,7 @@
# message_id Logging message string.
# Example: "xyz.openbmc_project.Common.Error.InternalFailure"
- ${elog_entries}= Get Logging Entry List
+ @{elog_entries}= Get Logging Entry List
:FOR ${entry} IN @{elog_entries}
\ ${resp}= Read Properties ${entry}
diff --git a/tests/test_power_supply.robot b/tests/test_power_supply.robot
index 53e2400..4f01bc7 100644
--- a/tests/test_power_supply.robot
+++ b/tests/test_power_supply.robot
@@ -4,6 +4,7 @@
Resource ../lib/openbmc_ffdc.robot
Resource ../lib/open_power_utils.robot
Resource ../lib/boot_utils.robot
+Resource ../lib/logging_utils.robot
Test Teardown FFDC On Test Case Fail
@@ -79,6 +80,19 @@
... Check Power Telemetry When Host On ${power_sensor_path}
+Power Supply Error Logging Test At Runtime
+ [Documentation] Check that power supply error is logged when one of the
+ ... power supply inputs is unplugged.
+ [Tags] Power_Supply_Error_Logging_Test_At_Runtime
+ [Teardown] Set Power Supply Present ${1}
+
+ REST Power On stack_mode=skip
+
+ Set Power Supply Present ${0}
+ Sleep 5s
+ Logging Entry Should Exist
+ ... xyz.openbmc_project.Inventory.Error.NotPresent
+
*** Keywords ***
Check Power Telemetry When Host On
@@ -136,3 +150,17 @@
\ Should Be True ${maximums[0]} < ${lower_power_limit}
... msg=Wattage ${maximums[0]} more than ${lower_power_limit}.
+
+Set Power Supply Present
+ [Documentation] Clear error log and set power present field.
+ [Arguments] ${power_present_setting}
+
+ # Description of argument(s):
+ # power_present_setting Enable or disable power present field (e.g."0/1").
+
+ FFDC On Test Case Fail
+
+ ${data}= Create Dictionary data=${power_present_setting}
+ Write Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/powersupply0
+ ... Present data=${data}