From 15aa35de7c8d4fa8d272eb9ac4e91c7db8fd60ba Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:36:41 -0500 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 5568 (#20290) * we encourage folks to place their assets.jsons at the package level * update generate-assets-json.ps1 to only include src/**/session-records so as to avoid picking up the duplicated 'target' sessionrecords --------- Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com> --- eng/common/testproxy/transition-scripts/README.md | 8 ++++---- .../testproxy/transition-scripts/generate-assets-json.ps1 | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eng/common/testproxy/transition-scripts/README.md b/eng/common/testproxy/transition-scripts/README.md index 862d22ed6de8..06290bd0c784 100644 --- a/eng/common/testproxy/transition-scripts/README.md +++ b/eng/common/testproxy/transition-scripts/README.md @@ -60,12 +60,12 @@ You will not be able to clean them up however. There exists [planned work](https - `language` repo - An individual language repository eg. azure-sdk-for-python or azure-sdk-for-net etc. - `assets` repo - The repository where assets are being moved to. -The `test-proxy` tool is integrated with the ability to automatically restore these assets. This process is kick-started by the presence of an `assets.json` alongside a dev's actual code. This means that while assets will be cloned down externally, the _map_ to those assets will be stored alongside the tests. Normally, it is recommended to create an `assets.json` under the path `sdk/`. However, more granular storage is also possible. +The `test-proxy` tool is integrated with the ability to automatically restore these assets. This process is kick-started by the presence of an `assets.json` alongside a dev's actual code. This means that while assets will be cloned down externally, the _map_ to those assets will be stored alongside the tests. Normally, it is recommended to create an `assets.json` under the path `sdk//`. More granular storage than on an individual package level is possible, but each language's test framework would need to support that on a case-by-case basis. -Service/Package-Level examples: +Examples of current assets.json locations: -- `sdk/storage/assets.json` -- `sdk/storage/azure-storage-file-datalake/assets.json` +- [`sdk/data/aztables/assets.json`](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/data/aztables/assets.json) +- [`sdk/keyvault/azure-keyvault-keys/assets.json`](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/keyvault/azure-keyvault-keys/assets.json) The location of the actual test code is referred to as the `language repo`. diff --git a/eng/common/testproxy/transition-scripts/generate-assets-json.ps1 b/eng/common/testproxy/transition-scripts/generate-assets-json.ps1 index 2b24bdcb1ab8..3f43c7d3adff 100644 --- a/eng/common/testproxy/transition-scripts/generate-assets-json.ps1 +++ b/eng/common/testproxy/transition-scripts/generate-assets-json.ps1 @@ -72,7 +72,7 @@ if ($UseTestRepo) { # 3. ios $LangRecordingDirs = @{"cpp" = "recordings"; "go" = "recordings"; - "java" = "session-records"; + "java" = "src.*?session-records"; "js" = "recordings"; "net" = "SessionRecords"; "python" = "recordings"; @@ -321,8 +321,8 @@ Function Move-AssetsFromLangRepo { ) $filter = $LangRecordingDirs[$language] Write-Host "Language recording directory name=$filter" - Write-Host "Get-ChildItem -Recurse -Filter ""*.json"" | Where-Object { `$_.DirectoryName.Split([IO.Path]::DirectorySeparatorChar) -contains ""$filter"" }" - $filesToMove = Get-ChildItem -Recurse -Filter "*.json" | Where-Object { $_.DirectoryName.Split([IO.Path]::DirectorySeparatorChar) -contains "$filter" } + Write-Host "Get-ChildItem -Recurse -Filter ""*.json"" | Where-Object { if ($filter.Contains(""*"")) { $_.DirectoryName -match $filter } else { $_.DirectoryName.Split([IO.Path]::DirectorySeparatorChar) -contains ""$filter"" }" + $filesToMove = Get-ChildItem -Recurse -Filter "*.json" | Where-Object { if ($filter.Contains("*")) { $_.DirectoryName -match $filter } else { $_.DirectoryName.Split([IO.Path]::DirectorySeparatorChar) -contains "$filter" } } [string] $currentDir = Get-Location foreach ($fromFile in $filesToMove) {