From 6d482df07601531148d36b0c80616b1f58a4e05d Mon Sep 17 00:00:00 2001 From: Mark Kraus Date: Fri, 6 Oct 2017 08:03:03 -0500 Subject: [PATCH 1/3] Fix Delay Test Race Condition --- .../Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 index 4de4ed1f8730..5941802c0565 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 @@ -551,7 +551,7 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" { It "Validate Invoke-WebRequest error with -Proxy option set - ''" -TestCases $testCase { param($proxy_address, $name, $protocol) - $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '5' -Https:$($protocol -eq 'https') + $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '6' -Https:$($protocol -eq 'https') $command = "Invoke-WebRequest -Uri '$uri' -TimeoutSec 5 -Proxy '${proxy_address}' -SkipCertificateCheck" $result = ExecuteWebCommand -command $command @@ -564,7 +564,7 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" { # Configure the environment variable. New-Item -Name ${name} -Value ${proxy_address} -ItemType Variable -Path Env: -Force - $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '5' -Https:$($protocol -eq 'https') + $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '6' -Https:$($protocol -eq 'https') $command = "Invoke-WebRequest -Uri '$uri' -TimeoutSec 5 -SkipCertificateCheck" $result = ExecuteWebCommand -command $command @@ -1400,7 +1400,7 @@ Describe "Invoke-RestMethod tests" -Tags "Feature" { # Configure the environment variable. New-Item -Name ${name} -Value ${proxy_address} -ItemType Variable -Path Env: -Force - $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '5' -Https:$($protocol -eq 'https') + $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '6' -Https:$($protocol -eq 'https') $command = "Invoke-RestMethod -Uri '$uri' -TimeoutSec 5 -SkipCertificateCheck" $result = ExecuteWebCommand -command $command From d10e13c8b344094bc061dacc34b97fbcb754649d Mon Sep 17 00:00:00 2001 From: Mark Kraus Date: Fri, 6 Oct 2017 08:06:42 -0500 Subject: [PATCH 2/3] [Feature] Run Feature tests Re-run count: I From 60ed7d6cb23f867c154da43c71740ef389ee0459 Mon Sep 17 00:00:00 2001 From: Mark Kraus Date: Fri, 6 Oct 2017 11:00:53 -0500 Subject: [PATCH 3/3] [Feature] Address PR Feedback --- .../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 5941802c0565..6c99995868cd 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 @@ -527,8 +527,8 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" { It "Invoke-WebRequest validate timeout option" { - $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '6' - $command = "Invoke-WebRequest -Uri '$uri' -TimeoutSec 5" + $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '5' + $command = "Invoke-WebRequest -Uri '$uri' -TimeoutSec 2" $result = ExecuteWebCommand -command $command $result.Error.FullyQualifiedErrorId | Should Be "System.Threading.Tasks.TaskCanceledException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand" @@ -551,8 +551,8 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" { It "Validate Invoke-WebRequest error with -Proxy option set - ''" -TestCases $testCase { param($proxy_address, $name, $protocol) - $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '6' -Https:$($protocol -eq 'https') - $command = "Invoke-WebRequest -Uri '$uri' -TimeoutSec 5 -Proxy '${proxy_address}' -SkipCertificateCheck" + $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '5' -Https:$($protocol -eq 'https') + $command = "Invoke-WebRequest -Uri '$uri' -TimeoutSec 2 -Proxy '${proxy_address}' -SkipCertificateCheck" $result = ExecuteWebCommand -command $command $result.Error.FullyQualifiedErrorId | Should Be "System.Threading.Tasks.TaskCanceledException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand" @@ -564,8 +564,8 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" { # Configure the environment variable. New-Item -Name ${name} -Value ${proxy_address} -ItemType Variable -Path Env: -Force - $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '6' -Https:$($protocol -eq 'https') - $command = "Invoke-WebRequest -Uri '$uri' -TimeoutSec 5 -SkipCertificateCheck" + $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '5' -Https:$($protocol -eq 'https') + $command = "Invoke-WebRequest -Uri '$uri' -TimeoutSec 2 -SkipCertificateCheck" $result = ExecuteWebCommand -command $command $result.Error.FullyQualifiedErrorId | Should Be "System.Threading.Tasks.TaskCanceledException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand" @@ -1400,8 +1400,8 @@ Describe "Invoke-RestMethod tests" -Tags "Feature" { # Configure the environment variable. New-Item -Name ${name} -Value ${proxy_address} -ItemType Variable -Path Env: -Force - $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '6' -Https:$($protocol -eq 'https') - $command = "Invoke-RestMethod -Uri '$uri' -TimeoutSec 5 -SkipCertificateCheck" + $uri = Get-WebListenerUrl -Test 'Delay' -TestValue '5' -Https:$($protocol -eq 'https') + $command = "Invoke-RestMethod -Uri '$uri' -TimeoutSec 2 -SkipCertificateCheck" $result = ExecuteWebCommand -command $command $result.Error.FullyQualifiedErrorId | Should Be "System.Threading.Tasks.TaskCanceledException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand"