Skip to content

Commit 71214ad

Browse files
azure-sdkscbedd
andauthored
Sync eng/common directory with azure-sdk-tools for PR 8158 (#39906)
* allow an override FILE to be honored by test-proxy-tool * update local test-framework to honor proxy override version by default --------- Co-authored-by: Scott Beddall (from Dev Box) <[email protected]>
1 parent 49743ea commit 71214ad

File tree

4 files changed

+21
-43
lines changed

4 files changed

+21
-43
lines changed

eng/common/testproxy/test-proxy-docker.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

eng/common/testproxy/test-proxy-tool.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,17 @@ steps:
2222
pwsh: true
2323

2424
- pwsh: |
25-
$version = $(Get-Content "${{ parameters.templateRoot }}/eng/common/testproxy/target_version.txt" -Raw).Trim()
25+
$standardVersion = "${{ parameters.templateRoot }}/eng/common/testproxy/target_version.txt"
26+
$overrideVersion = "${{ parameters.templateRoot }}/eng/target_proxy_version.txt"
27+
28+
$version = $(Get-Content $standardVersion -Raw).Trim()
29+
30+
if (Test-Path $overrideVersion) {
31+
$version = $(Get-Content $overrideVersion -Raw).Trim()
32+
}
33+
34+
Write-Host "Installing test-proxy version $version"
35+
2636
dotnet tool install azure.sdk.tools.testproxy `
2737
--tool-path $(Build.BinariesDirectory)/test-proxy `
2838
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json `

eng/target_proxy_version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0-dev.20240410.1

sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyUtils.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,17 @@ public static void checkForTestProxyErrors(HttpResponse httpResponse) {
238238
*/
239239
public static String getTestProxyVersion(Path testClassPath) {
240240
Path rootPath = TestUtils.getRepoRootResolveUntil(testClassPath, "eng");
241+
Path overrideVersionFile = Paths.get("eng", "target_proxy_version.txt");
241242
Path versionFile = Paths.get("eng", "common", "testproxy", "target_version.txt");
242-
rootPath = rootPath.resolve(versionFile);
243+
244+
// if a long-lived override exists, use it.
245+
if (Files.exists(rootPath.resolve(overrideVersionFile))) {
246+
versionFile = overrideVersionFile;
247+
}
248+
249+
Path versionFilePath = rootPath.resolve(versionFile);
243250
try {
244-
return Files.readAllLines(rootPath).get(0).replace(System.getProperty("line.separator"), "");
251+
return Files.readAllLines(versionFilePath).get(0).replace(System.getProperty("line.separator"), "");
245252
} catch (IOException e) {
246253
throw new UncheckedIOException(e);
247254
}

0 commit comments

Comments
 (0)