Skip to content

test-device-hub waits for device reconnection - #14828

Merged
Nir-Az merged 1 commit into
realsenseai:developmentfrom
OhadMeir:ci
Mar 18, 2026
Merged

Nir-Az merged 1 commit into
realsenseai:developmentfrom
OhadMeir:ci

Conversation

@OhadMeir

Copy link
Copy Markdown
Contributor

Fix CI issues when disconnecting a resetting device.

Copilot AI review requested due to automatic review settings March 18, 2026 07:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the test-device-hub live unit test to reduce CI flakiness when a device is disconnected while it’s mid hardware-reset (powering down/up), by waiting for the device to reconnect before exiting the test.

Changes:

  • Import MAX_ENUMERATION_TIME from rspy.devices.
  • Add a post-test wait loop intended to wait for the device to be connected again before calling test.print_results_and_exit().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


# Exiting the test will cause hub to disconnect port. We saw problems on CI when disconnecting like this when device is powering down/up so we wait for it to finish reset.
# (Unifi Hub stuck disconnecting port, D555 recovery OS -> domain set to 0)
hub.wait_for_device()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets make it a test to see the device gets connected again

 +# -------- Wait for device to come back after hardware reset --------                                                             
      56 +# The last reset left the device disconnected; wait for it to re-enumerate so the                                                 
      57 +# test framework doesn't try to power-cycle the port while the device is mid-reset.                                               
      58 +test.start("device_hub: wait for device to reconnect after reset")                                                                
      59 +try:                                                                                                                              
      60 +    reconnected_dev = hub.wait_for_device()                                                                                       
      61 +    test.check(reconnected_dev is not None, "Device did not reconnect after hardware_reset")                                      
      62 +    test.check(hub.is_connected(reconnected_dev), "Reconnected device should be reported as connected")                           
      63 +except:                                                                                                                           
      64 +    test.unexpected_exception()                                                                                                   
      65 +test.finish()      

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, good idea :)

@Nir-Az
Nir-Az merged commit 352694b into realsenseai:development Mar 18, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants