Compare commits

...

1 Commits

Author SHA1 Message Date
cesnimda 2aaf7a2426 fix(test): resolve PDF fixture from SDK build output 2026-11-20 08:57:19 +01:00
2 changed files with 25 additions and 4 deletions
+10 -4
View File
@@ -5,6 +5,7 @@
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<DefaultItemExcludes>$(DefaultItemExcludes);PdfBrowserStub/**</DefaultItemExcludes>
</PropertyGroup>
<ItemGroup>
@@ -24,14 +25,19 @@
<ProjectReference Include="..\JobTrackerApi\JobTrackerApi.csproj" />
<!-- Build the fixture, but only our explicit subdirectory copy owns its output.
The Linux apphost has no .exe suffix and collides with that directory if copied to root. -->
<ProjectReference Include="PdfBrowserStub/PdfBrowserStub.csproj" ReferenceOutputAssembly="false" Private="false" />
<Compile Remove="PdfBrowserStub/**/*.cs" />
<ProjectReference Include="PdfBrowserStub/PdfBrowserStub.csproj" ReferenceOutputAssembly="false" Private="false" OutputItemType="PdfBrowserStubAssembly" />
</ItemGroup>
<Target Name="CopyPdfBrowserStub" AfterTargets="Build">
<Error Condition="'@(PdfBrowserStubAssembly)' == ''" Text="The PDF browser stub project returned no output assembly." />
<PropertyGroup>
<PdfBrowserStubOutput>@(PdfBrowserStubAssembly->'%(RootDir)%(Directory)%(Filename)')</PdfBrowserStubOutput>
</PropertyGroup>
<ItemGroup>
<PdfBrowserFiles Include="PdfBrowserStub/bin/$(Configuration)/net9.0/*" />
<PdfBrowserFiles Include="$(PdfBrowserStubOutput).*" />
<!-- The Unix apphost is the only fixture file without an extension. -->
<PdfBrowserFiles Include="$(PdfBrowserStubOutput)" Condition="$([System.IO.File]::Exists('$(PdfBrowserStubOutput)'))" />
</ItemGroup>
<Copy SourceFiles="@(PdfBrowserFiles)" DestinationFolder="$(TargetDir)PdfBrowserStub" />
<Copy SourceFiles="@(PdfBrowserFiles)" DestinationFolder="$(TargetDir)PdfBrowserStub" SkipUnchangedFiles="true" />
</Target>
</Project>
@@ -0,0 +1,15 @@
# PDF admission test fixture
Verified on Windows x64 with SDK 9.0.317, VSTest 17.14.1 and a locked restore from the local NuGet package cache. The source baseline was `245f2feaa8bee2db8f5da0797b3e33f6ef8b056e`.
| Build | Test selection | Result |
| --- | --- | --- |
| Before fix, Release with a fresh `--artifacts-path` | `Default_limit_refuses_second_actual_browser_until_first_exits` | FAILED. The SDK built the stub in the requested location. The test output lacked the stub and the exporter reported that no browser was available. |
| After fix, Release with a fresh `--artifacts-path` | `PdfRenderAdmissionTests` | PASSED, 22 of 22. |
| After fix, Debug with the conventional output directory | `PdfRenderAdmissionTests` | PASSED, the same 22 of 22. |
Both successful runs built and launched the fixture through `dotnet test`. In each output layout the fixture directory contained exactly the apphost, assembly, symbols, dependency manifest and runtime configuration. All five SHA-256 hashes matched the corresponding stub project output. The conventional stub project's `bin` and `obj` directories already existed during the final relocated run and were excluded from the test content.
To repeat with restored dependencies, use `dotnet test JobTrackerApi.Tests/JobTrackerApi.Tests.csproj -c Debug --filter FullyQualifiedName~PdfRenderAdmissionTests`. For the relocated case, use `-c Release` and add `--artifacts-path <fresh-directory>`.
These tests exercise local process admission, cancellation and cleanup with the synthetic browser. Linux execution, visual PDF acceptance and production rendering remain separate qualifications.