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

Fix ServiceController test #57116

Merged
merged 1 commit into from
Aug 10, 2021
Merged

Fix ServiceController test #57116

merged 1 commit into from
Aug 10, 2021

Conversation

danmoseley
Copy link
Member

@danmoseley danmoseley commented Aug 10, 2021

Fix #57115

This outer loop test has apparently never passed as it was written backwards: it was intended to test that if you have a service A depending on (requiring) service B, then a call serviceControllerForB.Stop(stopDependentServices: false)) will throw IOE. Instead it was stopping service A, which of course works fine.

The confusion was likely because the word dependency is overloaded in that it can mean both depended-on and depending-on. When we created a test service XYZ that depends on another test service, we named the latter XYZ.Dependency (ie XYZ ---> XYZ.Dependency). On the Win32 SCM API, services you depend on are named "dependencies". Nevertheless in everyday English, "dependency" is often used to mean the reverse -- "the thing depending on another". On ServiceController, the API is clearer: DependentServices are those that depend on YOU, and ServicesDependedOn are those you depend on; the method Stop(bool stopDependentServices) has a boolean to first stop services that depend on you (to which you are a prerequisite).

Renamed the test service that's depended on to be XYZ.Prerequisite.
Fixed test to attempt to stop that instead.
Added more of the handy off-by-default tracing in the tests.

Note these tests only run in Windows+OuterLoop+Elevated, which may be one reason it wasn't noticed.

@danmoseley danmoseley merged commit f02d9ff into dotnet:main Aug 10, 2021
@danmoseley danmoseley deleted the sc.test branch August 10, 2021 13:47
Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for making this clear.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop_FalseArg_WithDependentServices_ThrowsInvalidOperationException failing very often
3 participants