Skip to content

Fix Windows-only test failures: profile file-lock and firewall-prompting sockets#62

Merged
Xyntexx merged 2 commits into
AgOpenGPS-Official:developfrom
Xyntexx:fix/profile-test-file-lock
Jul 3, 2026
Merged

Fix Windows-only test failures: profile file-lock and firewall-prompting sockets#62
Xyntexx merged 2 commits into
AgOpenGPS-Official:developfrom
Xyntexx:fix/profile-test-file-lock

Conversation

@Xyntexx

@Xyntexx Xyntexx commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Two Windows-only test-suite fixes. Both are test-side only; no product code changes.

1. File-lock failure in Load_OlderProfileWithoutNewFields_KeepsModelDefaults

The test opened a read handle (FileShare.Read) on OldProfile.json and, while that handle was still open inside the using block, called WriteAllText on the same path. On Windows this deterministically fails with "process cannot access the file"; on Linux POSIX advisory locking lets the write through, which is why CI (ubuntu) never caught it. Read the file fully into a string and close the handle before writing back.

2. Windows Firewall prompt on every test run

VirtualSteerModule and VirtualMachineModule bound their listen sockets to IPAddress.Any (0.0.0.0), which makes Windows Defender Firewall prompt for network access. All virtual-module traffic is 127.0.0.1, so bind the listeners to IPAddress.Loopback instead - loopback bypasses the firewall, no per-machine allow rule needed. The send-only GPS receiver is left as an unbound UdpClient (outbound UDP does not trigger the prompt, and eager binding would race the machine module for an ephemeral port in VirtualModuleHub).

Testing

  • Models: 146 passed
  • Services: 1026 passed, 2 skipped
  • ViewModels: 222 passed
  • IntegrationTests: 9 passed

🤖 Generated with Claude Code

Xyntexx and others added 2 commits July 3, 2026 09:46
The test opened a read handle (FileShare.Read) on OldProfile.json and,
while that handle was still open inside the using block, called
WriteAllText on the same path -- which deterministically failed with
'process cannot access the file'. Read the file fully into a string and
close the handle before writing the stripped-down profile back.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The virtual steer and machine modules bound their listen sockets to
IPAddress.Any (0.0.0.0), which makes Windows Defender Firewall prompt for
network access on every test run. All virtual-module traffic is 127.0.0.1,
so bind the listeners to IPAddress.Loopback instead -- loopback traffic
bypasses the firewall entirely, no per-machine allow rule needed.

The send-only GPS receiver is left as an unbound UdpClient: outbound UDP
does not trigger the prompt, and eager binding would race the machine
module for an ephemeral port in VirtualModuleHub.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Xyntexx
Xyntexx merged commit cd6e08f into AgOpenGPS-Official:develop Jul 3, 2026
4 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.

1 participant