Fix tests to work as expected under Linux (#3474)
- Removed the -TimeoutSec option and modified the expected Error to be consistent across platforms. - Changed the port of the phony proxy to 9 which is reserved for the Discard Protocol. So even if the system is listening, it's supposed to discard that TCP request (UDP may use it for Wake-on-Lan, but doesn't affect this).
This commit is contained in:
parent
f76b2fcbaf
commit
42f2e3ca82
1 changed files with 6 additions and 6 deletions
|
@ -258,8 +258,8 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" {
|
||||||
}
|
}
|
||||||
|
|
||||||
$testCase = @(
|
$testCase = @(
|
||||||
@{ proxy_address = "http://localhost:8080"; name = 'http_proxy'; protocol = 'http' }
|
@{ proxy_address = "http://localhost:9"; name = 'http_proxy'; protocol = 'http' }
|
||||||
@{ proxy_address = "http://localhost:8080"; name = 'https_proxy'; protocol = 'https' }
|
@{ proxy_address = "http://localhost:9"; name = 'https_proxy'; protocol = 'https' }
|
||||||
)
|
)
|
||||||
|
|
||||||
It "Validate Invoke-WebRequest error with -Proxy option set - '<name>'" -TestCases $testCase {
|
It "Validate Invoke-WebRequest error with -Proxy option set - '<name>'" -TestCases $testCase {
|
||||||
|
@ -629,17 +629,17 @@ Describe "Invoke-RestMethod tests" -Tags "Feature" {
|
||||||
}
|
}
|
||||||
|
|
||||||
$testCase = @(
|
$testCase = @(
|
||||||
@{ proxy_address = "http://localhost:8080"; name = 'http_proxy'; protocol = 'http' }
|
@{ proxy_address = "http://localhost:9"; name = 'http_proxy'; protocol = 'http' }
|
||||||
@{ proxy_address = "http://localhost:8080"; name = 'https_proxy'; protocol = 'https' }
|
@{ proxy_address = "http://localhost:9"; name = 'https_proxy'; protocol = 'https' }
|
||||||
)
|
)
|
||||||
|
|
||||||
It "Validate Invoke-RestMethod error with -Proxy option - '<name>'" -TestCases $testCase {
|
It "Validate Invoke-RestMethod error with -Proxy option - '<name>'" -TestCases $testCase {
|
||||||
param($proxy_address, $name, $protocol)
|
param($proxy_address, $name, $protocol)
|
||||||
|
|
||||||
$command = "Invoke-RestMethod -Uri '${protocol}://httpbin.org/' -Proxy '${proxy_address}' -TimeoutSec 2"
|
$command = "Invoke-RestMethod -Uri '${protocol}://httpbin.org/' -Proxy '${proxy_address}'"
|
||||||
|
|
||||||
$result = ExecuteWebCommand -command $command
|
$result = ExecuteWebCommand -command $command
|
||||||
$result.Error.FullyQualifiedErrorId | Should Be "System.Threading.Tasks.TaskCanceledException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand"
|
$result.Error.FullyQualifiedErrorId | Should Be "WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand"
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Validate Invoke-RestMethod error with environment proxy set - '<name>'" -TestCases $testCase {
|
It "Validate Invoke-RestMethod error with environment proxy set - '<name>'" -TestCases $testCase {
|
||||||
|
|
Loading…
Reference in a new issue