Fixes for running tests on Raspbian (#11661)

This commit is contained in:
James Truher [MSFT] 2020-01-30 14:41:03 -08:00 committed by GitHub
parent f0fe356553
commit 476a2d1dac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View file

@ -64,11 +64,16 @@ Describe "Test-Connection" -tags "CI" {
{ $result = Test-Connection "fakeHost" -Count 1 -Quiet -ErrorAction Stop } |
Should -Throw -ErrorId "TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand"
# Error code = 11001 - Host not found.
if (!$IsWindows) {
$error[0].Exception.InnerException.ErrorCode | Should -Be -131073
} else {
$error[0].Exception.InnerException.ErrorCode | Should -Be 11001
if ((Get-PlatformInfo) -match "raspbian") {
$code = 11
}
elseif (!$IsWindows) {
$code = -131073
}
else {
$code = 11001
}
$error[0].Exception.InnerException.ErrorCode | Should -Be $code
}
# In VSTS, address is 0.0.0.0
@ -262,7 +267,7 @@ Describe "Test-Connection" -tags "CI" {
}
It "Quiet works" {
$result = Test-Connection $hostName -TraceRoute -Quiet
$result = Test-Connection localhost -TraceRoute -Quiet
$result | Should -BeTrue
}

View file

@ -7,7 +7,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
}
BeforeAll {
$IsAlpine = (Get-PlatformInfo) -eq "alpine"
$SkipAdditionalPlatforms = (Get-PlatformInfo) -match "alpine|raspbian"
Import-Module PSDesiredStateConfiguration
$dscModule = Get-Module PSDesiredStateConfiguration
$baseSchemaPath = Join-Path $dscModule.ModuleBase 'Configuration'
@ -21,7 +21,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
$env:PSModulePath = join-path ([io.path]::GetDirectoryName($powershellexe)) Modules
}
It "Should be able to compile a MOF from a basic configuration" -Skip:($IsMacOS -or $IsWindows -or $IsAlpine) {
It "Should be able to compile a MOF from a basic configuration" -Skip:($IsMacOS -or $IsWindows -or $SkipAdditionalPlatforms) {
[Scriptblock]::Create(@"
configuration DSCTestConfig
{
@ -40,7 +40,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
"TestDrive:\DscTestConfig1\localhost.mof" | Should -Exist
}
It "Should be able to compile a MOF from another basic configuration" -Skip:($IsMacOS -or $IsWindows -or $IsAlpine) {
It "Should be able to compile a MOF from another basic configuration" -Skip:($IsMacOS -or $IsWindows -or $SkipAdditionalPlatforms) {
[Scriptblock]::Create(@"
configuration DSCTestConfig
{
@ -62,7 +62,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
"TestDrive:\DscTestConfig2\localhost.mof" | Should -Exist
}
It "Should be able to compile a MOF from a complex configuration" -Skip:($IsMacOS -or $IsWindows -or $IsAlpine) {
It "Should be able to compile a MOF from a complex configuration" -Skip:($IsMacOS -or $IsWindows -or $SkipAdditionalPlatforms) {
[Scriptblock]::Create(@"
Configuration WordPressServer{
@ -171,7 +171,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
"TestDrive:\DscTestConfig3\CentOS.mof" | Should -Exist
}
It "Should be able to compile a MOF from a basic configuration on Windows" -Skip:($IsMacOS -or $IsLinux -or $IsAlpine) {
It "Should be able to compile a MOF from a basic configuration on Windows" -Skip:($IsMacOS -or $IsLinux -or $SkipAdditionalPlatforms) {
[Scriptblock]::Create(@"
configuration DSCTestConfig
{
@ -191,7 +191,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
"TestDrive:\DscTestConfig4\localhost.mof" | Should -Exist
}
It "Should be able to compile a MOF from a configuration with multiple resources on Windows" -Skip:($IsMacOS -or $IsLinux -or $IsAlpine) {
It "Should be able to compile a MOF from a configuration with multiple resources on Windows" -Skip:($IsMacOS -or $IsLinux -or $SkipAdditionalPlatforms) {
[Scriptblock]::Create(@"
configuration DSCTestConfig
{