Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Windows service management in end-to-end tests #5714

Merged
merged 3 commits into from
Oct 20, 2021

Conversation

damonbarry
Copy link
Member

@damonbarry damonbarry commented Oct 19, 2021

A recent PR (#5608) added retry logic to the end-to-end tests on Windows when they try to stop the IoT Edge service but the service manager isn't ready. This PR expands that one to include another case: when the tests try to stop the IoT Edge service but the service is already stopped.

  X QuickstartCerts [7s 488ms]
  Error Message:
   System.InvalidOperationException : Cannot stop iotedge service on computer '.'.
  ----> System.ComponentModel.Win32Exception : The service has not been started.

The code path that stops the service first checks its status, and only issues the stop command if the service isn't already stopped. However, checking the service status + stopping the service is not an atomic operation, so there is a small window of opportunity to call "stop" on an already-stopped service. This change handles that window by checking the service status on every retry, not just the first time through.

I was unable to get the condition to repro again after several runs in the pipeline, but I at least confirmed that these changes don't disrupt the happy path.

Azure IoT Edge PR checklist:

This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines and Best Practices

  • I have read the contribution guidelines.
  • Title of the pull request is clear and informative.
  • Description of the pull request includes a concise summary of the enhancement or bug fix.

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • Description of the pull request includes
    • concise summary of tests added/modified
    • local testing done.

Draft PRs

  • Open the PR in Draft mode if it is:
    • Work in progress or not intended to be merged.
    • Encountering multiple pipeline failures and working on fixes.

Note: We use the kodiakhq bot to merge PRs once the necessary checks and approvals are in place. When it merges a PR, kodiakhq converts the PR title to the commit title, PR description to the commit description, and squashes all the commits in the PR to a single commit. The net effect is that entire PR becomes a single commit. Please follow the best practices mentioned here for the PR title and description

@damonbarry damonbarry marked this pull request as ready for review October 19, 2021 23:41
@kodiakhq kodiakhq bot merged commit 6c34b91 into Azure:release/1.1 Oct 20, 2021
@damonbarry damonbarry deleted the retry-service-stop-2 branch October 20, 2021 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants