Skip to content

Commit

Permalink
reset e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmrdavid committed Oct 1, 2024
1 parent d1a3bca commit 72428b9
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions test/SmokeTests/e2e-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Exit-OnError() {
}

$ErrorActionPreference = "Stop"
$AzuriteVersion = "3.32.0"
$AzuriteVersion = "3.26.0"

if ($NoSetup -eq $false) {
# Build the docker image first, since that's the most critical step
Expand All @@ -35,15 +35,14 @@ if ($NoSetup -eq $false) {
Exit-OnError

# Next, download and start the Azurite emulator Docker image
Write-Host "Pulling down the mcr.microsoft.com/azure-storage/azurite image..." -ForegroundColor Yellow
docker pull "mcr.microsoft.com/azure-storage/azurite"
Write-Host "Pulling down the mcr.microsoft.com/azure-storage/azurite:$AzuriteVersion image..." -ForegroundColor Yellow
docker pull "mcr.microsoft.com/azure-storage/azurite:${AzuriteVersion}"
Exit-OnError

Write-Host "Starting Azurite storage emulator using default ports..." -ForegroundColor Yellow
docker run --name 'azurite' -p 10000:10000 -p 10001:10001 -p 10002:10002 -d "mcr.microsoft.com/azure-storage/azurite"
docker run --name 'azurite' -p 10000:10000 -p 10001:10001 -p 10002:10002 -d "mcr.microsoft.com/azure-storage/azurite:${AzuriteVersion}"
Exit-OnError
# Author's note: we don't call 'Exit-OnError' here because this container may already be running


if ($SetupSQLServer -eq $true) {
Write-Host "Pulling down the mcr.microsoft.com/mssql/server:$tag image..."
docker pull mcr.microsoft.com/mssql/server:$tag
Expand All @@ -52,7 +51,7 @@ if ($NoSetup -eq $false) {
# Start the SQL Server docker container with the specified edition
Write-Host "Starting SQL Server $tag $sqlpid docker container on port $port" -ForegroundColor DarkYellow
docker run --name mssql-server -e 'ACCEPT_EULA=Y' -e "MSSQL_SA_PASSWORD=$pw" -e "MSSQL_PID=$sqlpid" -p ${port}:1433 -d mcr.microsoft.com/mssql/server:$tag
# Author's note: we don't call 'Exit-OnError' here because this container may already be running
Exit-OnError

# Wait for SQL Server to be ready
Write-Host "Waiting for SQL Server to be ready..." -ForegroundColor Yellow
Expand All @@ -66,7 +65,7 @@ if ($NoSetup -eq $false) {

# Create the database with strict binary collation
Write-Host "Creating '$dbname' database with '$collation' collation" -ForegroundColor DarkYellow
docker exec -d mssql-server /opt/mssql-tools18/bin/sqlcmd -S . -U sa -P "$pw" -Q "CREATE DATABASE [$dbname] COLLATE $collation"
docker exec -d mssql-server /opt/mssql-tools/bin/sqlcmd -S . -U sa -P "$pw" -Q "CREATE DATABASE [$dbname] COLLATE $collation"
Exit-OnError

# Wait for database to be ready
Expand All @@ -81,7 +80,7 @@ if ($NoSetup -eq $false) {
--env 'AzureWebJobsStorage=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://host.docker.internal' `
--env 'WEBSITE_HOSTNAME=localhost:8080' `
$ImageName
# Author's note: we don't call 'Exit-OnError' here because this container may already be running
Exit-OnError
}
else {
Write-Host "Starting $ContainerName application container" -ForegroundColor Yellow
Expand All @@ -90,7 +89,7 @@ if ($NoSetup -eq $false) {
--env 'WEBSITE_HOSTNAME=localhost:8080' `
$ImageName
}
# Author's note: we don't call 'Exit-OnError' here because this container may already be running
Exit-OnError
}

if ($sleep -gt 0) {
Expand All @@ -108,7 +107,6 @@ try {
$pingUrl = "http://localhost:8080/admin/host/ping"
Write-Host "Pinging app at $pingUrl to ensure the host is healthy" -ForegroundColor Yellow
Invoke-RestMethod -Method Post -Uri "http://localhost:8080/admin/host/ping"
Write-Host "Host is healthy!" -ForegroundColor Green
Exit-OnError

if ($NoValidation -eq $false) {
Expand All @@ -131,7 +129,6 @@ try {

if ($result.runtimeStatus -eq "Completed") {
$success = $true
Write-Host $result
break
}

Expand Down

0 comments on commit 72428b9

Please sign in to comment.