-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement per-service test setup (#1985)
* Implement per-service test setup * Removed one spurious .net reference
- Loading branch information
1 parent
6d1f558
commit 6d89f3a
Showing
9 changed files
with
208 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
# cspell: ignore JOBID | ||
|
||
. "$PSScriptRoot\..\..\..\eng\common\scripts\common.ps1" | ||
|
||
Write-Host "Test Broker output:" | ||
Receive-Job -Id $env:TEST_BROKER_JOBID | ||
|
||
# Check if the test broker job is still running | ||
$job = Get-Job -Id $env:TEST_BROKER_JOBID | ||
if ($job.State -ne "Running") { | ||
Write-Host "Test broker terminated unexpectedly." | ||
exit 1 | ||
} | ||
|
||
# Stop the test broker job started in Test-Setup.ps1 | ||
Write-Host "Stopping test broker" | ||
Stop-Job -Id $env:TEST_BROKER_JOBID | ||
Remove-Job -Id $env:TEST_BROKER_JOBID | ||
Write-Host "Test broker stopped." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
# cspell: ignore JOBID depsfile | ||
|
||
|
||
# Load common ES scripts | ||
. "$PSScriptRoot\..\..\..\eng\common\scripts\common.ps1" | ||
|
||
# Create the test binary *outside* the repo root to avoid polluting the repo. | ||
$WorkingDirectory = ([System.IO.Path]::Combine($RepoRoot, "../TestArtifacts")) | ||
|
||
# Create the working directory if it does not exist. | ||
Write-Host "Using Working Directory $WorkingDirectory" | ||
|
||
if (-not (Test-Path $WorkingDirectory)) { | ||
Write-Host "Working directory does not exist, creating working directory: $WorkingDirectory" | ||
New-Item -ItemType Directory -Path $WorkingDirectory | ||
} | ||
|
||
Write-Host "Setting current directory to working directory: $WorkingDirectory" | ||
Push-Location -Path $WorkingDirectory | ||
|
||
# Clone and build the Test Amqp Broker. | ||
try { | ||
|
||
$repositoryUrl = "https://github.com/Azure/azure-amqp.git" | ||
# We would like to use the "hotfix" branch because that is current, but unfortunately it references System.Net.Security version 4.0.0 | ||
$repositoryBranch = "master" | ||
$cloneCommand = "git clone $repositoryUrl --branch $repositoryBranch" | ||
|
||
Write-Host "Cloning repository from $repositoryUrl..." | ||
Invoke-LoggedCommand $cloneCommand | ||
|
||
Set-Location -Path "./azure-amqp/test/TestAmqpBroker" | ||
|
||
Invoke-LoggedCommand "dotnet build -p RollForward=LatestMajor --framework net6.0" | ||
if (!$? -ne 0) { | ||
Write-Error "Failed to build TestAmqpBroker." | ||
exit 1 | ||
} | ||
|
||
Write-Host "Test broker built successfully." | ||
|
||
# now that the Test broker has been built, launch the broker on a local address. | ||
$env:TEST_BROKER_ADDRESS = 'amqp://127.0.0.1:25672' | ||
|
||
Write-Host "Starting test broker listening on ${env:TEST_BROKER_ADDRESS} ..." | ||
|
||
Set-Location -Path $WorkingDirectory/azure-amqp/bin/Debug/TestAmqpBroker/net6.0 | ||
|
||
$job = dotnet exec ./TestAmqpBroker.dll ${env:TEST_BROKER_ADDRESS} /headless & | ||
|
||
$env:TEST_BROKER_JOBID = $job.Id | ||
|
||
Write-Host "Waiting for test broker to start..." | ||
Start-Sleep -Seconds 3 | ||
|
||
Write-Host "Job Output after wait:" | ||
Receive-Job $job.Id | ||
|
||
$job = Get-Job -Id $env:TEST_BROKER_JOBID | ||
if ($job.State -ne "Running") { | ||
Write-Host "Test broker failed to start." | ||
exit 1 | ||
} | ||
} | ||
finally { | ||
Pop-Location | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters