fix(windows): per-test timeout i.p.v. @OnPlatform — flutter test verwerkt dat niet #942

Merged
brenno merged 3 commits from fix/windows-test-timeout into main 2026-07-28 00:49:48 +00:00
Owner

@OnPlatform op bibliotheekniveau wordt door flutter test niet verwerkt (alleen dart test doet dat). De tests in native_git_mirror_test.dart kregen daardoor op de Windows-CI de standaard 30s timeout in plaats van de bedoelde 3 minuten.

De git-zware tests (clone/commit/push/grep) zijn op Windows onder belasting trager dan 30s, wat een cascade veroorzaakte:

  1. Test timet out na 30s
  2. tearDown (deleteTempDir) faalt met errno 32 (git houdt bestanden vast)
  3. Volgende setUp faalt: temp dir niet opgeruimd → already exists

Vervang @OnPlatform door _wtest(), een wrapper die per-test de timeout zet. Op niet-Windows is _windowsTimeout null (strakke standaard blijft).

Fixes #933 (definitief).

@OnPlatform op bibliotheekniveau wordt door `flutter test` niet verwerkt (alleen `dart test` doet dat). De tests in `native_git_mirror_test.dart` kregen daardoor op de Windows-CI de standaard 30s timeout in plaats van de bedoelde 3 minuten. De git-zware tests (clone/commit/push/grep) zijn op Windows onder belasting trager dan 30s, wat een cascade veroorzaakte: 1. Test timet out na 30s 2. tearDown (deleteTempDir) faalt met errno 32 (git houdt bestanden vast) 3. Volgende setUp faalt: temp dir niet opgeruimd → already exists Vervang @OnPlatform door `_wtest()`, een wrapper die per-test de timeout zet. Op niet-Windows is `_windowsTimeout` null (strakke standaard blijft). Fixes #933 (definitief).
The native git path pins a self-signed server certificate by writing it out
and pointing `http.sslCAInfo` at it. But Git for Windows defaults to the
schannel TLS backend, which ignores `http.sslCAInfo` entirely (the installer
even unsets it, to keep the Windows certificate store authoritative). On
Windows the pin was therefore a paper measure: git would validate against the
system store instead of our anchor.

Force `http.sslBackend=openssl` on the pinned path (Windows only), so git
validates against exactly the CA file we supply — the behaviour already proven
with a real server on macOS/Linux. Scoped to the pinned connection: a public-CA
server sets no `sslCAInfo`, keeps schannel and the Windows store (incl. any
corporate root). The host-pin (`http.curloptResolve`) and redirect refusal are
libcurl/git-level and backend-independent, so they need nothing extra.

Split off from #926 as #934. Pure helper `pinnedCertBackendConfig` keeps the
decision unit-testable on any platform.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
test(git): run the native-git pin tests on Windows CI (#934)
All checks were successful
scans / scans (pull_request) Successful in 3m18s
4d6491103f
The two real-server tests — that git honours http.curloptResolve (host pin) and
http.sslCAInfo (cert pin) — were skipped on Windows because git "could not
connect" on the windows-2022 runner. That was a harness artifact, not a git
limitation: the tests built their own POSIX-only env (`/dev/null`, PATH only),
and without SystemRoot the socket DLL never loads on Windows, so every
connection failed regardless of the pin.

Add `hermeticGitEnv`, mirroring NativeGitCli._hardenedEnv's per-platform
allowlist (SystemRoot etc., NUL for the global config), and drive both real-
server tests through it. Un-skip on Windows, and on the cert-pin test send the
same `http.sslBackend=openssl` the app now forces there (pinnedCertBackendConfig)
so the pin is honoured under schannel's replacement. The windows-2022 CI now
verifies both pins empirically instead of assuming them.

Also unit-tests pinnedCertBackendConfig (both branches) so the Windows decision
holds on any dev machine.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(windows): per-test timeout i.p.v. @OnPlatform — flutter test verwerkt dat niet
All checks were successful
scans / scans (pull_request) Successful in 3m19s
eb2ca31134
brenno merged commit 02183a58bf into main 2026-07-28 00:49:48 +00:00
Sign in to join this conversation.
No description provided.