From 15581ff7dfa6027b6e9130d7eab1380e479a5643 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 12:59:50 -0700 Subject: [PATCH 01/17] use breadcrumbfiles associated with each asset --- .../GitStoreTests.cs | 20 ++++++++++++++----- .../TestHelpers.cs | 2 +- .../Store/GitStoreBreadcrumb.cs | 9 ++++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/GitStoreTests.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/GitStoreTests.cs index 23d1cda2a67..96abbca37ef 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/GitStoreTests.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/GitStoreTests.cs @@ -9,6 +9,7 @@ using System.Linq; using System.ComponentModel; using Azure.Sdk.tools.TestProxy.Common; +using System.Collections.Generic; namespace Azure.Sdk.Tools.TestProxy.Tests { @@ -584,7 +585,7 @@ public async Task GetPathResolves(string inputJson) [EnvironmentConditionalSkipFact] [Trait("Category", "Integration")] - public async Task BreadcrumbContainsMultipleAssetRefs() + public async Task BreadCrumbMaintainsMultipleBreadCrumbs() { var inputJson = @"{ ""AssetsRepo"": ""Azure/azure-sdk-assets-integration"", @@ -611,7 +612,8 @@ public async Task BreadcrumbContainsMultipleAssetRefs() try { var assetStore = (await _defaultStore.ParseConfigurationFile(Path.Join(testFolder, target1))).ResolveAssetsStoreLocation(); - var breadCrumbFile = Path.Join(assetStore.ToString(), ".breadcrumb"); + + var breadCrumbs = new List(); // run 3 restore operations foreach (var assetsJson in folderStructure) @@ -619,14 +621,22 @@ public async Task BreadcrumbContainsMultipleAssetRefs() var jsonFileLocation = Path.Join(testFolder, assetsJson); var parsedJson = await _defaultStore.ParseConfigurationFile(jsonFileLocation); - await _defaultStore.Restore(jsonFileLocation); + var breadCrumbFile = Path.Join(assetStore.ToString(), "breadcrumb", $"{parsedJson.AssetRepoShortHash}.breadcrumb"); + breadCrumbs.Add(breadCrumbFile); + + await _defaultStore.Restore(jsonFileLocation); TestHelpers.CheckBreadcrumbAgainstAssetsConfig(parsedJson); } - var crumbs = File.ReadAllLines(breadCrumbFile).Select(x => new BreadcrumbLine(x)); + // double verify they are where we expect + foreach(var crumbFile in breadCrumbs) + { + Assert.True(File.Exists(crumbFile)); + } + // we have already validated that each tag contains what we expect, just confirm we aren't eliminating lines now. - Assert.Equal(3, crumbs.Count()); + Assert.Equal(3, breadCrumbs.Count()); } finally { diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestHelpers.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestHelpers.cs index 30347f3bf23..7ab242bf91b 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestHelpers.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/TestHelpers.cs @@ -355,7 +355,7 @@ public static void CreateFileWithInitialVersion(string testFolder, string fileNa public static void CheckBreadcrumbAgainstAssetsConfig(GitAssetsConfiguration configuration) { var assetsStorePath = configuration.ResolveAssetsStoreLocation(); - var breadCrumbFile = Path.Join(assetsStorePath.ToString(), ".breadcrumb"); + var breadCrumbFile = Path.Join(assetsStorePath.ToString(), "breadcrumb", $"{configuration.AssetRepoShortHash}.breadcrumb"); var targetKey = configuration.AssetsJsonRelativeLocation.ToString(); Assert.True(File.Exists(breadCrumbFile)); diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStoreBreadcrumb.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStoreBreadcrumb.cs index f9129f50aea..7e491d0ead8 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStoreBreadcrumb.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStoreBreadcrumb.cs @@ -73,7 +73,14 @@ public GitStoreBreadcrumb() { } public string GetBreadCrumbLocation(GitAssetsConfiguration configuration) { - return Path.Join(configuration.ResolveAssetsStoreLocation().ToString(), ".breadcrumb"); + var breadCrumbFolder = Path.Combine(configuration.ResolveAssetsStoreLocation().ToString(), "breadcrumb"); + + if (!Directory.Exists(breadCrumbFolder)) + { + Directory.CreateDirectory(breadCrumbFolder); + } + + return Path.Join(breadCrumbFolder, $"{configuration.AssetRepoShortHash}.breadcrumb"); } /// From cc967da3a1b1fbd65d0f4dffcc624de7e754edea Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 15:56:26 -0700 Subject: [PATCH 02/17] exclude the breadcrumb folder when finding the targeted assets directory --- .../scripts/test-scripts/assets.Tests.Helpers.ps1 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index 83339919c11..4918be927a4 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -311,9 +311,11 @@ Function Get-AssetsFilePath { $assetsDir = Split-Path -Path $AssetsJsonFile $startingPath = Join-Path -Path $assetsDir -ChildPath ".assets" } - # It's odd that $folder.Count and $folders.Lenght work and we need to do this - $numDirs = Get-ChildItem $startingPath -Directory | Measure-Object | ForEach-Object{$_.Count} - $folders = Get-ChildItem $startingPath -Directory + # It's odd that $folder.Count and $folders.Length work and we need to do this + $numDirs = Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" | Measure-Object | ForEach-Object{$_.Count} + + $folders = Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" + # There should only be one folder if (1 -ne $numDirs) { LogError "The assets directory ($startingPath) should only contain 1 subfolder not $numDirs ($folders -join $([Environment]::NewLine))" From 4c2cf5dc5080b46b860a7ce6e325ddcdec248dd9 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 16:54:16 -0700 Subject: [PATCH 03/17] update --- .../test-scripts/assets.Tests.Helpers.ps1 | 3 + tools/test-proxy/tests.yml | 356 +++++++++--------- 2 files changed, 181 insertions(+), 178 deletions(-) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index 4918be927a4..e89bd401094 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -316,6 +316,9 @@ Function Get-AssetsFilePath { $folders = Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" + Get-ChildItem "What we see overall in the assets folder is" + Get-ChildItem $startingPath -Directory | % { $_.FullName } + # There should only be one folder if (1 -ne $numDirs) { LogError "The assets directory ($startingPath) should only contain 1 subfolder not $numDirs ($folders -join $([Environment]::NewLine))" diff --git a/tools/test-proxy/tests.yml b/tools/test-proxy/tests.yml index dc9a4b3410d..de14533bd0c 100644 --- a/tools/test-proxy/tests.yml +++ b/tools/test-proxy/tests.yml @@ -109,181 +109,181 @@ stages: CLI_TEST_DOCKER_TAG: $(CLI_TEST_DOCKER_TAG) DISABLE_INTEGRATION_BRANCH_CLEANUP: true - - stage: RepoUnitTests - displayName: Repo-Specific Unit Tests - dependsOn: [] - jobs: - - job: Test_JS_Utils - - displayName: Invoke JS Utils CI Tests - - strategy: - matrix: - Windows: - Pool: 'azsdk-pool-mms-win-2022-general' - OS: 'Windows' - Linux: - Pool: azsdk-pool-mms-ubuntu-2204-general - OS: 'Linux' - Mac: - Pool: 'Azure Pipelines' - OS: 'Mac' - - pool: - name: $(Pool) - - variables: - REPO: "Azure/azure-sdk-for-js" - CLONE_LOCATION: "$(Agent.BuildDirectory)/js_repo" - - steps: - - template: /eng/pipelines/templates/steps/install-dotnet.yml - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: "Use Node 16.x" - - - pwsh: | - git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 - displayName: Clone Repo - - - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml - parameters: - runProxy: true - rootFolder: $(CLONE_LOCATION) - - - pwsh: | - npm install -g @microsoft/rush@5.48.0 - rush update - rush build -t . - displayName: 'Install Rush, build and install proxy tests project' - workingDirectory: $(CLONE_LOCATION)/sdk/test-utils/recorder - env: - PROXY_MANUAL_START: "true" - - - pwsh: | - rushx test:node - displayName: 'Invoke Tests' - workingDirectory: $(CLONE_LOCATION)/sdk/test-utils/recorder - env: - PROXY_MANUAL_START: "true" - - - job: Test_Python_Tables - - displayName: Run Python Tables CI Tests - - strategy: - matrix: - Windows: - Pool: 'azsdk-pool-mms-win-2022-general' - OS: 'Windows' - Linux: - Pool: azsdk-pool-mms-ubuntu-2204-general - OS: 'Linux' - Mac: - Pool: 'Azure Pipelines' - OS: 'Mac' - - pool: - name: $(Pool) - - variables: - REPO: "Azure/azure-sdk-for-python" - CLONE_LOCATION: "$(Agent.BuildDirectory)/python_repo" - - steps: - - template: /eng/pipelines/templates/steps/install-dotnet.yml - - - template: /eng/pipelines/templates/steps/use-python-version.yml - parameters: - versionSpec: '3.9' - - - pwsh: | - git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 - displayName: Clone Repo - - - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml - parameters: - runProxy: true - rootFolder: $(CLONE_LOCATION) - - - pwsh: | - python -m pip install -r dev_requirements.txt - python -m pip install . - displayName: 'Install requirements and package' - workingDirectory: $(CLONE_LOCATION)/sdk/tables/azure-data-tables/ - - - pwsh: | - pytest . - displayName: 'Invoke Tests' - workingDirectory: $(CLONE_LOCATION)/sdk/tables/azure-data-tables/ - env: - PROXY_URL: "http://localhost:5000" - PROXY_MANUAL_START: true - - - job: Test_Java_Core - - displayName: Run Java Core Local Tests - - strategy: - matrix: - Windows: - Pool: 'azsdk-pool-mms-win-2022-general' - OS: 'Windows' - Linux: - Pool: azsdk-pool-mms-ubuntu-2204-general - OS: 'Linux' - Mac: - Pool: 'Azure Pipelines' - OS: 'Mac' - - pool: - name: $(Pool) - - variables: - REPO: "Azure/azure-sdk-for-java" - CLONE_LOCATION: "$(Agent.BuildDirectory)/java_repo" - - steps: - - - template: /eng/pipelines/templates/steps/install-dotnet.yml - - - template: /eng/pipelines/templates/steps/use-python-version.yml - parameters: - versionSpec: '3.9' - - - pwsh: | - git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 - displayName: Clone Repo - - - pwsh: | - Write-Host "mvn install -f eng/code-quality-reports/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" - mvn install -f eng/code-quality-reports/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true - Write-Host "mvn install -f sdk/core/azure-json/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" - mvn install -f sdk/core/azure-json/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true - Write-Host "mvn install -f sdk/core/azure-core/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" - mvn install -f sdk/core/azure-core/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true - Write-Host "mvn install -f sdk/core/azure-core-test/pom.xml -DskipTests=true "-Dmaven.javadoc.skip=true" -DskipCheckStyle=true" - mvn install -f sdk/core/azure-core-test/pom.xml -DskipTests=true "-Dmaven.javadoc.skip=true" -DskipCheckStyle=true - displayName: 'Install azure-core-test' - workingDirectory: $(CLONE_LOCATION) - - # we want the proxy available so we can restore recordings and avoid the race condition error - # however, we also want to not run it such that the local executable is used by the java tests. - - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml - parameters: - runProxy: false - - - pwsh: | - Get-ChildItem -Recurse -Path $(CLONE_LOCATION)/sdk/ -Filter assets.json | ` - ForEach-Object { test-proxy restore -a $_.FullName } - displayName: Restore Recordings - - - pwsh: | - # To run java in 'local' mode, we need to ensure that the natively set CI variable $env:TF_BUILD - # is not populated. Given it's auto-populated at step init by devops, we do it inline here. - $env:TF_BUILD="" - mvn surefire:test -f sdk/core/azure-core-test/pom.xml - displayName: 'Invoke Tests' - workingDirectory: $(CLONE_LOCATION) + # - stage: RepoUnitTests + # displayName: Repo-Specific Unit Tests + # dependsOn: [] + # jobs: + # - job: Test_JS_Utils + + # displayName: Invoke JS Utils CI Tests + + # strategy: + # matrix: + # Windows: + # Pool: 'azsdk-pool-mms-win-2022-general' + # OS: 'Windows' + # Linux: + # Pool: azsdk-pool-mms-ubuntu-2204-general + # OS: 'Linux' + # Mac: + # Pool: 'Azure Pipelines' + # OS: 'Mac' + + # pool: + # name: $(Pool) + + # variables: + # REPO: "Azure/azure-sdk-for-js" + # CLONE_LOCATION: "$(Agent.BuildDirectory)/js_repo" + + # steps: + # - template: /eng/pipelines/templates/steps/install-dotnet.yml + + # - task: NodeTool@0 + # inputs: + # versionSpec: "16.x" + # displayName: "Use Node 16.x" + + # - pwsh: | + # git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 + # displayName: Clone Repo + + # - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml + # parameters: + # runProxy: true + # rootFolder: $(CLONE_LOCATION) + + # - pwsh: | + # npm install -g @microsoft/rush@5.48.0 + # rush update + # rush build -t . + # displayName: 'Install Rush, build and install proxy tests project' + # workingDirectory: $(CLONE_LOCATION)/sdk/test-utils/recorder + # env: + # PROXY_MANUAL_START: "true" + + # - pwsh: | + # rushx test:node + # displayName: 'Invoke Tests' + # workingDirectory: $(CLONE_LOCATION)/sdk/test-utils/recorder + # env: + # PROXY_MANUAL_START: "true" + + # - job: Test_Python_Tables + + # displayName: Run Python Tables CI Tests + + # strategy: + # matrix: + # Windows: + # Pool: 'azsdk-pool-mms-win-2022-general' + # OS: 'Windows' + # Linux: + # Pool: azsdk-pool-mms-ubuntu-2204-general + # OS: 'Linux' + # Mac: + # Pool: 'Azure Pipelines' + # OS: 'Mac' + + # pool: + # name: $(Pool) + + # variables: + # REPO: "Azure/azure-sdk-for-python" + # CLONE_LOCATION: "$(Agent.BuildDirectory)/python_repo" + + # steps: + # - template: /eng/pipelines/templates/steps/install-dotnet.yml + + # - template: /eng/pipelines/templates/steps/use-python-version.yml + # parameters: + # versionSpec: '3.9' + + # - pwsh: | + # git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 + # displayName: Clone Repo + + # - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml + # parameters: + # runProxy: true + # rootFolder: $(CLONE_LOCATION) + + # - pwsh: | + # python -m pip install -r dev_requirements.txt + # python -m pip install . + # displayName: 'Install requirements and package' + # workingDirectory: $(CLONE_LOCATION)/sdk/tables/azure-data-tables/ + + # - pwsh: | + # pytest . + # displayName: 'Invoke Tests' + # workingDirectory: $(CLONE_LOCATION)/sdk/tables/azure-data-tables/ + # env: + # PROXY_URL: "http://localhost:5000" + # PROXY_MANUAL_START: true + + # - job: Test_Java_Core + + # displayName: Run Java Core Local Tests + + # strategy: + # matrix: + # Windows: + # Pool: 'azsdk-pool-mms-win-2022-general' + # OS: 'Windows' + # Linux: + # Pool: azsdk-pool-mms-ubuntu-2204-general + # OS: 'Linux' + # Mac: + # Pool: 'Azure Pipelines' + # OS: 'Mac' + + # pool: + # name: $(Pool) + + # variables: + # REPO: "Azure/azure-sdk-for-java" + # CLONE_LOCATION: "$(Agent.BuildDirectory)/java_repo" + + # steps: + + # - template: /eng/pipelines/templates/steps/install-dotnet.yml + + # - template: /eng/pipelines/templates/steps/use-python-version.yml + # parameters: + # versionSpec: '3.9' + + # - pwsh: | + # git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 + # displayName: Clone Repo + + # - pwsh: | + # Write-Host "mvn install -f eng/code-quality-reports/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" + # mvn install -f eng/code-quality-reports/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true + # Write-Host "mvn install -f sdk/core/azure-json/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" + # mvn install -f sdk/core/azure-json/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true + # Write-Host "mvn install -f sdk/core/azure-core/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" + # mvn install -f sdk/core/azure-core/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true + # Write-Host "mvn install -f sdk/core/azure-core-test/pom.xml -DskipTests=true "-Dmaven.javadoc.skip=true" -DskipCheckStyle=true" + # mvn install -f sdk/core/azure-core-test/pom.xml -DskipTests=true "-Dmaven.javadoc.skip=true" -DskipCheckStyle=true + # displayName: 'Install azure-core-test' + # workingDirectory: $(CLONE_LOCATION) + + # # we want the proxy available so we can restore recordings and avoid the race condition error + # # however, we also want to not run it such that the local executable is used by the java tests. + # - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml + # parameters: + # runProxy: false + + # - pwsh: | + # Get-ChildItem -Recurse -Path $(CLONE_LOCATION)/sdk/ -Filter assets.json | ` + # ForEach-Object { test-proxy restore -a $_.FullName } + # displayName: Restore Recordings + + # - pwsh: | + # # To run java in 'local' mode, we need to ensure that the natively set CI variable $env:TF_BUILD + # # is not populated. Given it's auto-populated at step init by devops, we do it inline here. + # $env:TF_BUILD="" + # mvn surefire:test -f sdk/core/azure-core-test/pom.xml + # displayName: 'Invoke Tests' + # workingDirectory: $(CLONE_LOCATION) From 55a93370cc4bf570574be0b65d5332b09f6c0d6d Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 16:58:04 -0700 Subject: [PATCH 04/17] properly format --- tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index e89bd401094..45d08ee0ed9 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -316,7 +316,7 @@ Function Get-AssetsFilePath { $folders = Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" - Get-ChildItem "What we see overall in the assets folder is" + Write-Host "What we see overall in the assets folder is" Get-ChildItem $startingPath -Directory | % { $_.FullName } # There should only be one folder From a2eec46a4f40fcd312368ce6108bac353f66d8e7 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 16:58:32 -0700 Subject: [PATCH 05/17] eliminate even more builds --- tools/test-proxy/tests.yml | 74 +++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/tools/test-proxy/tests.yml b/tools/test-proxy/tests.yml index de14533bd0c..b59f0a40fee 100644 --- a/tools/test-proxy/tests.yml +++ b/tools/test-proxy/tests.yml @@ -7,43 +7,43 @@ stages: - stage: IntegrationTests displayName: "Asset Sync Integration Tests" jobs: - - job: Solution_Integration_Test - - strategy: - matrix: - Windows: - Pool: 'azsdk-pool-mms-win-2022-general' - OS: 'Windows' - Linux: - Pool: azsdk-pool-mms-ubuntu-2204-general - OS: 'Linux' - Mac: - Pool: 'Azure Pipelines' - OS: 'Mac' - - pool: - name: $(Pool) - - steps: - - template: /eng/pipelines/templates/steps/install-dotnet.yml - - - script: 'dotnet test /p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory) --filter "Category=Integration" --logger trx $(Build.SourcesDirectory)/tools/test-proxy/' - displayName: 'Test' - env: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_MULTILEVEL_LOOKUP: 0 - GIT_TOKEN: $(azuresdk-github-pat) - GIT_COMMIT_OWNER: azure-sdk - GIT_COMMIT_EMAIL: azuresdk@microsoft.com - - - task: PublishTestResults@2 - condition: succeededOrFailed() - inputs: - testResultsFiles: '**/*.trx' - testRunTitle: '$(OS) AssetSync tests against .NET' - testResultsFormat: 'VSTest' - mergeTestResults: true + # - job: Solution_Integration_Test + + # strategy: + # matrix: + # Windows: + # Pool: 'azsdk-pool-mms-win-2022-general' + # OS: 'Windows' + # Linux: + # Pool: azsdk-pool-mms-ubuntu-2204-general + # OS: 'Linux' + # Mac: + # Pool: 'Azure Pipelines' + # OS: 'Mac' + + # pool: + # name: $(Pool) + + # steps: + # - template: /eng/pipelines/templates/steps/install-dotnet.yml + + # - script: 'dotnet test /p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory) --filter "Category=Integration" --logger trx $(Build.SourcesDirectory)/tools/test-proxy/' + # displayName: 'Test' + # env: + # DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + # DOTNET_CLI_TELEMETRY_OPTOUT: 1 + # DOTNET_MULTILEVEL_LOOKUP: 0 + # GIT_TOKEN: $(azuresdk-github-pat) + # GIT_COMMIT_OWNER: azure-sdk + # GIT_COMMIT_EMAIL: azuresdk@microsoft.com + + # - task: PublishTestResults@2 + # condition: succeededOrFailed() + # inputs: + # testResultsFiles: '**/*.trx' + # testRunTitle: '$(OS) AssetSync tests against .NET' + # testResultsFormat: 'VSTest' + # mergeTestResults: true - job: CLI_Integration_Test From ad05dd27ce4cf992ea3d14aecf57b00a00166c45 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 17:05:03 -0700 Subject: [PATCH 06/17] what is going wrong --- tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index 45d08ee0ed9..aa77192740e 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -317,7 +317,7 @@ Function Get-AssetsFilePath { $folders = Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" Write-Host "What we see overall in the assets folder is" - Get-ChildItem $startingPath -Directory | % { $_.FullName } + Get-ChildItem $startingPath -Recurse | % { $_.FullName } # There should only be one folder if (1 -ne $numDirs) { From 9da58d1d7279ab2b98c8bd67c611f36b3a0a07ed Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 17:16:42 -0700 Subject: [PATCH 07/17] something is seriously going wrong, still can't see why --- tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index aa77192740e..951f4f4a545 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -317,7 +317,7 @@ Function Get-AssetsFilePath { $folders = Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" Write-Host "What we see overall in the assets folder is" - Get-ChildItem $startingPath -Recurse | % { $_.FullName } + Get-ChildItem $startingPath -Recurse | % { Write-Host $_.FullName } | Out-Null # There should only be one folder if (1 -ne $numDirs) { From f31ee07278d0a7f45bc73ddd0abf6568826ed82d Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 17:22:17 -0700 Subject: [PATCH 08/17] what about this? --- tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index 951f4f4a545..5f0e7079b1d 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -317,7 +317,7 @@ Function Get-AssetsFilePath { $folders = Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" Write-Host "What we see overall in the assets folder is" - Get-ChildItem $startingPath -Recurse | % { Write-Host $_.FullName } | Out-Null + Get-ChildItem $startingPath -Recurse -Exclude "breadcrumb" | % { Write-Host $_.FullName } | Out-Null # There should only be one folder if (1 -ne $numDirs) { From bc759c001e323c83c192cea57bf8e1aadf29cf92 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 17:27:14 -0700 Subject: [PATCH 09/17] . --- tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index 5f0e7079b1d..1768a895c5a 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -318,6 +318,7 @@ Function Get-AssetsFilePath { Write-Host "What we see overall in the assets folder is" Get-ChildItem $startingPath -Recurse -Exclude "breadcrumb" | % { Write-Host $_.FullName } | Out-Null + Get-ChildItem -Directory -Exclude "breadcrumb" | % { Write-Host $_.FullName } | Out-Null # There should only be one folder if (1 -ne $numDirs) { From 66a16ce7e1abd4e3acaf8a82849b74bd65c822ae Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 17:33:39 -0700 Subject: [PATCH 10/17] adjusting the language and how we dump the values --- .../test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index 1768a895c5a..ee4f427f7c9 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -318,8 +318,13 @@ Function Get-AssetsFilePath { Write-Host "What we see overall in the assets folder is" Get-ChildItem $startingPath -Recurse -Exclude "breadcrumb" | % { Write-Host $_.FullName } | Out-Null + + Write-Host "What we see when we GCI and exclude breadcrumb" Get-ChildItem -Directory -Exclude "breadcrumb" | % { Write-Host $_.FullName } | Out-Null + Write-Host "What we see when we GCI" + Get-ChildItem -Directory | % { Write-Host $_.FullName } | Out-Null + # There should only be one folder if (1 -ne $numDirs) { LogError "The assets directory ($startingPath) should only contain 1 subfolder not $numDirs ($folders -join $([Environment]::NewLine))" From cb3dd1e0215629a35d6031cbc131af939d93ee38 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 17:47:49 -0700 Subject: [PATCH 11/17] not outputting the proper stuff --- .../scripts/test-scripts/assets.Tests.Helpers.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index ee4f427f7c9..34d0da7e644 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -317,13 +317,13 @@ Function Get-AssetsFilePath { $folders = Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" Write-Host "What we see overall in the assets folder is" - Get-ChildItem $startingPath -Recurse -Exclude "breadcrumb" | % { Write-Host $_.FullName } | Out-Null + Get-ChildItem $startingPath -Recurse | % { Write-Host $_.FullName } | Out-Null Write-Host "What we see when we GCI and exclude breadcrumb" - Get-ChildItem -Directory -Exclude "breadcrumb" | % { Write-Host $_.FullName } | Out-Null + Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" | % { Write-Host $_.FullName } | Out-Null Write-Host "What we see when we GCI" - Get-ChildItem -Directory | % { Write-Host $_.FullName } | Out-Null + Get-ChildItem $startingPath -Directory | % { Write-Host $_.FullName } | Out-Null # There should only be one folder if (1 -ne $numDirs) { From 13ee43a7aae89c502a91f0a4d777478366f318a4 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 18:00:50 -0700 Subject: [PATCH 12/17] fix exclude possibly --- .../scripts/test-scripts/assets.Tests.Helpers.ps1 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index 34d0da7e644..fbc63654456 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -312,15 +312,14 @@ Function Get-AssetsFilePath { $startingPath = Join-Path -Path $assetsDir -ChildPath ".assets" } # It's odd that $folder.Count and $folders.Length work and we need to do this - $numDirs = Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" | Measure-Object | ForEach-Object{$_.Count} - - $folders = Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" + $numDirs = Get-ChildItem $startingPath -Directory -Exclude "*breadcrumb" | Measure-Object | ForEach-Object{$_.Count} + $folders = Get-ChildItem $startingPath -Directory -Exclude "*breadcrumb" Write-Host "What we see overall in the assets folder is" Get-ChildItem $startingPath -Recurse | % { Write-Host $_.FullName } | Out-Null Write-Host "What we see when we GCI and exclude breadcrumb" - Get-ChildItem $startingPath -Directory -Exclude "breadcrumb" | % { Write-Host $_.FullName } | Out-Null + Get-ChildItem $startingPath -Directory -Exclude "*breadcrumb" | % { Write-Host $_.FullName } | Out-Null Write-Host "What we see when we GCI" Get-ChildItem $startingPath -Directory | % { Write-Host $_.FullName } | Out-Null From 14bf2f639bbb30815241fcefd963735f7fa44b63 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 18:06:21 -0700 Subject: [PATCH 13/17] fix problem --- .../test-scripts/assets.Tests.Helpers.ps1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index fbc63654456..6d715e12bc9 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -312,17 +312,17 @@ Function Get-AssetsFilePath { $startingPath = Join-Path -Path $assetsDir -ChildPath ".assets" } # It's odd that $folder.Count and $folders.Length work and we need to do this - $numDirs = Get-ChildItem $startingPath -Directory -Exclude "*breadcrumb" | Measure-Object | ForEach-Object{$_.Count} - $folders = Get-ChildItem $startingPath -Directory -Exclude "*breadcrumb" + $numDirs = Get-ChildItem $startingPath -Directory | Where-Object { $_.Name != "breadcrumb" } | Measure-Object | ForEach-Object{$_.Count} + $folders = Get-ChildItem $startingPath -Directory | Where-Object { $_.Name != "breadcrumb" } - Write-Host "What we see overall in the assets folder is" - Get-ChildItem $startingPath -Recurse | % { Write-Host $_.FullName } | Out-Null + # Write-Host "What we see overall in the assets folder is" + # Get-ChildItem $startingPath -Recurse | % { Write-Host $_.FullName } | Out-Null - Write-Host "What we see when we GCI and exclude breadcrumb" - Get-ChildItem $startingPath -Directory -Exclude "*breadcrumb" | % { Write-Host $_.FullName } | Out-Null + # Write-Host "What we see when we GCI and exclude breadcrumb" + # Get-ChildItem $startingPath -Directory | Where-Object { $_.Name != "breadcrumb" } | % { Write-Host $_.FullName } | Out-Null - Write-Host "What we see when we GCI" - Get-ChildItem $startingPath -Directory | % { Write-Host $_.FullName } | Out-Null + # Write-Host "What we see when we GCI" + # Get-ChildItem $startingPath -Directory | Where-Object { $_.Name != "breadcrumb" } | % { Write-Host $_.FullName } | Out-Null # There should only be one folder if (1 -ne $numDirs) { From 9b654f428aaa136b7a7adb837020945a4dd4b07d Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 27 Jul 2023 18:09:15 -0700 Subject: [PATCH 14/17] != -> -ne --- .../test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index 6d715e12bc9..872691aad72 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -312,8 +312,8 @@ Function Get-AssetsFilePath { $startingPath = Join-Path -Path $assetsDir -ChildPath ".assets" } # It's odd that $folder.Count and $folders.Length work and we need to do this - $numDirs = Get-ChildItem $startingPath -Directory | Where-Object { $_.Name != "breadcrumb" } | Measure-Object | ForEach-Object{$_.Count} - $folders = Get-ChildItem $startingPath -Directory | Where-Object { $_.Name != "breadcrumb" } + $numDirs = Get-ChildItem $startingPath -Directory | Where-Object { $_.Name -ne "breadcrumb" } | Measure-Object | ForEach-Object{$_.Count} + $folders = Get-ChildItem $startingPath -Directory | Where-Object { $_.Name -ne "breadcrumb" } # Write-Host "What we see overall in the assets folder is" # Get-ChildItem $startingPath -Recurse | % { Write-Host $_.FullName } | Out-Null From a882445ecf1721109dcd0139b7d1917670dbc45b Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 28 Jul 2023 10:28:30 -0700 Subject: [PATCH 15/17] on the last failing test now --- .../scripts/test-scripts/CLIIntegration.Tests.ps1 | 5 ++--- .../scripts/test-scripts/assets.Tests.Helpers.ps1 | 9 --------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 b/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 index 58cfc6fffc2..37a884cf43b 100644 --- a/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 +++ b/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 @@ -482,7 +482,7 @@ Describe "AssetsModuleTests" { $LASTEXITCODE | Should -Be 0 $newlocalAssetsFilePath = Join-Path $newTestFolder ".assets" - $newAssetsFolder = $(Get-ChildItem $newlocalAssetsFilePath -Directory)[0].FullName + $newAssetsFolder = $(Get-ChildItem $newlocalAssetsFilePath -Directory | Where-Object { $_.Name -ne "breadcrumb" })[0].FullName mkdir -p $(Join-Path $newAssetsFolder $creationPath) # same file updates. we should have an identical sha! @@ -556,7 +556,7 @@ Describe "AssetsModuleTests" { Test-FileVersion -FilePath $assetsFolder -FileName $file3 -ExpectedVersion 3 } } - It "Should restore, make a change, then restore a different tag (same assets.json) and have pending changes properly discarded." { + It "Should restore, make a change, then restore a different tag (same assets.json) and have pending changes properly discarded." -Tag "Problematic" { if ($env:CLI_TEST_WITH_DOCKER) { Set-ItResult -Skipped } @@ -603,7 +603,6 @@ Describe "AssetsModuleTests" { Invoke-ProxyCommand -TestProxyExe $TestProxyExe -CommandArgs $CommandArgs -MountDirectory $testFolder $LASTEXITCODE | Should -Be 0 - Test-Path -Path (Join-Path $assetsFolder $file1) | Should -Be $false Test-Path -Path (Join-Path $assetsFolder $file2) | Should -Be $false Test-Path -Path (Join-Path $assetsFolder $file3) | Should -Be $false diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index 872691aad72..3e34f7d8039 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -315,15 +315,6 @@ Function Get-AssetsFilePath { $numDirs = Get-ChildItem $startingPath -Directory | Where-Object { $_.Name -ne "breadcrumb" } | Measure-Object | ForEach-Object{$_.Count} $folders = Get-ChildItem $startingPath -Directory | Where-Object { $_.Name -ne "breadcrumb" } - # Write-Host "What we see overall in the assets folder is" - # Get-ChildItem $startingPath -Recurse | % { Write-Host $_.FullName } | Out-Null - - # Write-Host "What we see when we GCI and exclude breadcrumb" - # Get-ChildItem $startingPath -Directory | Where-Object { $_.Name != "breadcrumb" } | % { Write-Host $_.FullName } | Out-Null - - # Write-Host "What we see when we GCI" - # Get-ChildItem $startingPath -Directory | Where-Object { $_.Name != "breadcrumb" } | % { Write-Host $_.FullName } | Out-Null - # There should only be one folder if (1 -ne $numDirs) { LogError "The assets directory ($startingPath) should only contain 1 subfolder not $numDirs ($folders -join $([Environment]::NewLine))" From 51e21bd61d3c97a09f56b8501a3f37ee5c5fc98c Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 28 Jul 2023 10:41:05 -0700 Subject: [PATCH 16/17] fix last test. re-enable the rest of the livetests --- .../test-scripts/CLIIntegration.Tests.ps1 | 4 +- tools/test-proxy/tests.yml | 430 +++++++++--------- 2 files changed, 217 insertions(+), 217 deletions(-) diff --git a/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 b/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 index 37a884cf43b..674b8af31ca 100644 --- a/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 +++ b/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 @@ -556,7 +556,7 @@ Describe "AssetsModuleTests" { Test-FileVersion -FilePath $assetsFolder -FileName $file3 -ExpectedVersion 3 } } - It "Should restore, make a change, then restore a different tag (same assets.json) and have pending changes properly discarded." -Tag "Problematic" { + It "Should restore, make a change, then restore a different tag (same assets.json) and have pending changes properly discarded." { if ($env:CLI_TEST_WITH_DOCKER) { Set-ItResult -Skipped } @@ -585,7 +585,7 @@ Describe "AssetsModuleTests" { Invoke-ProxyCommand -TestProxyExe $TestProxyExe -CommandArgs $CommandArgs -MountDirectory $testFolder $LASTEXITCODE | Should -Be 0 $localAssetsFilePath = Join-Path $testFolder ".assets" - $assetsFolder = $(Get-ChildItem $localAssetsFilePath -Directory)[0].FullName + $assetsFolder = $(Get-ChildItem $localAssetsFilePath -Directory | Where-Object { $_.Name -ne "breadcrumb")[0].FullName mkdir -p $(Join-Path $assetsFolder $creationPath) # Create new files. These are in a predictable location with predicatable content so we can be certain they are around diff --git a/tools/test-proxy/tests.yml b/tools/test-proxy/tests.yml index b59f0a40fee..dc9a4b3410d 100644 --- a/tools/test-proxy/tests.yml +++ b/tools/test-proxy/tests.yml @@ -7,43 +7,43 @@ stages: - stage: IntegrationTests displayName: "Asset Sync Integration Tests" jobs: - # - job: Solution_Integration_Test - - # strategy: - # matrix: - # Windows: - # Pool: 'azsdk-pool-mms-win-2022-general' - # OS: 'Windows' - # Linux: - # Pool: azsdk-pool-mms-ubuntu-2204-general - # OS: 'Linux' - # Mac: - # Pool: 'Azure Pipelines' - # OS: 'Mac' - - # pool: - # name: $(Pool) - - # steps: - # - template: /eng/pipelines/templates/steps/install-dotnet.yml - - # - script: 'dotnet test /p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory) --filter "Category=Integration" --logger trx $(Build.SourcesDirectory)/tools/test-proxy/' - # displayName: 'Test' - # env: - # DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - # DOTNET_CLI_TELEMETRY_OPTOUT: 1 - # DOTNET_MULTILEVEL_LOOKUP: 0 - # GIT_TOKEN: $(azuresdk-github-pat) - # GIT_COMMIT_OWNER: azure-sdk - # GIT_COMMIT_EMAIL: azuresdk@microsoft.com - - # - task: PublishTestResults@2 - # condition: succeededOrFailed() - # inputs: - # testResultsFiles: '**/*.trx' - # testRunTitle: '$(OS) AssetSync tests against .NET' - # testResultsFormat: 'VSTest' - # mergeTestResults: true + - job: Solution_Integration_Test + + strategy: + matrix: + Windows: + Pool: 'azsdk-pool-mms-win-2022-general' + OS: 'Windows' + Linux: + Pool: azsdk-pool-mms-ubuntu-2204-general + OS: 'Linux' + Mac: + Pool: 'Azure Pipelines' + OS: 'Mac' + + pool: + name: $(Pool) + + steps: + - template: /eng/pipelines/templates/steps/install-dotnet.yml + + - script: 'dotnet test /p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory) --filter "Category=Integration" --logger trx $(Build.SourcesDirectory)/tools/test-proxy/' + displayName: 'Test' + env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_MULTILEVEL_LOOKUP: 0 + GIT_TOKEN: $(azuresdk-github-pat) + GIT_COMMIT_OWNER: azure-sdk + GIT_COMMIT_EMAIL: azuresdk@microsoft.com + + - task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + testResultsFiles: '**/*.trx' + testRunTitle: '$(OS) AssetSync tests against .NET' + testResultsFormat: 'VSTest' + mergeTestResults: true - job: CLI_Integration_Test @@ -109,181 +109,181 @@ stages: CLI_TEST_DOCKER_TAG: $(CLI_TEST_DOCKER_TAG) DISABLE_INTEGRATION_BRANCH_CLEANUP: true - # - stage: RepoUnitTests - # displayName: Repo-Specific Unit Tests - # dependsOn: [] - # jobs: - # - job: Test_JS_Utils - - # displayName: Invoke JS Utils CI Tests - - # strategy: - # matrix: - # Windows: - # Pool: 'azsdk-pool-mms-win-2022-general' - # OS: 'Windows' - # Linux: - # Pool: azsdk-pool-mms-ubuntu-2204-general - # OS: 'Linux' - # Mac: - # Pool: 'Azure Pipelines' - # OS: 'Mac' - - # pool: - # name: $(Pool) - - # variables: - # REPO: "Azure/azure-sdk-for-js" - # CLONE_LOCATION: "$(Agent.BuildDirectory)/js_repo" - - # steps: - # - template: /eng/pipelines/templates/steps/install-dotnet.yml - - # - task: NodeTool@0 - # inputs: - # versionSpec: "16.x" - # displayName: "Use Node 16.x" - - # - pwsh: | - # git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 - # displayName: Clone Repo - - # - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml - # parameters: - # runProxy: true - # rootFolder: $(CLONE_LOCATION) - - # - pwsh: | - # npm install -g @microsoft/rush@5.48.0 - # rush update - # rush build -t . - # displayName: 'Install Rush, build and install proxy tests project' - # workingDirectory: $(CLONE_LOCATION)/sdk/test-utils/recorder - # env: - # PROXY_MANUAL_START: "true" - - # - pwsh: | - # rushx test:node - # displayName: 'Invoke Tests' - # workingDirectory: $(CLONE_LOCATION)/sdk/test-utils/recorder - # env: - # PROXY_MANUAL_START: "true" - - # - job: Test_Python_Tables - - # displayName: Run Python Tables CI Tests - - # strategy: - # matrix: - # Windows: - # Pool: 'azsdk-pool-mms-win-2022-general' - # OS: 'Windows' - # Linux: - # Pool: azsdk-pool-mms-ubuntu-2204-general - # OS: 'Linux' - # Mac: - # Pool: 'Azure Pipelines' - # OS: 'Mac' - - # pool: - # name: $(Pool) - - # variables: - # REPO: "Azure/azure-sdk-for-python" - # CLONE_LOCATION: "$(Agent.BuildDirectory)/python_repo" - - # steps: - # - template: /eng/pipelines/templates/steps/install-dotnet.yml - - # - template: /eng/pipelines/templates/steps/use-python-version.yml - # parameters: - # versionSpec: '3.9' - - # - pwsh: | - # git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 - # displayName: Clone Repo - - # - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml - # parameters: - # runProxy: true - # rootFolder: $(CLONE_LOCATION) - - # - pwsh: | - # python -m pip install -r dev_requirements.txt - # python -m pip install . - # displayName: 'Install requirements and package' - # workingDirectory: $(CLONE_LOCATION)/sdk/tables/azure-data-tables/ - - # - pwsh: | - # pytest . - # displayName: 'Invoke Tests' - # workingDirectory: $(CLONE_LOCATION)/sdk/tables/azure-data-tables/ - # env: - # PROXY_URL: "http://localhost:5000" - # PROXY_MANUAL_START: true - - # - job: Test_Java_Core - - # displayName: Run Java Core Local Tests - - # strategy: - # matrix: - # Windows: - # Pool: 'azsdk-pool-mms-win-2022-general' - # OS: 'Windows' - # Linux: - # Pool: azsdk-pool-mms-ubuntu-2204-general - # OS: 'Linux' - # Mac: - # Pool: 'Azure Pipelines' - # OS: 'Mac' - - # pool: - # name: $(Pool) - - # variables: - # REPO: "Azure/azure-sdk-for-java" - # CLONE_LOCATION: "$(Agent.BuildDirectory)/java_repo" - - # steps: - - # - template: /eng/pipelines/templates/steps/install-dotnet.yml - - # - template: /eng/pipelines/templates/steps/use-python-version.yml - # parameters: - # versionSpec: '3.9' - - # - pwsh: | - # git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 - # displayName: Clone Repo - - # - pwsh: | - # Write-Host "mvn install -f eng/code-quality-reports/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" - # mvn install -f eng/code-quality-reports/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true - # Write-Host "mvn install -f sdk/core/azure-json/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" - # mvn install -f sdk/core/azure-json/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true - # Write-Host "mvn install -f sdk/core/azure-core/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" - # mvn install -f sdk/core/azure-core/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true - # Write-Host "mvn install -f sdk/core/azure-core-test/pom.xml -DskipTests=true "-Dmaven.javadoc.skip=true" -DskipCheckStyle=true" - # mvn install -f sdk/core/azure-core-test/pom.xml -DskipTests=true "-Dmaven.javadoc.skip=true" -DskipCheckStyle=true - # displayName: 'Install azure-core-test' - # workingDirectory: $(CLONE_LOCATION) - - # # we want the proxy available so we can restore recordings and avoid the race condition error - # # however, we also want to not run it such that the local executable is used by the java tests. - # - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml - # parameters: - # runProxy: false - - # - pwsh: | - # Get-ChildItem -Recurse -Path $(CLONE_LOCATION)/sdk/ -Filter assets.json | ` - # ForEach-Object { test-proxy restore -a $_.FullName } - # displayName: Restore Recordings - - # - pwsh: | - # # To run java in 'local' mode, we need to ensure that the natively set CI variable $env:TF_BUILD - # # is not populated. Given it's auto-populated at step init by devops, we do it inline here. - # $env:TF_BUILD="" - # mvn surefire:test -f sdk/core/azure-core-test/pom.xml - # displayName: 'Invoke Tests' - # workingDirectory: $(CLONE_LOCATION) + - stage: RepoUnitTests + displayName: Repo-Specific Unit Tests + dependsOn: [] + jobs: + - job: Test_JS_Utils + + displayName: Invoke JS Utils CI Tests + + strategy: + matrix: + Windows: + Pool: 'azsdk-pool-mms-win-2022-general' + OS: 'Windows' + Linux: + Pool: azsdk-pool-mms-ubuntu-2204-general + OS: 'Linux' + Mac: + Pool: 'Azure Pipelines' + OS: 'Mac' + + pool: + name: $(Pool) + + variables: + REPO: "Azure/azure-sdk-for-js" + CLONE_LOCATION: "$(Agent.BuildDirectory)/js_repo" + + steps: + - template: /eng/pipelines/templates/steps/install-dotnet.yml + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + displayName: "Use Node 16.x" + + - pwsh: | + git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 + displayName: Clone Repo + + - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml + parameters: + runProxy: true + rootFolder: $(CLONE_LOCATION) + + - pwsh: | + npm install -g @microsoft/rush@5.48.0 + rush update + rush build -t . + displayName: 'Install Rush, build and install proxy tests project' + workingDirectory: $(CLONE_LOCATION)/sdk/test-utils/recorder + env: + PROXY_MANUAL_START: "true" + + - pwsh: | + rushx test:node + displayName: 'Invoke Tests' + workingDirectory: $(CLONE_LOCATION)/sdk/test-utils/recorder + env: + PROXY_MANUAL_START: "true" + + - job: Test_Python_Tables + + displayName: Run Python Tables CI Tests + + strategy: + matrix: + Windows: + Pool: 'azsdk-pool-mms-win-2022-general' + OS: 'Windows' + Linux: + Pool: azsdk-pool-mms-ubuntu-2204-general + OS: 'Linux' + Mac: + Pool: 'Azure Pipelines' + OS: 'Mac' + + pool: + name: $(Pool) + + variables: + REPO: "Azure/azure-sdk-for-python" + CLONE_LOCATION: "$(Agent.BuildDirectory)/python_repo" + + steps: + - template: /eng/pipelines/templates/steps/install-dotnet.yml + + - template: /eng/pipelines/templates/steps/use-python-version.yml + parameters: + versionSpec: '3.9' + + - pwsh: | + git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 + displayName: Clone Repo + + - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml + parameters: + runProxy: true + rootFolder: $(CLONE_LOCATION) + + - pwsh: | + python -m pip install -r dev_requirements.txt + python -m pip install . + displayName: 'Install requirements and package' + workingDirectory: $(CLONE_LOCATION)/sdk/tables/azure-data-tables/ + + - pwsh: | + pytest . + displayName: 'Invoke Tests' + workingDirectory: $(CLONE_LOCATION)/sdk/tables/azure-data-tables/ + env: + PROXY_URL: "http://localhost:5000" + PROXY_MANUAL_START: true + + - job: Test_Java_Core + + displayName: Run Java Core Local Tests + + strategy: + matrix: + Windows: + Pool: 'azsdk-pool-mms-win-2022-general' + OS: 'Windows' + Linux: + Pool: azsdk-pool-mms-ubuntu-2204-general + OS: 'Linux' + Mac: + Pool: 'Azure Pipelines' + OS: 'Mac' + + pool: + name: $(Pool) + + variables: + REPO: "Azure/azure-sdk-for-java" + CLONE_LOCATION: "$(Agent.BuildDirectory)/java_repo" + + steps: + + - template: /eng/pipelines/templates/steps/install-dotnet.yml + + - template: /eng/pipelines/templates/steps/use-python-version.yml + parameters: + versionSpec: '3.9' + + - pwsh: | + git clone https://github.com/$(REPO) $(CLONE_LOCATION) --depth 1 + displayName: Clone Repo + + - pwsh: | + Write-Host "mvn install -f eng/code-quality-reports/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" + mvn install -f eng/code-quality-reports/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true + Write-Host "mvn install -f sdk/core/azure-json/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" + mvn install -f sdk/core/azure-json/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true + Write-Host "mvn install -f sdk/core/azure-core/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true" + mvn install -f sdk/core/azure-core/pom.xml "-Dcodesnippet.skip" "-Drevapi.skip" "-Dspotbugs.skip" -DskipTests=true "-Djacoco.skip" "-Dmaven.javadoc.skip=true" -DskipTestCompile -DskipCheckStyle=true + Write-Host "mvn install -f sdk/core/azure-core-test/pom.xml -DskipTests=true "-Dmaven.javadoc.skip=true" -DskipCheckStyle=true" + mvn install -f sdk/core/azure-core-test/pom.xml -DskipTests=true "-Dmaven.javadoc.skip=true" -DskipCheckStyle=true + displayName: 'Install azure-core-test' + workingDirectory: $(CLONE_LOCATION) + + # we want the proxy available so we can restore recordings and avoid the race condition error + # however, we also want to not run it such that the local executable is used by the java tests. + - template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml + parameters: + runProxy: false + + - pwsh: | + Get-ChildItem -Recurse -Path $(CLONE_LOCATION)/sdk/ -Filter assets.json | ` + ForEach-Object { test-proxy restore -a $_.FullName } + displayName: Restore Recordings + + - pwsh: | + # To run java in 'local' mode, we need to ensure that the natively set CI variable $env:TF_BUILD + # is not populated. Given it's auto-populated at step init by devops, we do it inline here. + $env:TF_BUILD="" + mvn surefire:test -f sdk/core/azure-core-test/pom.xml + displayName: 'Invoke Tests' + workingDirectory: $(CLONE_LOCATION) From 8d76d311a0db2a691c465a28c68b3b997e010d10 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 28 Jul 2023 10:48:51 -0700 Subject: [PATCH 17/17] small formatting updates --- tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 | 2 +- tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 b/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 index 674b8af31ca..b8cff2a47ee 100644 --- a/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 +++ b/tools/test-proxy/scripts/test-scripts/CLIIntegration.Tests.ps1 @@ -585,7 +585,7 @@ Describe "AssetsModuleTests" { Invoke-ProxyCommand -TestProxyExe $TestProxyExe -CommandArgs $CommandArgs -MountDirectory $testFolder $LASTEXITCODE | Should -Be 0 $localAssetsFilePath = Join-Path $testFolder ".assets" - $assetsFolder = $(Get-ChildItem $localAssetsFilePath -Directory | Where-Object { $_.Name -ne "breadcrumb")[0].FullName + $assetsFolder = $(Get-ChildItem $localAssetsFilePath -Directory | Where-Object { $_.Name -ne "breadcrumb" })[0].FullName mkdir -p $(Join-Path $assetsFolder $creationPath) # Create new files. These are in a predictable location with predicatable content so we can be certain they are around diff --git a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 index 3e34f7d8039..306de629280 100644 --- a/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 +++ b/tools/test-proxy/scripts/test-scripts/assets.Tests.Helpers.ps1 @@ -312,7 +312,7 @@ Function Get-AssetsFilePath { $startingPath = Join-Path -Path $assetsDir -ChildPath ".assets" } # It's odd that $folder.Count and $folders.Length work and we need to do this - $numDirs = Get-ChildItem $startingPath -Directory | Where-Object { $_.Name -ne "breadcrumb" } | Measure-Object | ForEach-Object{$_.Count} + $numDirs = Get-ChildItem $startingPath -Directory | Where-Object { $_.Name -ne "breadcrumb" } | Measure-Object | ForEach-Object { $_.Count } $folders = Get-ChildItem $startingPath -Directory | Where-Object { $_.Name -ne "breadcrumb" } # There should only be one folder