Skip to content

Commit b116f19

Browse files
Add tests
1 parent 95108c7 commit b116f19

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

tests/container.tests.ps1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,21 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' {
240240
$gssNtlmSspPath = Get-LinuxGssNtlmSsp -Name $Name
241241
$gssNtlmSspPath | Should -Not -BeNullOrEmpty
242242
}
243+
244+
it "Has POWERSHELL_DISTRIBUTION_CHANNEL environment variable defined" -TestCases $runTestCases -Skip:$script:skipLinuxRun {
245+
param(
246+
[Parameter(Mandatory=$true)]
247+
[string]
248+
$name,
249+
250+
[Parameter(Mandatory=$true)]
251+
[string]
252+
$ExpectedVersion
253+
)
254+
255+
$psDistChannel = Get-PowerShellDistibutionChannel -TestContext $testContext -Name $Name
256+
$psDistChannel | Should -BeLike "PSDocker-*"
257+
}
243258
}
244259

245260
Context "Labels" {
@@ -591,6 +606,21 @@ Describe "Windows Containers" -Tags 'Behavior', 'Windows' {
591606

592607
$path | should -Match ([System.Text.RegularExpressions.Regex]::Escape("C:\Windows\system32"))
593608
}
609+
610+
it "Has POWERSHELL_DISTRIBUTION_CHANNEL environment variable defined" -TestCases $runTestCases -Skip:$script:skipLinuxRun {
611+
param(
612+
[Parameter(Mandatory=$true)]
613+
[string]
614+
$name,
615+
616+
[Parameter(Mandatory=$true)]
617+
[string]
618+
$ExpectedVersion
619+
)
620+
621+
$psDistChannel = Get-PowerShellDistibutionChannel -TestContext $testContext -Name $Name
622+
$psDistChannel | Should -BeLike "PSDocker-*"
623+
}
594624
}
595625

596626
Context "Labels" {

tests/containerTestCommon.psm1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,28 @@ function Get-ContainerPath
311311
return (Invoke-Docker -Command run -Params $runParams -SuppressHostOutput -PassThru)
312312
}
313313

314+
function Get-PowerShellDistibutionChannelVariable
315+
{
316+
param(
317+
[HashTable] $TestContext,
318+
[string] $Name
319+
)
320+
321+
$imageTag = ${Name}
322+
323+
$runParams = @()
324+
$runParams += '--rm'
325+
326+
$runParams += $imageTag
327+
$runParams += 'pwsh'
328+
$runParams += '-nologo'
329+
$runParams += '-noprofile'
330+
$runParams += '-c'
331+
$runParams += '$env:POWERSHELL_DISTRIBUTION_CHANNEL'
332+
333+
return (Invoke-Docker -Command run -Params $runParams -SuppressHostOutput -PassThru)
334+
}
335+
314336
function Get-MetadataUsingContainer
315337
{
316338
param(

0 commit comments

Comments
 (0)