dotnet / dotnet/sdk

Linux Installer Dependency Test is Non-Functional Due to Missing Build Infrastructure

Open
#52,221 1 comment 0 reactions 0 assignees View on GitHub
Test Debt untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

## Summary

The `GivenDotNetLinuxInstallers.ItHasExpectedDependencies` test in [`test/EndToEnd.Tests/GivenDotNetLinuxInstallers.cs`](https://github.com/dotnet/sdk/blob/main/test/EndToEnd.Tests/GivenDotNetLinuxInstallers.cs) has been silently disabled for approximately 4-5 years. The test relies on the `SDK_INSTALLER_FILE` environment variable, which is never set in the current SDK repository build infrastructure, causing the test to always return early without performing any validation.

## Current Behavior

```csharp
[Fact]
public void ItHasExpectedDependencies()
{
var installerFile = Environment.GetEnvironmentVariable("SDK_INSTALLER_FILE");
if (string.IsNullOrEmpty(installerFile))
{
return; // ← Always returns here - test never runs
}
// ... actual test logic never executes
}
```

## Root Cause Analysis

### Original Working Implementation (2018)

The test was originally created by @natemcmaster in the `installer` repository in [commit 2d008aa4f](https://github.com/dotnet/installer/commit/2d008aa4f74dabb7ab8b9e85aaa17d93dc1fc78f) on April 18, 2018. At that time, it worked correctly because the installer repository included the necessary MSBuild infrastructure:

**Files added in original commit:**
- `build/package/Installer.DEB.targets` - Set environment variable for Debian packages
- `build/package/Installer.RPM.targets` - Set environment variable for RPM packages
- `test/EndToEnd/GivenDotNetLinuxInstallers.cs` - The actual test

**Key infrastructure from `Installer.DEB.targets`:**
```xml


```

**Key infrastructure from `Installer.RPM.targets`:**
```xml


```

### Regression During Repository Consolidation (2019)

The test was moved to the SDK repository in [commit b4cf81a1fa](https://github.com/dotnet/sdk/commit/b4cf81a1fab7496620bf24edd600f11b6d8b1f77), as part of the "Port EndToEnd tests" effort during repository consolidation.

**Problem**: Only the test file was moved - the supporting MSBuild targets that set the `SDK_INSTALLER_FILE` environment variable were **not moved** to the SDK repository.

**Evidence**:
- ✅ Test file moved: `src/Tests/EndToEnd.Tests/GivenDotNetLinuxInstallers.cs`
- ❌ Build infrastructure missing: No equivalent to `Installer.DEB.targets` / `Installer.RPM.targets` in SDK repo
- ❌ Environment variable never set: No current build targets set `SDK_INSTALLER_FILE`

### Current State Verification

Search results confirm the environment variable is not set anywhere in the SDK repository:

```bash
$ grep -r "SDK_INSTALLER_FILE.*=" . --include="*.targets" --include="*.props" --include="*.yml"
# No results found
```

The variable is only referenced in the test files themselves:
```bash
$ grep -r "SDK_INSTALLER_FILE" . --include="*.cs"
./test/EndToEnd.Tests/GivenDotNetLinuxInstallers.cs: var installerFile = Environment.GetEnvironmentVariable("SDK_INSTALLER_FILE");
```

## Impact

- **Silent Test Failure**: The test appears to pass but provides no validation
- **Missing Coverage**: No verification that SDK installer packages have correct dependencies
- **Technical Debt**: Non-functional code that misleads developers about test coverage
- **Duration**: Issue has persisted for ~4-5 years without detection

## Proposed Solutions

### Option 1: Remove Non-Functional Test
Remove `GivenDotNetLinuxInstallers.cs` from the SDK repository since installer generation doesn't occur there.

### Option 2: Restore Functionality
Implement the missing build infrastructure in the SDK repository to:
- Set the `SDK_INSTALLER_FILE` environment variable appropriately during test execution

## Links

- **Original working commit**: https://github.com/dotnet/installer/commit/2d008aa4f74dabb7ab8b9e85aaa17d93dc1fc78f
- **Move to SDK repo commit**: https://github.com/dotnet/sdk/commit/b4cf81a1fab7496620bf24edd600f11b6d8b1f77
- **Current non-functional test**: [`test/EndToEnd.Tests/GivenDotNetLinuxInstallers.cs`](https://github.com/dotnet/sdk/blob/main/test/EndToEnd.Tests/GivenDotNetLinuxInstallers.cs)
- **Still-working installer repo infrastructure**:
- [`src/redist/targets/GenerateDebs.targets`](https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateDebs.targets#L80-L86)
- [`src/redist/targets/GenerateRPMs.targets`](https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateRPMs.targets#L354-L360)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.