Skip to content

Installer cancellation test can parse an empty PID file under load #4801

Description

@Widthdom

Summary

ProgramRunnerTests.RunInstallerProcess_CancelsHungInstaller can fail under parallel test load because the 100 ms cancellation may kill the shell after redirection creates installer.pid but before echo $$ writes the PID. The test checks only that the file exists and then parses its contents, so it can observe an empty string.

Observed failure:

System.FormatException: The input string '' was not in a correct format.
at System.Int32.Parse(...)
at CodeIndex.Tests.ProgramRunnerTests.RunInstallerProcess_CancelsHungInstaller()

Reproduction

The failure occurred while running a broader filtered Release net8.0 group (859 tests):

dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj -c Release --no-build --no-restore -f net8.0 -p:UseSharedCompilation=false --filter "FullyQualifiedName~Issue4738|FullyQualifiedName~ConsoleUiTests|FullyQualifiedName~ProgramCliTests|FullyQualifiedName~ProgramRunnerTests"

The test passed immediately when rerun in isolation.

Expected

The test should wait for the PID file to contain a complete integer before cancellation, or use a readiness handshake before starting the cancellation window.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions