Fixes for running tests on Raspbian (#11661)
This commit is contained in:
parent
f0fe356553
commit
476a2d1dac
|
@ -64,11 +64,16 @@ Describe "Test-Connection" -tags "CI" {
|
||||||
{ $result = Test-Connection "fakeHost" -Count 1 -Quiet -ErrorAction Stop } |
|
{ $result = Test-Connection "fakeHost" -Count 1 -Quiet -ErrorAction Stop } |
|
||||||
Should -Throw -ErrorId "TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand"
|
Should -Throw -ErrorId "TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand"
|
||||||
# Error code = 11001 - Host not found.
|
# Error code = 11001 - Host not found.
|
||||||
if (!$IsWindows) {
|
if ((Get-PlatformInfo) -match "raspbian") {
|
||||||
$error[0].Exception.InnerException.ErrorCode | Should -Be -131073
|
$code = 11
|
||||||
} else {
|
|
||||||
$error[0].Exception.InnerException.ErrorCode | Should -Be 11001
|
|
||||||
}
|
}
|
||||||
|
elseif (!$IsWindows) {
|
||||||
|
$code = -131073
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$code = 11001
|
||||||
|
}
|
||||||
|
$error[0].Exception.InnerException.ErrorCode | Should -Be $code
|
||||||
}
|
}
|
||||||
|
|
||||||
# In VSTS, address is 0.0.0.0
|
# In VSTS, address is 0.0.0.0
|
||||||
|
@ -262,7 +267,7 @@ Describe "Test-Connection" -tags "CI" {
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Quiet works" {
|
It "Quiet works" {
|
||||||
$result = Test-Connection $hostName -TraceRoute -Quiet
|
$result = Test-Connection localhost -TraceRoute -Quiet
|
||||||
|
|
||||||
$result | Should -BeTrue
|
$result | Should -BeTrue
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
|
||||||
}
|
}
|
||||||
|
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
$IsAlpine = (Get-PlatformInfo) -eq "alpine"
|
$SkipAdditionalPlatforms = (Get-PlatformInfo) -match "alpine|raspbian"
|
||||||
Import-Module PSDesiredStateConfiguration
|
Import-Module PSDesiredStateConfiguration
|
||||||
$dscModule = Get-Module PSDesiredStateConfiguration
|
$dscModule = Get-Module PSDesiredStateConfiguration
|
||||||
$baseSchemaPath = Join-Path $dscModule.ModuleBase 'Configuration'
|
$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
|
$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(@"
|
[Scriptblock]::Create(@"
|
||||||
configuration DSCTestConfig
|
configuration DSCTestConfig
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
|
||||||
"TestDrive:\DscTestConfig1\localhost.mof" | Should -Exist
|
"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(@"
|
[Scriptblock]::Create(@"
|
||||||
configuration DSCTestConfig
|
configuration DSCTestConfig
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
|
||||||
"TestDrive:\DscTestConfig2\localhost.mof" | Should -Exist
|
"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(@"
|
[Scriptblock]::Create(@"
|
||||||
Configuration WordPressServer{
|
Configuration WordPressServer{
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
|
||||||
"TestDrive:\DscTestConfig3\CentOS.mof" | Should -Exist
|
"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(@"
|
[Scriptblock]::Create(@"
|
||||||
configuration DSCTestConfig
|
configuration DSCTestConfig
|
||||||
{
|
{
|
||||||
|
@ -191,7 +191,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
|
||||||
"TestDrive:\DscTestConfig4\localhost.mof" | Should -Exist
|
"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(@"
|
[Scriptblock]::Create(@"
|
||||||
configuration DSCTestConfig
|
configuration DSCTestConfig
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue