Remove dotnet dependency to start WebListener (#8390)

WebListener.exe (which was already being built) is sufficient to start web listener. Remove the dependency on `dotnet` being present to start the web listener.

Use `Start-Process` instead of `Start-Job` to launch the WebListener.
This commit is contained in:
Aditya Patwardhan
2018-12-11 14:15:32 -08:00
committed by Travis Plunk
parent ac2b453ba7
commit ee5fc080e2
3 changed files with 22 additions and 21 deletions
@@ -257,19 +257,20 @@ Describe "Test-Connection" -tags "CI" {
$result | Should -BeTrue
}
}
}
Context "Connection" {
BeforeAll {
# Ensure the local host listen on port 80
$WebListener = Start-WebListener
}
Describe "Connection" -Tag "CI", "RequireAdminOnWindows" {
BeforeAll {
# Ensure the local host listen on port 80
$WebListener = Start-WebListener
$UnreachableAddress = "10.11.12.13"
}
It "Test connection to local host port 80" {
Test-Connection '127.0.0.1' -TCPPort $WebListener.HttpPort | Should -BeTrue
}
It "Test connection to local host port 80" {
Test-Connection '127.0.0.1' -TCPPort $WebListener.HttpPort | Should -BeTrue
}
It "Test connection to unreachable host port 80" {
Test-Connection $UnreachableAddress -TCPPort 80 -TimeOut 1 | Should -BeFalse
}
It "Test connection to unreachable host port 80" {
Test-Connection $UnreachableAddress -TCPPort 80 -TimeOut 1 | Should -BeFalse
}
}
@@ -367,7 +367,7 @@ $redirectTests = @(
@{redirectType = 'relative'; redirectedMethod = 'GET'}
)
Describe "Invoke-WebRequest tests" -Tags "Feature" {
Describe "Invoke-WebRequest tests" -Tags "Feature", "RequireAdminOnWindows" {
BeforeAll {
$WebListener = Start-WebListener
}
@@ -1785,7 +1785,7 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" {
}
}
Describe "Invoke-RestMethod tests" -Tags "Feature" {
Describe "Invoke-RestMethod tests" -Tags "Feature", "RequireAdminOnWindows" {
BeforeAll {
$WebListener = Start-WebListener
}
@@ -3069,7 +3069,7 @@ Describe "Invoke-RestMethod tests" -Tags "Feature" {
}
}
Describe "Validate Invoke-WebRequest and Invoke-RestMethod -InFile" -Tags "Feature" {
Describe "Validate Invoke-WebRequest and Invoke-RestMethod -InFile" -Tags "Feature", "RequireAdminOnWindows" {
BeforeAll {
$WebListener = Start-WebListener
}
@@ -3149,7 +3149,7 @@ Describe "Validate Invoke-WebRequest and Invoke-RestMethod -InFile" -Tags "Featu
}
}
Describe "Web cmdlets tests using the cmdlet's aliases" -Tags "CI" {
Describe "Web cmdlets tests using the cmdlet's aliases" -Tags "CI", "RequireAdminOnWindows" {
BeforeAll {
$WebListener = Start-WebListener
}
@@ -120,7 +120,7 @@ function Start-WebListener
}
$initTimeoutSeconds = 15
$appDll = 'WebListener.dll'
$appExe = (get-command WebListener).Path
$serverPfx = 'ServerCert.pfx'
$serverPfxPassword = New-RandomHexString
$clientPfx = 'ClientCert.pfx'
@@ -136,7 +136,7 @@ function Start-WebListener
$Job = Start-Job {
$path = Split-Path -parent (get-command WebListener).Path -Verbose
Push-Location $path -Verbose
'appDLL: {0}' -f $using:appDll
'appEXE: {0}' -f $using:appExe
'serverPfxPath: {0}' -f $using:serverPfxPath
'serverPfxPassword: {0}' -f $using:serverPfxPassword
'HttpPort: {0}' -f $using:HttpPort
@@ -144,14 +144,15 @@ function Start-WebListener
'Tls11Port: {0}' -f $using:Tls11Port
'TlsPort: {0}' -f $using:TlsPort
$env:ASPNETCORE_ENVIRONMENT = 'Development'
dotnet $using:appDll $using:serverPfxPath $using:serverPfxPassword $using:HttpPort $using:HttpsPort $using:Tls11Port $using:TlsPort
& $using:appExe $using:serverPfxPath $using:serverPfxPassword $using:HttpPort $using:HttpsPort $using:Tls11Port $using:TlsPort
}
$Script:WebListener = [WebListener]@{
HttpPort = $HttpPort
HttpsPort = $HttpsPort
Tls11Port = $Tls11Port
TlsPort = $TlsPort
Job = $Job
Job = $Job
}
# Count iterations of $sleepMilliseconds instead of using system time to work around possible CI VM sleep/delays
@@ -172,8 +173,7 @@ function Start-WebListener
$jobVerbose = $Job.ChildJobs[0].Verbose | Out-String
$Job | Stop-Job
$Job | Remove-Job -Force
$message = 'WebListener did not start before the timeout was reached.{0}Errors:{0}{1}{0}Output:{0}{2}{0}Verbose:{0}{3}' -f
([System.Environment]::NewLine), $jobErrors, $jobOutput, $jobVerbose
$message = 'WebListener did not start before the timeout was reached.{0}Errors:{0}{1}{0}Output:{0}{2}{0}Verbose:{0}{3}' -f ([System.Environment]::NewLine), $jobErrors, $jobOutput, $jobVerbose
throw $message
}
return $Script:WebListener