From 13330aacae390c343dd5709cd78911f5106ca167 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 7 Apr 2022 10:29:44 -0700 Subject: [PATCH] Wait for test proxy startup (#3532) Co-authored-by: Ben Broderick Phillips --- eng/common/testproxy/test-proxy-tool.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/eng/common/testproxy/test-proxy-tool.yml b/eng/common/testproxy/test-proxy-tool.yml index 9006c0d7a..7b5fedaae 100644 --- a/eng/common/testproxy/test-proxy-tool.yml +++ b/eng/common/testproxy/test-proxy-tool.yml @@ -11,7 +11,7 @@ steps: - pwsh: | $version = $(Get-Content "$(Build.SourcesDirectory)/eng/common/testproxy/target_version.txt" -Raw).Trim() $overrideVersion = "${{ parameters.targetVersion }}" - + if($overrideVersion) { Write-Host "Overriding default target proxy version of '$version' with override $overrideVersion." $version = $overrideVersion @@ -47,3 +47,18 @@ steps: displayName: "Run the testproxy - linux/mac" condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT')) workingDirectory: "${{ parameters.rootFolder }}" + + - pwsh: | + for ($i = 0; $i -lt 10; $i++) { + try { + Invoke-WebRequest -Uri "http://localhost:5000/Admin/IsAlive" | Out-Null + exit 0 + } catch { + Write-Warning "Failed to successfully connect to test proxy. Retrying..." + Start-Sleep 6 + } + } + Write-Error "Could not connect to test proxy." + exit 1 + displayName: Test Proxy IsAlive +