Skip to content

Conversation

@bpkroth
Copy link
Contributor

@bpkroth bpkroth commented Oct 28, 2025

Pull Request

Title

SSH Test and Debugging Fixups


Description

  • Fixes Intermittent unit test failure at test_remote_ssh_env #1005 by
    • Adding connection attempt retry loop to ssh_service.py
      • Needs proper config handling
    • Adding wait_for_docker_service_healthy check during test fixture setup to avoid a seeming race between when docker claims containers and ready (and we therefore check the dynamic port mapping) vs when they are actually ready.
  • Improves logging infrastructure for pytest in order to
    • capture logs from fixtures so that they can be reported during test failure
    • capture full worker logs
    • upload those logs as artifacts for full review in CI
    • Add ms resolution to the logger formats for those files

Type of Change

  • 🛠️ Bug fix
  • ✨ New feature
  • 🧪 Tests

Testing

  • CI Passes (multiple times)

Additional Notes (optional)

  • Future PRs will add
    • ms resolution for all loggers (and fixup associated tests)

_LOG.debug(
"%s: Establishing client connection to %s",
connection_id = SshClient.id_from_params(connect_params)
for i in range(3): # TODO: make the retry count configurable
Copy link
Contributor Author

Choose a reason for hiding this comment

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

polish

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and add tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and config support

file_handler.setLevel(logging.DEBUG)
else:
file_handler.setLevel(logging.INFO)
# logging.basicConfig(level=file_handler.level, format=LOG_FMT, datefmt=DATE_FMT)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixme - only apply to console logger for pytest

@bpkroth bpkroth mentioned this pull request Oct 29, 2025
1 task
@bpkroth bpkroth changed the title Ssh test debugging Ssh Test and Debugging Fixups Oct 29, 2025
# NOTE: this cache may become stale in another worker if the
# container restarts in one and the other worker doesn't notice the new port.
# Optionally check the status of the cached port before returning it.
if not check_port or self.validate_connection():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO (possibly future PR): add a test that uses an unvalidated connection.
Useful to check for SshServer error handling.

For instance:

  1. Connect.
  2. Execute an OOB (docker exec) command that sends a SIGSTOP command to the sshd service.
  3. Try to issue a command over SshHostService.
  4. Check for timeout.
  5. Check for reconnect.

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.

Intermittent unit test failure at test_remote_ssh_env

2 participants