Skip to content

Instantly share code, notes, and snippets.

@smccarney
Last active June 14, 2022 05:02
Show Gist options
  • Save smccarney/ba99ac808503b477aa056e7f4afe2ae1 to your computer and use it in GitHub Desktop.
Save smccarney/ba99ac808503b477aa056e7f4afe2ae1 to your computer and use it in GitHub Desktop.
Test plan for commit "psu-ng: Only log missing errors for required PSUs"

Test Plan

Tests based on code changes

  • psu_manager.hpp
    • No executable code added, just declarations.
  • psu_manager.cpp
    • analyze()
      • Fault already logged
        • PSU is present
          • Verify no error logged
        • PSU is not present
          • Verify no error logged
      • Fault not already logged
        • PSU is present
          • Verify no error logged
        • PSU is not present
          • All required PSUs are present
            • Verify no error logged
            • Verify flag set indicating error was logged
          • All required PSUs are not present
            • PSU is required
              • Verify error is logged
              • Verify flag set indicating error was logged
            • PSU is not required
              • Verify no error is logged
              • Verify flag set indicating error was logged
    • getRequiredPSUCount()
      • No supported configurations data is available
        • Verify returns 0
      • Test where no PSU data is available
        • Verify returns 0
      • Not all PSUs have the same model
        • Verify returns 0
      • All PSUs have an empty model string
        • Verify returns 0
      • All PSUs have the same model
        • Model is not found in the configurations data
          • Verify returns 0
        • Model is found in the configurations data
          • Verify returns powerSupplyCount from configuration data
    • isRequiredPSU()
      • Unable to get required PSU count
        • Verify returns false
      • Number of PSUs is less than required PSU count
        • Verify returns true
      • Number of PSUs is equal to required PSU count
        • Verify returns true
      • Specified PSU is present
        • Verify returns true
      • Other present PSUs are counted
        • Verify psuCount set to number of present PSUs
        • Test where psuCount is equal to required count
          • Verify returns false
        • Test where psuCount is greater than required count
          • Verify returns false
      • Specified PSU was previously present
        • Verify returns true
      • Other previously present PSUs are counted
        • Verify psuCount updated with number of previously present PSUs
        • Test where psuCount is equal to required count
          • Verify returns false
        • Test where psuCount is greater than required count
          • Verify returns false
      • All non-present PSUs are put in vector
        • Verify vector contains all non-present PSUs including the specified PSU
        • Test that vector is sorted
        • Test where 1 more PSU is needed
          • Specified PSU is first in vector
            • Verify returns true
          • Specified PSU is second in vector
            • Verify returns false
        • Test where 2 more PSUs are needed
          • Specified PSU is first in vector
            • Verify returns true
          • Specified PSU is second in vector
            • Verify returns true
          • Specified PSU is third in vector
            • Verify returns false

End-to-end tests

  • All PSUs are present
    • Verify no error logged when chassis power is off
    • Verify no error logged when chassis power changes from off to on
    • Application is restarted
      • Verify no error logged when chassis power was off
      • Verify no error logged when chassis power changes from off to on
      • Verify no error logged when chassis power was on
  • One PSU is missing, but it is not required
    • PSU is removed
      • Verify no error logged when chassis power is off
      • Verify no error logged when chassis power changes from off to on
      • Verify no error logged when chassis power is on
    • Application is restarted
      • Verify no error logged when chassis power was off
      • Verify no error logged when chassis power changes from off to on
      • Verify no error logged when chassis power was on
  • One PSU is missing, and it is required
    • PSU is removed
      • Verify no error logged when chassis power is off
      • Verify error logged when chassis power changes from off to on
        • Verify no error against other PSUs
      • Verify error logged when chassis power is on
        • Verify no error against other PSUs
    • Application is restarted
      • Verify no error logged when chassis power was off
      • Verify error logged when chassis power changes from off to on
        • Verify no error against other PSUs
      • Verify error logged when chassis power was on
        • Verify no error against other PSUs
    • BMC is reset
      • Verify no error logged when chassis power was off
      • Verify error logged when chassis power was on
        • Verify no error against other PSUs
      • Verify error logged when chassis power changes from off to on
        • Verify no error against other PSUs
  • Two PSUs are missing, and both are required
    • PSUs are removed
      • Verify no error logged when chassis power is off
      • Verify two errors logged when chassis power changes from off to on
        • Verify no error against other PSUs
      • Verify two errors logged when chassis power is on
        • Verify no error against other PSUs
    • Application is restarted
      • Verify no error logged when chassis power was off
      • Verify two errors logged when chassis power changes from off to on
        • Verify no error against other PSUs
      • Verify two errors logged when chassis power was on
        • Verify no error against other PSUs
  • Required PSU is unplugged
    • PSU is unplugged
      • Verify no error logged when chassis power is off
      • Verify input error logged when chassis power changes from off to on
        • Verify no error against other PSUs
      • Verify input error logged when chassis power is on
        • Verify no error against other PSUs
    • Application is restarted
      • Verify no error logged when chassis power was off
      • Verify input error logged when chassis power changes from off to on
        • Verify no error against other PSUs
      • Verify input error logged when chassis power is on
        • Verify no error against other PSUs
    • BMC is reset
      • Verify no error logged when chassis power was off
      • Verify input error logged when chassis power changes from off to on
        • Verify no error against other PSUs
      • Verify input error logged when chassis power is on
        • Verify no error against other PSUs

