Skip to content

Instantly share code, notes, and snippets.

@smccarney
Last active May 21, 2021 06:57
Show Gist options
  • Save smccarney/0afa4a50afcf9f0d47e1a21ebe33dbfc to your computer and use it in GitHub Desktop.
Save smccarney/0afa4a50afcf9f0d47e1a21ebe33dbfc to your computer and use it in GitHub Desktop.
Test plan for enabling sensor monitoring

Test Plan

Code changes

  • src/manager.*
    • Manager::Manager()
      • Verify timer is disabled after initialization list
      • Test where system is powered on
        • Verify monitoring is enabled
      • Test where system is powered off
        • Verify monitoring is disabled
    • Manager::monitor()
      • Test where enable parameter is the same as the current monitoring state
        • Both true
        • Both false
        • Verify does nothing
      • Test where enable parameter is the different than current monitoring state
        • Verify isMonitoringEnabled is updated
      • Test where enabling monitoring
        • Verify debug message written to the journal
        • Verify repeated timer started with 1 second duration
          • Verify callback is first invoked 1 second later
          • Verify there is a 1 second gap between callbacks
          • Test where timer had never been enabled
          • Test where timer had been previously enabled and then disabled
        • Verify Sensors service is enabled
      • Test where disabling monitoring
        • Verify debug message written to the journal
        • Verify timer is disabled
          • Verify callback is no longer called
        • Verify sensors service is disabled
          • Verify all sensors still exists on D-Bus
          • Verify sensor value property set to NaN
          • Verify sensor available property set to false
          • Test where config file not loaded
          • Test where config file loaded
            • Verify all devices are closed
    • Manager::timerExpired()
      • Verify Sensors::startCycle() is called
      • Test where config file is not loaded
        • Verify no error occurs
      • Test where config file is loaded
        • Verify all sensor values are updated
        • Test when this is the first cycle and no sensors exist
        • Test when this is the first cycle since the Sensors service was enabled
          • Verify sensor value property is changed from NaN to a valid value
          • Verify sensor available property is changed to true
        • Test when this is not the first cycle and sensors are updated only if their new value is a large enough change from the published value
      • Verify Sensors::endCycle() is called
        • Test where no sensors are stale
        • Test where an stale sensor is removed from D-Bus
    • Manager::isSystemPoweredOn()
      • Test where getService() fails with an exception
        • Verify false is returned from the method
      • Test where getService() returns an empty string
        • Verify false is returned from the method
      • Test where getService() works
        • Verify service value is correct
      • Test where getProperty() fails with an exception
        • Verify false is returned from the method
      • Test where getProperty() works
        • Verify property value is correct
      • Test where property value is On
        • Verify true is returned from the method
      • Test where property value is not On
        • Verify false is returned from the method
    • Manager::eventLoop
      • Verify SIGHUP still causes config file to be reloaded
      • Verify that compatible system info can still be obtained from interfacesAdded signal
      • Verify 'regsctl config' still causes regulator configuration
      • Verify 'regsctl monitor -e' still enables monitoring
      • Verify 'regsctl monitor -d' still disables monitoring
      • Verify timerExpired() is called once per second when monitoring is enabled

End to end testing

  • Sensor states
    • Verify all sensors have the correct interfaces
    • Verify all sensors have the correct properties
      • Test where sensors are enabled
      • Test where sensors are disabled
        • Verify sensors are not removed from D-Bus when chassis is powered off
        • Verify all sensors have Value property set to NaN
        • Verify all sensors have Available property set to false
      • Test where sensors are in error state
        • Verify all sensors in error state have Value property set to NaN
        • Verify all sensors in error state have Functional property set to false
  • Stale sensors
    • Verify sensors that are updated are not removed from D-Bus
    • Verify sensors that are not updated are removed from D-Bus
  • Hysteresis
    • Verify sensors that change < hysteresis are not updated on D-Bus
    • Verify sensors that change >= hysteresis are updated on D-Bus
    • Verify sensor changes
  • Normal power on/off cycles
    • BMC reset while system powered off
      • Verify no sensors on D-Bus
      • Verify sensor monitoring is disabled
    • Chassis is powered on
      • Verify phosphor-regulators-monitor-enable.service is run
      • Verify sensor monitoring is enabled
      • Verify sensors are published on D-Bus
    • Chassis is powered off
      • Verify phosphor-regulators-monitor-disable.service is run
      • Verify sensor monitoring is disabled
      • Verify sensors remain on D-Bus but are put in inactive state
    • Host is powered on
      • Verify phosphor-regulators-monitor-enable.service is run again
      • Verify sensor monitoring is enabled again
      • Verify sensors remain on D-Bus but are put in active state
    • Host is powered off
      • Verify phosphor-regulators-monitor-disable.service is run again
      • Verify sensor monitoring is disabled again
      • Verify sensors remain on D-Bus but are put in inactive state
  • Reset/restarted at various system power states
    • BMC reset while system powered off
      • Verify isSystemPoweredOn() returns false
      • Verify phosphor-regulators-monitor-enable.service is not run
      • Verify monitoring is disabled
    • BMC reset while system powered on
      • Verify isSystemPoweredOn() returns true
      • Verify phosphor-regulators-monitor-enable.service is run
        • Verify does not cause any problems since constructor will have already enabled monitoring
      • Verify monitoring is enabled
    • phosphor-regulators application restarted while system powered off
      • Verify isSystemPoweredOn() returns false
      • Verify monitoring is disabled
      • Verify no sensors on D-Bus
    • phosphor-regulators application restarted while system powered on
      • Verify isSystemPoweredOn() returns true
      • Verify monitoring is enabled
      • Verify sensors are published on D-Bus
  • D-Bus client interface
    • Verify GetManagedObjects() can be called on phosphor-regulators service
    • Verify Properties.Get() can be called on phosphor-regulators service
    • Verify Properties.GetAll() can be called on phosphor-regulators service
    • Verify Properties.Set() can be called on phosphor-regulators service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment