From 58e2d4ce1751d053213e0cacc4243323a855d5bd Mon Sep 17 00:00:00 2001 From: Marc Paine Date: Tue, 6 Dec 2022 17:29:15 -0800 Subject: [PATCH] We're being flagged because a couple of the templates target online sources by default so deleting those test directories when complete. --- test/EndToEnd/ProjectBuildTests.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/EndToEnd/ProjectBuildTests.cs b/test/EndToEnd/ProjectBuildTests.cs index 0678fb440..e6c0728fa 100644 --- a/test/EndToEnd/ProjectBuildTests.cs +++ b/test/EndToEnd/ProjectBuildTests.cs @@ -246,6 +246,12 @@ namespace EndToEnd.Tests //check if the template created files Assert.True(directory.Exists); Assert.True(directory.EnumerateFileSystemInfos().Any()); + + // delete test directory for some tests so we aren't leaving behind non-compliant nuget files + if (templateName.Equals("nugetconfig")) + { + directory.Delete(true); + } } [WindowsOnlyTheory] @@ -329,7 +335,7 @@ namespace EndToEnd.Tests public void ItCanCreateTemplateWithDefaultFramework(string templateName) { string framework = DetectExpectedDefaultFramework(templateName); - TestTemplateCreateAndBuild(templateName, build: false, framework: framework); + TestTemplateCreateAndBuild(templateName, build: false, framework: framework, deleteTestDirectory: true); } /// @@ -415,7 +421,7 @@ namespace EndToEnd.Tests throw new Exception("Unsupported version of SDK"); } - private static void TestTemplateCreateAndBuild(string templateName, bool build = true, bool selfContained = false, string language = "", string framework = "") + private static void TestTemplateCreateAndBuild(string templateName, bool build = true, bool selfContained = false, string language = "", string framework = "", bool deleteTestDirectory = false) { DirectoryInfo directory = TestAssets.CreateTestDirectory(identifier: string.IsNullOrWhiteSpace(language) ? templateName : $"{templateName}[{language}]"); string projectDirectory = directory.FullName; @@ -468,6 +474,12 @@ namespace EndToEnd.Tests .Execute(buildArgs) .Should().Pass(); } + + // delete test directory for some tests so we aren't leaving behind non-compliant package files + if (deleteTestDirectory) + { + directory.Delete(true); + } } } }