Alpine validation changes (#10428)
This commit is contained in:
parent
8b9f4124ce
commit
3943f18c28
|
@ -1006,7 +1006,13 @@ function Start-PSPester {
|
|||
Write-Verbose "Running pester tests at '$path' with tag '$($Tag -join ''', ''')' and ExcludeTag '$($ExcludeTag -join ''', ''')'" -Verbose
|
||||
if(!$SkipTestToolBuild.IsPresent)
|
||||
{
|
||||
Publish-PSTestTools | ForEach-Object {Write-Host $_}
|
||||
$publishArgs = @{ }
|
||||
# if we are building for Alpine, we must include the runtime as linux-x64
|
||||
# will not build runnable test tools
|
||||
if ( $Environment.IsAlpine ) {
|
||||
$publishArgs['runtime'] = 'alpine-x64'
|
||||
}
|
||||
Publish-PSTestTools @publishArgs | ForEach-Object {Write-Host $_}
|
||||
}
|
||||
|
||||
# All concatenated commands/arguments are suffixed with the delimiter (space)
|
||||
|
|
|
@ -103,6 +103,11 @@ Describe "Validate start of console host" -Tag CI {
|
|||
}
|
||||
|
||||
It "No new assemblies are loaded" {
|
||||
if ( (Get-PlatformInfo) -eq "alpine" ) {
|
||||
Set-ItResult -Pending -Because "Missing MI library causes list to be different"
|
||||
return
|
||||
}
|
||||
|
||||
$diffs = Compare-Object -ReferenceObject $allowedAssemblies -DifferenceObject $loadedAssemblies
|
||||
|
||||
if ($null -ne $diffs) {
|
||||
|
|
|
@ -108,7 +108,12 @@ Describe "Test-Connection" -tags "CI" {
|
|||
# After .Net Core fix we should have 'DontFragment | Should -Be $true' here.
|
||||
$result1.Replies[0].Options.Ttl | Should -BeLessOrEqual 128
|
||||
if (!$isWindows) {
|
||||
$result1.Replies[0].Options.DontFragment | Should -BeNullOrEmpty
|
||||
if ( (Get-PlatformInfo) -eq "alpine" ) {
|
||||
$result1.Replies[0].Options.DontFragment | Should -Be $true
|
||||
}
|
||||
else {
|
||||
$result1.Replies[0].Options.DontFragment | Should -BeNullOrEmpty
|
||||
}
|
||||
# depending on the network configuration any of the following should be returned
|
||||
$result2.Replies[0].Status | Should -BeIn "TtlExpired","TimedOut","Success"
|
||||
} else {
|
||||
|
|
|
@ -29,7 +29,12 @@ Describe "Get-Date DRT Unit Tests" -Tags "CI" {
|
|||
|
||||
$seconds | Should -Be "1577836800"
|
||||
if ($isLinux) {
|
||||
$seconds | Should -Be (date --date='01/01/2020 UTC' +%s)
|
||||
$dateString = "01/01/2020 UTC"
|
||||
if ( (Get-PlatformInfo) -eq "alpine" ) {
|
||||
$dateString = "2020-01-01"
|
||||
}
|
||||
$expected = date --date=${dateString} +%s
|
||||
$seconds | Should -Be $expected
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ Describe "DSC MOF Compilation" -tags "CI" {
|
|||
}
|
||||
|
||||
BeforeAll {
|
||||
$IsAlpine = (Get-PlatformInfo) -eq "alpine"
|
||||
Import-Module PSDesiredStateConfiguration
|
||||
$dscModule = Get-Module PSDesiredStateConfiguration
|
||||
$baseSchemaPath = Join-Path $dscModule.ModuleBase 'Configuration'
|
||||
|
@ -20,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) {
|
||||
It "Should be able to compile a MOF from a basic configuration" -Skip:($IsMacOS -or $IsWindows -or $IsAlpine) {
|
||||
[Scriptblock]::Create(@"
|
||||
configuration DSCTestConfig
|
||||
{
|
||||
|
@ -39,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) {
|
||||
It "Should be able to compile a MOF from another basic configuration" -Skip:($IsMacOS -or $IsWindows -or $IsAlpine) {
|
||||
[Scriptblock]::Create(@"
|
||||
configuration DSCTestConfig
|
||||
{
|
||||
|
@ -61,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) {
|
||||
It "Should be able to compile a MOF from a complex configuration" -Skip:($IsMacOS -or $IsWindows -or $IsAlpine) {
|
||||
[Scriptblock]::Create(@"
|
||||
Configuration WordPressServer{
|
||||
|
||||
|
@ -170,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) {
|
||||
It "Should be able to compile a MOF from a basic configuration on Windows" -Skip:($IsMacOS -or $IsLinux -or $IsAlpine) {
|
||||
[Scriptblock]::Create(@"
|
||||
configuration DSCTestConfig
|
||||
{
|
||||
|
@ -190,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) {
|
||||
It "Should be able to compile a MOF from a configuration with multiple resources on Windows" -Skip:($IsMacOS -or $IsLinux -or $IsAlpine) {
|
||||
[Scriptblock]::Create(@"
|
||||
configuration DSCTestConfig
|
||||
{
|
||||
|
|
|
@ -73,6 +73,11 @@ Describe "SkipCACheck and SkipCNCheck PSSession options are required for New-PSS
|
|||
It "<Name>" -TestCases $testCases {
|
||||
param ($scriptBlock, $expectedErrorCode)
|
||||
|
||||
if ( (Get-PlatformInfo) -eq "alpine" ) {
|
||||
Set-ItResult -Pending -Because "MI library not available for Alpine"
|
||||
return
|
||||
}
|
||||
|
||||
$er = { & $scriptBlock } | Should -Throw -ErrorId 'System.Management.Automation.Remoting.PSRemotingDataStructureException,Microsoft.PowerShell.Commands.NewPSSessionCommand' -PassThru
|
||||
$er.Exception.ErrorCode | Should -Be $expectedErrorCode
|
||||
}
|
||||
|
|
|
@ -5,6 +5,11 @@ Import-Module HelpersCommon
|
|||
|
||||
Describe "New-PSSession basic test" -Tag @("CI") {
|
||||
It "New-PSSession should not crash powershell" {
|
||||
if ( (Get-PlatformInfo) -eq "alpine" ) {
|
||||
Set-ItResult -Pending -Because "MI library not available for Alpine"
|
||||
return
|
||||
}
|
||||
|
||||
{ New-PSSession -ComputerName nonexistcomputer -Authentication Basic } |
|
||||
Should -Throw -ErrorId "InvalidOperation,Microsoft.PowerShell.Commands.NewPSSessionCommand"
|
||||
}
|
||||
|
@ -12,6 +17,11 @@ Describe "New-PSSession basic test" -Tag @("CI") {
|
|||
|
||||
Describe "Basic Auth over HTTP not allowed on Unix" -Tag @("CI") {
|
||||
It "New-PSSession should throw when specifying Basic Auth over HTTP on Unix" -skip:($IsWindows) {
|
||||
if ( (Get-PlatformInfo) -eq "alpine" ) {
|
||||
Set-ItResult -Pending -Because "MI library not available for Alpine"
|
||||
return
|
||||
}
|
||||
|
||||
$password = ConvertTo-SecureString -String "password" -AsPlainText -Force
|
||||
$credential = [PSCredential]::new('username', $password)
|
||||
|
||||
|
@ -23,6 +33,11 @@ Describe "Basic Auth over HTTP not allowed on Unix" -Tag @("CI") {
|
|||
}
|
||||
|
||||
It "New-PSSession should NOT throw a ConnectFailed exception when specifying Basic Auth over HTTPS on Unix" -skip:($IsWindows) {
|
||||
if ( (Get-PlatformInfo) -eq "alpine" ) {
|
||||
Set-ItResult -Pending -Because "MI library not available for Alpine"
|
||||
return
|
||||
}
|
||||
|
||||
$password = ConvertTo-SecureString -String "password" -AsPlainText -Force
|
||||
$credential = [PSCredential]::new('username', $password)
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ FunctionsToExport = @(
|
|||
'Test-TesthookIsSet'
|
||||
'Wait-FileToBePresent'
|
||||
'Wait-UntilTrue'
|
||||
'Get-PlatformInfo'
|
||||
)
|
||||
|
||||
CmdletsToExport= @()
|
||||
|
|
|
@ -363,3 +363,21 @@ function New-ComplexPassword
|
|||
|
||||
$password
|
||||
}
|
||||
|
||||
# return a specific string with regard to platform information
|
||||
function Get-PlatformInfo
|
||||
{
|
||||
if ( $IsWindows ) {
|
||||
return "windows"
|
||||
}
|
||||
if ( $IsMacOS ) {
|
||||
return "macos"
|
||||
}
|
||||
if ( $IsLinux ) {
|
||||
$osrelease = Get-Content /etc/os-release | ConvertFrom-StringData
|
||||
if ( -not [string]::IsNullOrEmpty($osrelease.ID) ) {
|
||||
return $osrelease.ID
|
||||
}
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue