From 00a11d9201a85595127874bb068d538d1b387e62 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Wed, 31 May 2017 15:56:32 -0700 Subject: [PATCH] On Mac, when the httplistener is stopped, it takes time for the system to clean it up. It also appears that on Mac, http reservation (#3872) Use different HttpListener for Invoke-WebRequest and Invoke-RestMethod tests --- .../WebCmdlets.Tests.ps1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 index 978dce66d..d01c52a65 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 @@ -146,11 +146,11 @@ function GetTestData Describe "Invoke-WebRequest tests" -Tags "Feature" { BeforeAll { - $null = Start-HttpListener -AsJob + $null = Start-HttpListener -AsJob -Port 8080 } AfterAll { - $null = Stop-HttpListener + $null = Stop-HttpListener -Port 8080 } # Validate the output of Invoke-WebRequest @@ -576,11 +576,11 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" { Describe "Invoke-RestMethod tests" -Tags "Feature" { BeforeAll { - $null = Start-HttpListener -AsJob + $null = Start-HttpListener -AsJob -Port 8081 } AfterAll { - $null = Stop-HttpListener + $null = Stop-HttpListener -Port 8081 } It "Invoke-RestMethod returns User-Agent" { @@ -919,7 +919,7 @@ Describe "Invoke-RestMethod tests" -Tags "Feature" { It "Validate Invoke-RestMethod -FollowRelLink doesn't fail if no Link Header is present" { - $command = "Invoke-RestMethod -Uri 'http://localhost:8080/PowerShell?test=response&output=foo' -FollowRelLink" + $command = "Invoke-RestMethod -Uri 'http://localhost:8081/PowerShell?test=response&output=foo' -FollowRelLink" $result = ExecuteWebCommand -command $command $result.Output | Should BeExactly "foo" @@ -928,7 +928,7 @@ Describe "Invoke-RestMethod tests" -Tags "Feature" { It "Validate Invoke-RestMethod -FollowRelLink correctly follows all the available relation links" { $maxLinks = 5 - $command = "Invoke-RestMethod -Uri 'http://localhost:8080/PowerShell?test=linkheader&maxlinks=$maxlinks' -FollowRelLink" + $command = "Invoke-RestMethod -Uri 'http://localhost:8081/PowerShell?test=linkheader&maxlinks=$maxlinks' -FollowRelLink" $result = ExecuteWebCommand -command $command $result.Output.output.Count | Should BeExactly $maxLinks @@ -939,7 +939,7 @@ Describe "Invoke-RestMethod tests" -Tags "Feature" { $maxLinks = 10 $maxLinksToFollow = 6 - $command = "Invoke-RestMethod -Uri 'http://localhost:8080/PowerShell?test=linkheader&maxlinks=$maxlinks' -FollowRelLink -MaximumFollowRelLink $maxLinksToFollow" + $command = "Invoke-RestMethod -Uri 'http://localhost:8081/PowerShell?test=linkheader&maxlinks=$maxlinks' -FollowRelLink -MaximumFollowRelLink $maxLinksToFollow" $result = ExecuteWebCommand -command $command $result.Output.output.Count | Should BeExactly $maxLinksToFollow @@ -952,7 +952,7 @@ Describe "Invoke-RestMethod tests" -Tags "Feature" { @{ type = "noRel" } ) { param($type) - $command = "Invoke-RestMethod -Uri 'http://localhost:8080/PowerShell?test=linkheader&type=$type' -FollowRelLink" + $command = "Invoke-RestMethod -Uri 'http://localhost:8081/PowerShell?test=linkheader&type=$type' -FollowRelLink" $result = ExecuteWebCommand -command $command $result.Output.output | Should BeExactly 1 }