tests: fix function to test for docker OS due to change to use linuxkit for mac (#5843)

* Also, fix syntax issues to allow to work with released Pester
This commit is contained in:
Travis Plunk 2018-01-10 16:37:51 -08:00 committed by GitHub
parent bb6823d707
commit 05ed03154d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 5 deletions

View file

@ -57,8 +57,7 @@ Describe "Linux Containers run PowerShell" -Tags 'Behavior', 'Linux' {
# prune unused volumes
$null=Invoke-Docker -Command 'volume', 'prune' -Params '--force' -SuppressHostOutput
}
BeforeEach
{
BeforeEach {
Remove-Item $testContext.resolvedXmlPath -ErrorAction SilentlyContinue
Remove-Item $testContext.resolvedLogPath -ErrorAction SilentlyContinue
}
@ -82,8 +81,7 @@ Describe "Windows Containers run PowerShell" -Tags 'Behavior', 'Windows' {
BeforeAll{
$testContext = Get-TestContext -type Windows
}
BeforeEach
{
BeforeEach {
Remove-Item $testContext.resolvedXmlPath -ErrorAction SilentlyContinue
Remove-Item $testContext.resolvedLogPath -ErrorAction SilentlyContinue
}

View file

@ -110,7 +110,27 @@ function Test-SkipWindows
function Test-SkipLinux
{
return !((Get-DockerEngineOs) -like 'Alpine Linux*')
$os = Get-DockerEngineOs
switch -wildcard ($os)
{
'*Linux*' {
return $false
}
'*Mac' {
return $false
}
# Docker for Windows means we are running the linux kernel
'Docker for Windows' {
return $false
}
'Windows*' {
return $true
}
default {
throw "Unknow docker os '$os'"
}
}
}
function Get-TestContext