Skip to content

Instantly share code, notes, and snippets.

@smccarney
Last active January 21, 2021 14:26
Show Gist options
  • Save smccarney/2dbc81aa55e3fa6250f0827eab62fff7 to your computer and use it in GitHub Desktop.
Save smccarney/2dbc81aa55e3fa6250f0827eab62fff7 to your computer and use it in GitHub Desktop.
Test Plan for "regulators: Obtain config file name from D-Bus"

Test Plan

Manager class

  • Manager()
    • Verify that D-Bus object path is created
      • /xyz/openbmc_project/power/regulators/manager
    • Verify that D-Bus service/bus name is created
      • xyz.openbmc_project.Power.Regulators
    • Verify adds D-Bus match rule to be notified of interfacesAdded signals
      • Test where phosphor-regulators starts before entity-manager is ready
      • Test where phosphor-regulators starts after entity-manager is ready
    • Verify it tries to find the list of compatible system types
      • Test where entity-manager is ready and list is found
      • Test where entity-manager is not ready and list is not found
    • Verify it tries to find and load the config file
      • Test where config file not found/loaded
      • Test where config file found/loaded
  • configure()
    • Test where config file was loaded
      • Verify all regulators are configured
    • Test where config file was not loaded
      • Verify error message written to journal
  • interfacesAddedHandler()
    • Test where message is invalid and does not point at real data
    • Verify object path read correctly
    • Verify map of interface names to map of property names/values is read correctly
      • Test where property values are of the type vector
      • Test where property values are not of the type vector
    • Test where compatible interface not found
    • Test where compatible interface found
      • Test where Names property is not found
      • Test where Names property is found
        • Test where Names property is empty
        • Test where Names property is not empty
          • Verify property value stored in compatibleSystemTypes data member
          • Verify tries to find and load config file
            • Test where not found
            • Test where found
              • Loaded successfully
              • Not loaded successfully due to JSON error
  • monitor()
    • enable parameter is true
      • Verify nothing written to journal
    • enable parameter is false
      • system is nullptr
        • Verify nothing written to journal
      • system is not nullptr
        • Verify all devices are closed
  • sighupHandler()
    • Verify tries to find and load config file
      • Test where not found
      • Test where found
        • Loaded successfully
        • Not loaded successfully due to JSON error
  • timerExpired()
    • Nothing to test
  • findCompatibleSystemTypes()
    • Test where getSubTree() fails with exception
    • Test where getSubTree() succeeds
      • Test where map has no entries
      • Test where map has entries
        • Verify gets correct value for object path
        • Test where nested map has no entries
        • Test where nested map has entries
          • Verify gets correct value for service name
          • Test where service name is empty
          • Test where service name is not empty
            • Test where getProperty fails with exception
            • Test where getProperty succeeds
              • Verify list of compatible system names stored in data member
              • Verify items in most specific to least specific order
  • findConfigFile()
    • Test where compatibleSystemTypes is empty
    • Test where compatibleSystemTypes is not empty
      • Verify spaces are replaced with underscores
      • Verify commas are replaced with underscores
      • Verify '.json' suffix appended to file names
      • Test where list contains one item
      • Test where list contains multiple items
        • Verify items in most specific to least specific order
    • Verify default config file name put at end of list
    • Verify checks for file names in correct order first to last
    • Test where first file in list found
    • Test where middle file in list found
    • Test where last file in list found
    • Test where file found in test directory /etc/phosphor-regulators
    • Test where file found in standard directory /usr/share/phosphor-regulators
    • Test where /etc/phosphor-regulators does not exist
    • Test where file based on system type is found
    • Test where default file name is found
    • Test where no file is found. Verify empty path is returned.
    • Test where exception occurs
      • Infinite symbolic links loop
  • loadConfigFile()
    • Test where no file is found
      • Verify that system data member is not modified
        • Test where system was null
        • Test where system was not null
      • Verify that nothing is written to the journal
    • Test where file is found
      • Verify informational message written to journal
      • Test where file is parsed unsuccessfully
        • Verify all error messages written to journal
        • Verify that system data member is not modified
          • Test where system was null
          • Test where system was not null
      • Test where file is parsed successfully
        • Verify system data member is modified
        • Test where system was null
        • Test where system was not null

Simulation Tests

Rainier

  • Perform all tests in the 'Manager class' section
  • Test where file based on "ibm,rainier-2u" is loaded
  • Test where file based on "ibm,rainier" is loaded
  • End-to-end tests
    • Verify config file is loaded
    • Verify no unexpected messages in journal
    • Power on chassis
      • Verify configure operation occurs
      • Verify monitoring is enabled
      • Verify no unexpected messages in journal
    • Power off chassis
      • Verify monitoring is disabled
      • Verify no unexpected messages in journal

Everest

  • Test where file based on "ibm,everest" is loaded
  • End-to-end tests
    • Verify config file is loaded
    • Verify no unexpected messages in journal
    • Power on chassis
      • Verify configure operation occurs
      • Verify monitoring is enabled
      • Verify no unexpected messages in journal
    • Power off chassis
      • Verify monitoring is disabled
      • Verify no unexpected messages in journal

Hardware Tests

Rainier

  • Test where file based on "ibm,rainier-2u" is loaded
  • Test where file based on "ibm,rainier" is loaded
  • End-to-end tests
    • Verify config file is loaded
    • Verify no unexpected messages in journal
    • Power on chassis
      • Verify configure operation occurs
      • Verify monitoring is enabled
      • Verify no unexpected messages in journal
    • Power off chassis
      • Verify monitoring is disabled
      • Verify no unexpected messages in journal

Everest

  • No Everest hardware available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment