From b9c15396e715e597b848655187446558561e6f8d Mon Sep 17 00:00:00 2001
From: Marc Paine
Date: Fri, 2 Dec 2022 12:33:32 -0800
Subject: [PATCH] Remove unnecessary sources from the test used nuget.config
file to reduce 429s
---
build/RunTestsOnHelix.cmd | 17 ++++++++++++++---
build/RunTestsOnHelix.sh | 17 ++++++++++++++---
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/build/RunTestsOnHelix.cmd b/build/RunTestsOnHelix.cmd
index b163aa31ecb1..4b8a2fd183a4 100644
--- a/build/RunTestsOnHelix.cmd
+++ b/build/RunTestsOnHelix.cmd
@@ -28,7 +28,18 @@ robocopy %HELIX_CORRELATION_PAYLOAD%\t\TestExecutionDirectoryFiles %TestExecutio
REM call dotnet new so the first run message doesn't interfere with the first test
dotnet new --debug:ephemeral-hive
REM avoid potetial concurrency issues when nuget is creating nuget.config
-dotnet nuget list source
+dotnet nuget list source --configfile %TestExecutionDirectory%\nuget.config
REM We downloaded a special zip of files to the .nuget folder so add that as a source
-dotnet new nugetconfig
-dotnet nuget add source %DOTNET_ROOT%\.nuget --configfile nuget.config
+dotnet nuget add source %DOTNET_ROOT%\.nuget --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget remove source dotnet6-transport --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget remove source dotnet6-internal-transport --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget remove source dotnet7-transport --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget remove source dotnet7-internal-transport --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget remove source richnav --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget remove source vs-impl --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget remove source dotnet-libraries-transport --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget remove source dotnet-tools-transport --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget remove source dotnet-libraries --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget remove source dotnet-tools --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget remove source dotnet-eng --configfile %TestExecutionDirectory%\nuget.config
+dotnet nuget list source --configfile %TestExecutionDirectory%\nuget.config
diff --git a/build/RunTestsOnHelix.sh b/build/RunTestsOnHelix.sh
index 3bf19520b677..b06db72fd7f0 100644
--- a/build/RunTestsOnHelix.sh
+++ b/build/RunTestsOnHelix.sh
@@ -17,6 +17,17 @@ cp -a $HELIX_CORRELATION_PAYLOAD/t/TestExecutionDirectoryFiles/. $TestExecutionD
# call dotnet new so the first run message doesn't interfere with the first test
dotnet new --debug:ephemeral-hive
# We downloaded a special zip of files to the .nuget folder so add that as a source
-dotnet new nugetconfig
-dotnet nuget add source $DOTNET_ROOT/.nuget --configfile nuget.config
-dotnet nuget list source
+dotnet nuget add source $DOTNET_ROOT/.nuget --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget list source --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget remove source dotnet6-transport --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget remove source dotnet6-internal-transport --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget remove source dotnet7-transport --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget remove source dotnet7-internal-transport --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget remove source richnav --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget remove source vs-impl --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget remove source dotnet-libraries-transport --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget remove source dotnet-tools-transport --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget remove source dotnet-libraries --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget remove source dotnet-tools --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget remove source dotnet-eng --configfile $TestExecutionDirectory/nuget.config
+dotnet nuget list source --configfile $TestExecutionDirectory/nuget.config
\ No newline at end of file