-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated testsettings and loadtest files folder not to use the source #4041
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,7 +127,7 @@ function ComposeAccountUrl($connectedServiceUrl, $headers) | |
#Load all dependent files for execution | ||
. $PSScriptRoot/VssConnectionHelper.ps1 | ||
$connectedServiceUrl = $connectedServiceUrl.TrimEnd('/') | ||
Write-Host "Getting Clt Endpoint:" | ||
Write-Host -NoNewline "Getting Clt Endpoint:" | ||
$elsUrl = Get-CltEndpoint $connectedServiceUrl $headers | ||
|
||
return $elsUrl | ||
|
@@ -149,34 +149,74 @@ function isNumericValue ($str) { | |
return $isNum | ||
} | ||
|
||
function ValidateFiles($inputName, $fileName) | ||
function ValidateFiles($inputName, $loadtestDrop, $fileName, $testSettings) | ||
{ | ||
$file = Get-ChildItem -Path $TestDrop -recurse | where {$_.Name -eq $fileName} | Select -First 1 | ||
if ($file) | ||
# Upgrade scenario start.. | ||
if (-Not([System.IO.Path]::IsPathRooted($loadtestDrop))) | ||
{ | ||
# Check for fileName | ||
$global:ScopedTestDrop = $file.Directory.FullName | ||
Write-Host -NoNewline ("Selected {0} is '{1}' under '{2}'" -f $inputName, $file.FullName, $global:ScopedTestDrop) | ||
$loadtestDrop=[System.IO.Path]::Combine($env:SYSTEM_DEFAULTWORKINGDIRECTORY,$loadtestDrop); | ||
Write-Host -NoNewline "Updated test drop location is $loadtestDrop"; | ||
|
||
if (-Not([string]::IsNullOrWhiteSpace($testSettings)) -and | ||
-Not([System.IO.Path]::IsPathRooted($testSettings))) | ||
{ | ||
$testSettings=[System.IO.Path]::Combine($env:SYSTEM_DEFAULTWORKINGDIRECTORY,$testSettings); | ||
Write-Host -NoNewline "Updated test settings file is $testSettings"; | ||
} | ||
} | ||
else | ||
# Upgrade scenario end.. | ||
|
||
# Validate if the drop folder location is correct... | ||
if (-Not (Test-Path $loadtestDrop)) | ||
{ | ||
ErrorMessage "No $inputName is present in the test drop." | ||
ErrorMessage "The path for the load test files $loadtestDrop does not exist. Please provide a valid path." | ||
} | ||
} | ||
|
||
function ValidateInputs($tfsCollectionUrl, $connectedServiceName, $testSettings, $testDrop, $loadtest) | ||
{ | ||
if (-Not (Test-Path $testSettings)) | ||
$loadRunTestSettingsFile = $testSettings; | ||
$file = Get-ChildItem -Path $loadtestDrop -recurse | Where-Object {$_.Name -eq $fileName} | Select-Object -First 1 | ||
if ($file) | ||
{ | ||
ErrorMessage "The path for the test settings file does not exist. Please provide a valid path." | ||
} | ||
# Check for fileName | ||
$global:ScopedTestDrop = $file.Directory.FullName; | ||
$global:RunTestSettingsFile = ""; | ||
Write-Host -NoNewline ("Selected load test file is '{0}' under '{1}'" -f $file.FullName, $global:ScopedTestDrop) | ||
Write-Host -NoNewline "Test Drop location used for the run is $global:ScopedTestDrop. Please ensure all required files (test dlls, plugin dlls, dependent files) are part of this output folder" | ||
if ([string]::IsNullOrWhiteSpace($loadRunTestSettingsFile)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
minor: you dont need to string check just doing if() would suffice. #WontFix |
||
{ | ||
Write-Host -NoNewline "No test settings file specified"; | ||
return; | ||
} | ||
|
||
if (-Not (Test-Path $loadRunTestSettingsFile)) | ||
{ | ||
Write-Host -NoNewline "The path for the test settings file $loadRunTestSettingsFile does not exist" | ||
if (-Not([System.IO.Path]::IsPathRooted($loadRunTestSettingsFile))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
if comment #1 is resolved, you will not need this. #WontFix |
||
{ | ||
$loadRunTestSettingsFile = [System.IO.Path]::Combine($global:ScopedTestDrop, [System.IO.Path]::GetFileName($loadRunTestSettingsFile)); | ||
Write-Host -NoNewline "Checking for test settings file $loadRunTestSettingsFile in the drop location" | ||
} | ||
|
||
if (Test-Path $loadRunTestSettingsFile) | ||
{ | ||
Write-Host -NoNewline "Test settings file $loadRunTestSettingsFile found in the drop location" | ||
} | ||
else | ||
{ | ||
ErrorMessage "TestSettings file $loadRunTestSettingsFile not found" | ||
} | ||
} | ||
|
||
if (-Not (Test-Path $testDrop)) | ||
$global:RunTestSettingsFile = $loadRunTestSettingsFile; | ||
} | ||
else | ||
{ | ||
ErrorMessage "The path for the load test files does not exist. Please provide a valid path." | ||
ErrorMessage "LoadTest file $inputName is not present in the test drop." | ||
} | ||
} | ||
|
||
ValidateFiles "load test file" $loadTest | ||
function ValidateInputs($tfsCollectionUrl, $connectedServiceName, $testSettings, $loadtestDrop, $loadtest) | ||
{ | ||
ValidateFiles "load test file" $loadtestDrop $loadTest $testSettings | ||
} | ||
|
||
function Get($headers, $uri) | ||
|
@@ -226,7 +266,7 @@ function StopTestRun($headers, $run, $CltAccountUrl) | |
{ | ||
$stop = @" | ||
{ | ||
"state": "aborted" | ||
"state": "aborted" | ||
} | ||
"@ | ||
$uri = [String]::Format("{0}/_apis/clt/testruns/{1}?{2}", $CltAccountUrl, $run.id, $global:apiVersion) | ||
|
@@ -238,22 +278,30 @@ function StopTestRun($headers, $run, $CltAccountUrl) | |
|
||
function ComposeTestRunJson($name, $tdid, $machineType) | ||
{ | ||
$processPlatform = "x86" | ||
$processPlatform = "x64" | ||
$setupScript="" | ||
$cleanupScript="" | ||
|
||
[xml]$tsxml = Get-Content $TestSettings | ||
if ($tsxml.TestSettings.Scripts.setupScript) | ||
{ | ||
$setupScript = [System.IO.Path]::GetFileName($tsxml.TestSettings.Scripts.setupScript) | ||
} | ||
if ($tsxml.TestSettings.Scripts.cleanupScript) | ||
if (-Not([string]::IsNullOrWhiteSpace($global:RunTestSettingsFile))) | ||
{ | ||
$cleanupScript = [System.IO.Path]::GetFileName($tsxml.TestSettings.Scripts.cleanupScript) | ||
} | ||
if ($tsxml.TestSettings.Execution.hostProcessPlatform) | ||
{ | ||
$processPlatform = $tsxml.TestSettings.Execution.hostProcessPlatform | ||
[xml]$tsxml = Get-Content $global:RunTestSettingsFile | ||
if ($tsxml.TestSettings.Scripts.setupScript) | ||
{ | ||
$setupScript = [System.IO.Path]::GetFileName($tsxml.TestSettings.Scripts.setupScript) | ||
Write-Host -NoNewline "RunSettings SetupScript : $setupScript" | ||
} | ||
|
||
if ($tsxml.TestSettings.Scripts.cleanupScript) | ||
{ | ||
$cleanupScript = [System.IO.Path]::GetFileName($tsxml.TestSettings.Scripts.cleanupScript) | ||
Write-Host -NoNewline "RunSettings CleanupScript : $cleanupScript" | ||
} | ||
|
||
if ($tsxml.TestSettings.Execution.hostProcessPlatform) | ||
{ | ||
$processPlatform = $tsxml.TestSettings.Execution.hostProcessPlatform | ||
Write-Host -NoNewline "RunSettings ProcessPlatform : $cleanupScript" | ||
} | ||
} | ||
|
||
$trjson = @" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment#1 -
this doesnt seem to be related/dependent on the outer if block. it can come out and stay along with the test settings section. #WontFix