From 731297081f17e7780ba94d96bdec0b66297dad04 Mon Sep 17 00:00:00 2001 From: Michael Simons Date: Wed, 29 Apr 2026 14:37:24 +0000 Subject: [PATCH] Fix duplicate test cases in InstallRuntimeFromChannelTestCases The InstallRuntimeFromChannelTestCases property iterates both _runtimeBranches and _channels, which contain overlapping entries (e.g. 6.0 through 11.0). This produces 24 duplicate test case IDs that xUnit skips with warnings, which is wasteful and the output can be confusing. Fix by using a HashSet to deduplicate test case tuples before yielding them. Additionally, grant execute permissions on eng/common bash scripts for an improved local dev experience. Fixes #701 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build.sh | 0 eng/common/SetupNugetSources.sh | 0 eng/common/build.sh | 0 eng/common/cibuild.sh | 0 eng/common/darc-init.sh | 0 eng/common/dotnet-install.sh | 0 eng/common/generate-sbom-prep.sh | 0 eng/common/init-tools-native.sh | 0 eng/common/internal-feed-operations.sh | 0 eng/common/msbuild.sh | 0 eng/common/pipeline-logging-functions.sh | 0 eng/common/tools.sh | 0 ...ivenThatIWantToInstallDotnetFromAScript.cs | 28 ++++++++++++------- 13 files changed, 18 insertions(+), 10 deletions(-) mode change 100644 => 100755 build.sh mode change 100644 => 100755 eng/common/SetupNugetSources.sh mode change 100644 => 100755 eng/common/build.sh mode change 100644 => 100755 eng/common/cibuild.sh mode change 100644 => 100755 eng/common/darc-init.sh mode change 100644 => 100755 eng/common/dotnet-install.sh mode change 100644 => 100755 eng/common/generate-sbom-prep.sh mode change 100644 => 100755 eng/common/init-tools-native.sh mode change 100644 => 100755 eng/common/internal-feed-operations.sh mode change 100644 => 100755 eng/common/msbuild.sh mode change 100644 => 100755 eng/common/pipeline-logging-functions.sh mode change 100644 => 100755 eng/common/tools.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh old mode 100644 new mode 100755 diff --git a/eng/common/build.sh b/eng/common/build.sh old mode 100644 new mode 100755 diff --git a/eng/common/cibuild.sh b/eng/common/cibuild.sh old mode 100644 new mode 100755 diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh old mode 100644 new mode 100755 diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh old mode 100644 new mode 100755 diff --git a/eng/common/generate-sbom-prep.sh b/eng/common/generate-sbom-prep.sh old mode 100644 new mode 100755 diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh old mode 100644 new mode 100755 diff --git a/eng/common/internal-feed-operations.sh b/eng/common/internal-feed-operations.sh old mode 100644 new mode 100755 diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh old mode 100644 new mode 100755 diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh old mode 100644 new mode 100755 diff --git a/eng/common/tools.sh b/eng/common/tools.sh old mode 100644 new mode 100755 diff --git a/tests/Install-Scripts.Test/GivenThatIWantToInstallDotnetFromAScript.cs b/tests/Install-Scripts.Test/GivenThatIWantToInstallDotnetFromAScript.cs index 8f33027f6d..2838f85993 100644 --- a/tests/Install-Scripts.Test/GivenThatIWantToInstallDotnetFromAScript.cs +++ b/tests/Install-Scripts.Test/GivenThatIWantToInstallDotnetFromAScript.cs @@ -131,17 +131,22 @@ public static IEnumerable InstallRuntimeFromChannelTestCases { get { + var seen = new HashSet<(string, string?, string)>(); + // Download runtimes using branches as channels. foreach (var runtimeBranchInfo in _runtimeBranches) { foreach (string? quality in GetQualityOptionsFromFlags(runtimeBranchInfo.quality).DefaultIfEmpty()) { - yield return new object?[] + if (seen.Add((runtimeBranchInfo.branch, quality, runtimeBranchInfo.versionRegex))) { - runtimeBranchInfo.branch, - quality, - runtimeBranchInfo.versionRegex, - }; + yield return new object?[] + { + runtimeBranchInfo.branch, + quality, + runtimeBranchInfo.versionRegex, + }; + } } } @@ -150,12 +155,15 @@ public static IEnumerable InstallRuntimeFromChannelTestCases { foreach (string? quality in GetQualityOptionsFromFlags(channelInfo.quality).DefaultIfEmpty()) { - yield return new object?[] + if (seen.Add((channelInfo.channel, quality, channelInfo.versionRegex))) { - channelInfo.channel, - quality, - channelInfo.versionRegex, - }; + yield return new object?[] + { + channelInfo.channel, + quality, + channelInfo.versionRegex, + }; + } } } }