From 5f902567b6f26d2ba9f2763b549c98604272303a Mon Sep 17 00:00:00 2001 From: Faith Kangai Date: Thu, 26 Oct 2023 14:12:53 +0300 Subject: [PATCH 1/4] Fix left out case on simplifying nested if (#1792) --- .../CodeSnippetsPipeline.cs | 20 +++++++++++++++---- pipelines/snippets.yml | 16 +++++++-------- pipelines/templates/run-tests.yml | 8 ++++---- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.cs b/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.cs index 5af02e3b1..48b7fe82d 100644 --- a/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.cs +++ b/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.cs @@ -3,7 +3,7 @@ [TestFixture] public class CodeSnippetsPipeline { - // Assumption made below: snippetCategories = new string[] { "Stable", "KnownIssues"}; + private static readonly string[] TestCategories = new string[] { "Stable", "KnownIssues"}; public static HashSet GetStableTestsList(string language, string version) { @@ -30,10 +30,16 @@ private static IEnumerable GetTestData() var getEnv = (string name) => Environment.GetEnvironmentVariable(name) ?? throw new ArgumentNullException($"env:{name}"); // enumerate all HTTP snippets in the folder - var snippetCategory = getEnv("SNIPPET_CATEGORY"); + var testCategory = getEnv("TEST_CATEGORY"); var snippetsPath = getEnv("SNIPPETS_PATH"); var language = getEnv("SNIPPET_LANGUAGE").ToLowerInvariant(); var version = getEnv("GRAPH_VERSION"); + + if (!TestCategories.Contains(testCategory)) + { + throw new ArgumentException($"Invalid test category: {testCategory}. Valid values are: {string.Join(",", TestCategories)}."); + } + var snippets = Directory.EnumerateFiles(snippetsPath, $"*{version}-httpSnippet*", SearchOption.AllDirectories); var stableTestsList = GetStableTestsList(language, version); @@ -41,19 +47,25 @@ private static IEnumerable GetTestData() { var snippetName = Path.GetFileNameWithoutExtension(snippetFullPath).Replace("-httpSnippet", ""); TestCaseData testCase; - if (snippetCategory.Equals("Stable", StringComparison.OrdinalIgnoreCase) && stableTestsList.Contains(snippetName)) + if (testCategory.Equals("Stable", StringComparison.OrdinalIgnoreCase) && stableTestsList.Contains(snippetName)) { testCase = new TestCaseData(snippetFullPath, language); testCase.SetName(snippetName).SetCategory(nameof(CodeSnippetsPipeline)); yield return testCase; } - else //default to a known Issues test suite + else if (testCategory.Equals("KnownIssues", StringComparison.OrdinalIgnoreCase) && !stableTestsList.Contains(snippetName)) { testCase = new TestCaseData(snippetFullPath, language); testCase.SetName(snippetName).SetCategory(nameof(CodeSnippetsPipeline)); yield return testCase; } + else { + // if test category is stable and snippet name not in stable list, + // or test category is known issues and snippet name in stable list + // do not return the test case, ignore and skip it. + continue; + } } } diff --git a/pipelines/snippets.yml b/pipelines/snippets.yml index 88bf235bf..73436a3df 100644 --- a/pipelines/snippets.yml +++ b/pipelines/snippets.yml @@ -129,36 +129,36 @@ stages: 'HTTP v1 Stable': SNIPPET_LANGUAGE: 'http' GRAPH_VERSION: 'v1' - SNIPPET_CATEGORY: 'Stable' + TEST_CATEGORY: 'Stable' 'HTTP v1 KnownIssues': SNIPPET_LANGUAGE: 'http' GRAPH_VERSION: 'v1' - SNIPPET_CATEGORY: 'KnownIssues' + TEST_CATEGORY: 'KnownIssues' 'HTTP beta Stable': SNIPPET_LANGUAGE: 'http' GRAPH_VERSION: 'beta' - SNIPPET_CATEGORY: 'Stable' + TEST_CATEGORY: 'Stable' 'HTTP beta KnownIssues': SNIPPET_LANGUAGE: 'http' GRAPH_VERSION: 'beta' - SNIPPET_CATEGORY: 'KnownIssues' + TEST_CATEGORY: 'KnownIssues' ${{ each language in parameters.snippetLanguages }}: '${{ language }} v1 Stable': SNIPPET_LANGUAGE: ${{ lower(language) }} GRAPH_VERSION: 'v1' - SNIPPET_CATEGORY: 'Stable' + TEST_CATEGORY: 'Stable' '${{ language }} v1 KnownIssues': SNIPPET_LANGUAGE: ${{ lower(language) }} GRAPH_VERSION: 'v1' - SNIPPET_CATEGORY: 'KnownIssues' + TEST_CATEGORY: 'KnownIssues' '${{ language }} beta Stable': SNIPPET_LANGUAGE: ${{ lower(language) }} GRAPH_VERSION: 'beta' - SNIPPET_CATEGORY: 'Stable' + TEST_CATEGORY: 'Stable' '${{ language }} beta KnownIssues': SNIPPET_LANGUAGE: ${{ lower(language) }} GRAPH_VERSION: 'beta' - SNIPPET_CATEGORY: 'KnownIssues' + TEST_CATEGORY: 'KnownIssues' steps: - template: templates/run-tests.yml diff --git a/pipelines/templates/run-tests.yml b/pipelines/templates/run-tests.yml index 5cc6df66a..e2d8268f3 100644 --- a/pipelines/templates/run-tests.yml +++ b/pipelines/templates/run-tests.yml @@ -31,8 +31,8 @@ steps: arguments: '--configuration $(buildConfiguration)' - pwsh: | - Write-Host "Running tests for language: $env:SNIPPET_LANGUAGE, version: $env:GRAPH_VERSION, $env:SNIPPET_CATEGORY " - dotnet test ./CodeSnippetsPipeline.Test/ --configuration $env:BUILD_CONFIGURATION --logger "trx;logfilename=$(SNIPPET_LANGUAGE) $(GRAPH_VERSION) $(SNIPPET_CATEGORY) TestResults.trx" --results-directory $env:BUILD_ARTIFACTSTAGINGDIRECTORY/TestResults + Write-Host "Running tests for language: $env:SNIPPET_LANGUAGE, version: $env:GRAPH_VERSION, $env:TEST_CATEGORY " + dotnet test ./CodeSnippetsPipeline.Test/ --configuration $env:BUILD_CONFIGURATION --logger "trx;logfilename=$(SNIPPET_LANGUAGE) $(GRAPH_VERSION) $(TEST_CATEGORY) TestResults.trx" --results-directory $env:BUILD_ARTIFACTSTAGINGDIRECTORY/TestResults displayName: 'Run CodeSnippetsPipeline.Test' env: BUILD_CONFIGURATION: '$(buildConfiguration)' @@ -43,8 +43,8 @@ steps: displayName: 'Publish test results' inputs: testResultsFormat: 'VSTest' - testResultsFiles: '**/$(SNIPPET_LANGUAGE) $(GRAPH_VERSION) $(SNIPPET_CATEGORY) TestResults.trx' - testRunTitle: '$(Build.Reason) Snippet Generation $(SNIPPET_LANGUAGE) $(GRAPH_VERSION) $(SNIPPET_CATEGORY)' + testResultsFiles: '**/$(SNIPPET_LANGUAGE) $(GRAPH_VERSION) $(TEST_CATEGORY) TestResults.trx' + testRunTitle: '$(Build.Reason) Snippet Generation $(SNIPPET_LANGUAGE) $(GRAPH_VERSION) $(TEST_CATEGORY)' searchFolder: '$(Build.ArtifactStagingDirectory)/TestResults' mergeTestResults: false failTaskOnFailedTests: false From 6b5822f8ea9f76c393dee3d87a79d674a3d62df1 Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Sat, 28 Oct 2023 01:10:48 +0300 Subject: [PATCH 2/4] Bump OData lib version (#1799) --- OpenAPIService/OpenAPIService.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenAPIService/OpenAPIService.csproj b/OpenAPIService/OpenAPIService.csproj index a4c66c332..5f488c809 100644 --- a/OpenAPIService/OpenAPIService.csproj +++ b/OpenAPIService/OpenAPIService.csproj @@ -11,7 +11,7 @@ - + From 8edcdbd3ca3424f874f7082e7f321afb462b07ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 09:12:54 +0300 Subject: [PATCH 3/4] Bump NUnit.Analyzers from 3.8.0 to 3.9.0 (#1800) Bumps [NUnit.Analyzers](https://github.com/nunit/nunit.analyzers) from 3.8.0 to 3.9.0. - [Release notes](https://github.com/nunit/nunit.analyzers/releases) - [Changelog](https://github.com/nunit/nunit.analyzers/blob/master/CHANGES.txt) - [Commits](https://github.com/nunit/nunit.analyzers/compare/3.8.0...3.9.0) --- updated-dependencies: - dependency-name: NUnit.Analyzers dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- CodeSnippetsPipeline.Test/CodeSnippetsPipeline.Test.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.Test.csproj b/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.Test.csproj index e1a140736..285b1d91f 100644 --- a/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.Test.csproj +++ b/CodeSnippetsPipeline.Test/CodeSnippetsPipeline.Test.csproj @@ -12,7 +12,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 9aeacece35afbed42d3b800cd37647f4c9eac475 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 09:14:49 +0300 Subject: [PATCH 4/4] Bump Microsoft.VisualStudio.Web.CodeGeneration.Design (#1796) Bumps [Microsoft.VisualStudio.Web.CodeGeneration.Design](https://github.com/dotnet/Scaffolding) from 7.0.10 to 7.0.11. - [Release notes](https://github.com/dotnet/Scaffolding/releases) - [Commits](https://github.com/dotnet/Scaffolding/commits) --- updated-dependencies: - dependency-name: Microsoft.VisualStudio.Web.CodeGeneration.Design dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- GraphWebApi/GraphWebApi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GraphWebApi/GraphWebApi.csproj b/GraphWebApi/GraphWebApi.csproj index 406a8b28c..0259f5faf 100644 --- a/GraphWebApi/GraphWebApi.csproj +++ b/GraphWebApi/GraphWebApi.csproj @@ -50,7 +50,7 @@ - +