Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upTest changes needed for running in a container #7869
Conversation
JamesWTruher
assigned
adityapatwardhan
Sep 26, 2018
JamesWTruher
requested review from
TravisEz13 and
adityapatwardhan
Sep 26, 2018
adityapatwardhan
requested changes
Sep 26, 2018
| @@ -19,8 +19,13 @@ Describe "Test-Connection" -tags "CI" { | |||
| # $targetAddressIPv6 = "::1" | |||
| $targetAddressIPv6 = [System.Net.Dns]::GetHostEntry($targetName).AddressList[0].IPAddressToString | |||
| $UnreachableAddress = "10.11.12.13" | |||
| $realName = "google-public-dns-a.google.com" | |||
| $realAddress = [System.Net.Dns]::GetHostEntry($realName).AddressList[0].IPAddressToString | |||
| # this resolves to an actual IP raher than 127.0.0.1 | |||
This comment has been minimized.
This comment has been minimized.
| # this resolves to an actual IP raher than 127.0.0.1 | ||
| # this can also include both IPv4 and IPv6, so select InterNetwork rather than InternNetworkV6 | ||
| $realAddress = [System.Net.Dns]::GetHostEntry($hostName).AddressList | | ||
| ?{$_.AddressFamily -eq "InterNetwork"} | |
This comment has been minimized.
This comment has been minimized.
| $realName = "google-public-dns-a.google.com" | ||
| $realAddress = [System.Net.Dns]::GetHostEntry($realName).AddressList[0].IPAddressToString | ||
| # this resolves to an actual IP raher than 127.0.0.1 | ||
| # this can also include both IPv4 and IPv6, so select InterNetwork rather than InternNetworkV6 |
This comment has been minimized.
This comment has been minimized.
| $realAddress = [System.Net.Dns]::GetHostEntry($hostName).AddressList | | ||
| ?{$_.AddressFamily -eq "InterNetwork"} | | ||
| Select-Object -First 1 | | ||
| %{ $_.IPAddressToString } |
This comment has been minimized.
This comment has been minimized.
|
|
||
| $result2 = Test-Connection $realName -Count 1 -IPv4 -MaxHops 1 -DontFragment | ||
| # explicitly go to google dns. this test will pass even in the destination is unreachable |
This comment has been minimized.
This comment has been minimized.
| @@ -198,17 +205,17 @@ Describe "Test-Connection" -tags "CI" { | |||
| # TODO: We skip the MTUSizeDetect tests on Unix because we expect 'TtlExpired' but get 'TimeOut' internally from .Net Core | |||
| # Skipping on VSTS in Windows due to `TimedOut` | |||
| Context "MTUSizeDetect" { | |||
| It "MTUSizeDetect works" -Pending:(!$isWindows -or (Test-IsVstsWindows)) { | |||
| $result = Test-Connection $realName -MTUSizeDetect | |||
| It "MTUSizeDetect works" -Pending:(!$isWindows) { | |||
This comment has been minimized.
This comment has been minimized.
adityapatwardhan
Sep 26, 2018
Member
Can you double check if this still needs to be maked as Pending. It worked on my Ubuntu 18.04 VM.
This comment has been minimized.
This comment has been minimized.
JamesWTruher
Sep 27, 2018
Author
Member
it's definitely failing on my mac, I'll mark it pending for $IsMacOS
| $result.Status | Should -BeExactly "Success" | ||
| $result.MTUSize | Should -BeGreaterThan 0 | ||
| } | ||
|
|
||
| It "Quiet works" -Pending:(!$isWindows -or (Test-IsVstsWindows)) { | ||
| $result = Test-Connection $realName -MTUSizeDetect -Quiet | ||
| It "Quiet works" -Pending:(!$isWindows) { |
This comment has been minimized.
This comment has been minimized.
| @@ -237,15 +245,15 @@ Describe "Test-Connection" -tags "CI" { | |||
| $pingReplies[0].Address | Should -BeExactly $realAddress | |||
| $pingReplies[0].Status | Should -BeExactly "Success" | |||
| if (!$isWindows) { | |||
| $pingReplies[0].Buffer.Count | Should -Be 0 | |||
| $pingReplies[0].Buffer.Count | Should -Match '^0$|^32$' | |||
| } else { | |||
| $pingReplies[0].Buffer.Count | Should -Be 32 | |||
| } | |||
| } | |||
|
|
|||
| # Hangs in VSTS Linux | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -48,7 +48,8 @@ Describe 'Online help tests for PowerShell Core Cmdlets' -Tags "CI" { | |||
| Describe 'Get-Help -Online opens the default web browser and navigates to the cmdlet help content' -Tags "Feature" { | |||
|
|
|||
| $skipTest = [System.Management.Automation.Platform]::IsIoT -or | |||
| [System.Management.Automation.Platform]::IsNanoServer | |||
| [System.Management.Automation.Platform]::IsNanoServer -or | |||
| $env:__InContainer -eq 1 | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
SteveL-MSFT
Sep 27, 2018
Member
The code to open help in a browser is pretty simple. Perhaps rather than skipping these tests in non-desktop environments, we should instead have a test hook to validate that it hit the right code path or even start a test executable passed the URL as an argument?
This comment has been minimized.
This comment has been minimized.
JamesWTruher
Sep 27, 2018
Author
Member
there is a test hook here already, and it is used to validate all the uris. This is a single test which starts the browser.
This comment has been minimized.
This comment has been minimized.
adityapatwardhan
requested changes
Sep 27, 2018
| @@ -48,7 +48,8 @@ Describe 'Online help tests for PowerShell Core Cmdlets' -Tags "CI" { | |||
| Describe 'Get-Help -Online opens the default web browser and navigates to the cmdlet help content' -Tags "Feature" { | |||
|
|
|||
| $skipTest = [System.Management.Automation.Platform]::IsIoT -or | |||
| [System.Management.Automation.Platform]::IsNanoServer | |||
| [System.Management.Automation.Platform]::IsNanoServer -or | |||
| $env:__InContainer -eq 1 | |||
This comment has been minimized.
This comment has been minimized.
| @@ -237,15 +245,15 @@ Describe "Test-Connection" -tags "CI" { | |||
| $pingReplies[0].Address | Should -BeExactly $realAddress | |||
| $pingReplies[0].Status | Should -BeExactly "Success" | |||
| if (!$isWindows) { | |||
| $pingReplies[0].Buffer.Count | Should -Be 0 | |||
| $pingReplies[0].Buffer.Count | Should -Match '^0$|^32$' | |||
| } else { | |||
| $pingReplies[0].Buffer.Count | Should -Be 32 | |||
| } | |||
| } | |||
|
|
|||
| # Hangs in VSTS Linux | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@JamesWTruher Please also have a look at the test failure in CI for Linux and MacOS. Also please push a commit with |
JamesWTruher
force-pushed the
JamesWTruher:containertestfixes
branch
Sep 27, 2018
This comment has been minimized.
This comment has been minimized.
|
@JamesWTruher Test-Connection test is failing on Linux and macOS with Also please push a commit with |
SteveL-MSFT
requested changes
Sep 27, 2018
| @@ -48,7 +48,8 @@ Describe 'Online help tests for PowerShell Core Cmdlets' -Tags "CI" { | |||
| Describe 'Get-Help -Online opens the default web browser and navigates to the cmdlet help content' -Tags "Feature" { | |||
|
|
|||
| $skipTest = [System.Management.Automation.Platform]::IsIoT -or | |||
| [System.Management.Automation.Platform]::IsNanoServer | |||
| [System.Management.Automation.Platform]::IsNanoServer -or | |||
| $env:__InContainer -eq 1 | |||
This comment has been minimized.
This comment has been minimized.
SteveL-MSFT
Sep 27, 2018
Member
The code to open help in a browser is pretty simple. Perhaps rather than skipping these tests in non-desktop environments, we should instead have a test hook to validate that it hit the right code path or even start a test executable passed the URL as an argument?
JamesWTruher
force-pushed the
JamesWTruher:containertestfixes
branch
Sep 27, 2018
This comment has been minimized.
This comment has been minimized.
|
@SteveL-MSFT please see my comment above re: starting a browser |
JamesWTruher commentedSep 26, 2018
•
edited
PR Summary
These are changes which will enable our tests to be run within containers for the 9 different Linux platforms that we provide. In order to successfully run in a container an environment variable
__InContainermust be present to avoid running the help test which starts a browser. The best place to define this variable is in the Dockerfile, ala:ENV __InContainer 1Additionally, these tests may be executed against the already installed PowerShell.
This is the first step in completely automating our tests against packaged (rather than built) PowerShell.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests