SCMU does not set ServiceControlQueueAddress when only adding audit instances bug fix#5637
Open
cquirosj wants to merge 7 commits into
Open
SCMU does not set ServiceControlQueueAddress when only adding audit instances bug fix#5637cquirosj wants to merge 7 commits into
cquirosj wants to merge 7 commits into
Conversation
Covers issue #4753, where SCMU does not set ServiceControl.Audit/ServiceControlQueueAddress when only adding an audit instance. The tests describe the expected behavior of ServiceControlAddViewModel: - Error + audit installed together: the queue address is the name of the error instance being installed, and no selection dropdown is shown. - Audit only with a single existing error instance: the address is auto-detected from it, no dropdown. - Audit only with multiple existing error instances: the dropdown is shown with all of them and Save is blocked until one is picked. - Audit only with no existing error instance: Save is blocked by a validation error. - Error instance only: no queue address validation error.
Replaces the initial ServiceControlQueueAddressTests with an executable specification organized as feature > rule > examples, mirroring the new docs/specs/audit-instance-servicecontrol-queue-address.md. The spec captures the four rules for bug #4753 (SCMU does not set ServiceControl.Audit/ServiceControlQueueAddress when only adding an audit instance): the instance installed in the same session always wins, auto-detect when exactly one error instance exists, require an explicit choice when several exist, and block Save when none exist. These are outer-loop TDD tests and reference members that do not exist yet: GetInstalledErrorInstanceNames, ServiceControlQueueAddress, ServiceControlQueueAddressOptions, ShowServiceControlQueueAddressSelection.
… same session ServiceControlQueueAddress resolves to ErrorInstanceName when an error instance is being installed. Adds the GetInstalledErrorInstanceNames seam (mirrors GetWindowsServiceNames) and naive stubs for the members Rules 2-4 will drive. Suppresses IDE0017 in the test project: executable specs assign properties after construction to mirror user interaction order.
…instance alone When no error instance is being installed and exactly one is detected on the machine, its name is used as the queue address without user input.
…ock when none exist The dropdown options and its visibility (audit-only + 2 or more detected) come from the installed-instance seam. A NotEmpty validation rule on ServiceControlQueueAddress blocks Save for audit-only adds until an address resolves - covering both the multiple-instances case (until the user picks) and the none-found case. Error-only installs are exempt.
The attachment writes viewModel.ServiceControlQueueAddress instead of the null-conditional expression that produced an empty string for audit-only adds - the root cause of #4753, since empty values are silently skipped when writing the config file. The audit section gets a ComboBox (visible only when multiple error instances are detected) and a warning for the none-found case. Explicit change notifications are raised for the derived computed properties because the install checkboxes live on the base class, outside Fody's dependency analysis.
The constructor runs the name-uniquing convention against the machine's real Windows services before tests can substitute the GetWindowsServiceNames property seam, so screen-loaded tests asserting convention-derived paths failed on any machine with actual ServiceControl instances installed. An optional constructor parameter lets those tests inject a fake service list; Autofac supplies the default (real) implementation in production since the parameter is unresolvable and optional.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature: Audit Instance ServiceControl Queue Address
As an operator adding instances through ServiceControl Management Utility (SCMU), I want every audit instance to be connected to a ServiceControl (error) instance so that messages the audit instance sends to the error instance always have a valid destination.
Rules and Examples
Rule 1: Must address the audit instance to the error instance installed in the same session
When the user installs an error instance and an audit instance together, the audit
instance's queue address is the name of the error instance being installed — never an
already-installed one.
instance's queue address is the new error instance's name.
machine, yet no choice is offered — the error instance being installed always wins.
Rule 2: Should auto-detect the existing error instance when adding an audit instance alone
name is used as the queue address without any user input (no dropdown shown).
Rule 3: Must require an explicit choice when multiple existing error instances are found
Auto-detection cannot guess between several error instances — picking one silently
risks routing messages to the wrong instance. The choice dropdown is shown only in
this case.
instances, and unblocked once a choice is made.
Rule 4: Must block installation when no error instance exists to connect to
An audit instance without a reachable error instance is misconfigured by definition;
SCMU must not produce it.
alone, and a validation error prevents the installation from proceeding.
queue address does not apply and no validation error is raised.
Resolved decisions (for implementation)
InstanceFinder.ServiceControlInstances(); exposed on the view model through aGetInstalledErrorInstanceNamesfunction seam (mirrors the existingGetWindowsServiceNamespattern) so tests can substitute it.when adding an audit instance alone and more than one error instance is detected.
PowerShell remains the path for advanced scenarios.
INotifyDataErrorInfo— the same mechanism the UI uses to block Save. A full SCMU end-to-end test (install
a Windows service, inspect the written config file) is not automatable in this
repository's test suites.
error instance (
AddRemoteInstanceis only called when both instances are installedtogether) — candidate for a follow-up issue.