Regression tests

  • Test on a 2S2U
  • System at standby
  • Clear errors
  • Remove PSU0
    • Verify removal noticed
    • Verify no error logged
    • Verify PSU0 is missing on D-Bus
    • Verify PSU1 is present on D-Bus
    • Verify PSU2 and PSU3 are missing on D-Bus
  • Remove PSU1
    • Wait for system to lose all AC
  • Re-insert PSU0
  • Power on chassis
    • Verify error logged for PSU1
    • Verify no errors logged for PSU2 and PSU3
    • Verify PSU0 is present on D-Bus
    • Verify PSU1 is missing on D-Bus
    • Verify PSU2 and PSU3 are missing on D-Bus
  • Clear errors
  • Re-insert PSU1
    • Verify no errors logged
    • Verify PSU0 is present on D-Bus
    • Verify PSU1 is present on D-Bus
    • Verify PSU2 and PSU3 are missing on D-Bus
  • Clear errors
  • Remove power cord from PSU1
    • Verify power loss noticed
    • Verify undervoltage error logged for PSU1
    • Verify no other errors logged
    • Verify PSU0 is present on D-Bus
    • Verify PSU1 is present on D-Bus
    • Verify PSU2 and PSU3 are missing on D-Bus
  • Stop phosphor-psu-monitor
  • Clear errors
  • Start phosphor-psu-monitor
    • Verify power loss noticed
    • Verify undervoltage error logged for PSU1
    • Verify no other errors logged
    • Verify PSU0 is present on D-Bus
    • Verify PSU1 is present on D-Bus
    • Verify PSU2 and PSU3 are missing on D-Bus
  • Clear errors
  • Reset the BMC
    • Verify power loss noticed
    • Verify undervoltage error logged for PSU1
    • Verify no other errors logged
    • Verify PSU0 is present on D-Bus
    • Verify PSU1 is present on D-Bus
    • Verify PSU2 and PSU3 are missing on D-Bus
  • Power off chassis
  • Stop phosphor-psu-monitor
  • Clear errors
  • Start phosphor-psu-monitor
    • Verify power loss noticed
    • Verify no errors logged
    • Verify PSU0 is present on D-Bus
    • Verify PSU1 is present on D-Bus
    • Verify PSU2 and PSU3 are missing on D-Bus
  • Clear errors
  • Reset the BMC
    • Verify power loss noticed
    • Verify no errors logged
    • Verify PSU0 is present on D-Bus
    • Verify PSU1 is present on D-Bus
    • Verify PSU2 and PSU3 are missing on D-Bus
  • Power on the chassis
    • Verify power loss noticed
    • Verify undervoltage error logged for PSU1
    • Verify no other errors logged
    • Verify PSU0 is present on D-Bus
    • Verify PSU1 is present on D-Bus
    • Verify PSU2 and PSU3 are missing on D-Bus
  • Plug power cord back into PSU0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment