azure-sdk-for-cpp/eng/scripts/Start-TestProxy.ps1
George Arama 3762c59552
Test proxy start (#4295)
* lll

* sss

* oipio

* vcvc

* enable test proxy start at test suite start for KV and storage , example created for attestation, we cannot find the base definitions for the test suites,

* Contrib

* clangs

* clangs

* test logs

* pipeline

* more clangs

* pipeline

* clang

* try try again

* try try again

* try again

* try again

* again

* update paths , moved to macro , call macro in target code

* core

* capitalization
2023-02-07 10:52:20 -08:00

43 lines
1.3 KiB
PowerShell

# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT
param(
[Parameter(Mandatory=$True)]
[string] $AssetsPath
)
# check is there is another test-proxy running
$running = Get-Process -Name test-proxy
echo $AssetsPath
if($running)
{
echo "test-proxy running, no need for new instance"
exit 0
}
# make sure errors collection is empty
$error.clear()
#check if we have a test-proxy available
$CurrentVersion = (Get-Command -Name "test-proxy" -ErrorAction SilentlyContinue).Version
if($error){
echo "Will install testproxy"
dotnet tool update azure.sdk.tools.testproxy --global --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json --version "1.0.0-dev*"
# clear the errors again
$error.clear()
#check again for test proxy presence
$CurrentVersion = (Get-Command -Name "test-proxy" -ErrorAction SilentlyContinue).Version
# if we have errors this means we had issues installing it , needs to be done by hand
if($error){
echo "Unable to install testproxy. Try installing manually."
exit 1
}
}
echo "Start test proxy with argument list -l $AssetsPath"
#starts it in a separate process that will outlive pwsh in order to serve requests.
Start-Process 'test-proxy' -ArgumentList "start -l $AssetsPath" -WorkingDirectory $AssetsPath