Skip to content

Commit 0369e5e

Browse files
Fix tests
1 parent ee1facb commit 0369e5e

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

tests/container.tests.ps1

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' {
159159
$runTestCases += @{
160160
Name = $_.Name
161161
ExpectedVersion = $_.ExpectedVersion
162+
Channel = $_.Channel
162163
}
163164
}
164165

@@ -186,6 +187,7 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' {
186187
}
187188

188189
Context "Run Powershell" {
190+
189191
it "Get PSVersion table from <Name> should be <ExpectedVersion>" -TestCases $runTestCases -Skip:$script:skipLinuxRun {
190192
param(
191193
[Parameter(Mandatory=$true)]
@@ -194,7 +196,11 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' {
194196

195197
[Parameter(Mandatory=$true)]
196198
[string]
197-
$ExpectedVersion
199+
$ExpectedVersion,
200+
201+
[Parameter(Mandatory=$true)]
202+
[string]
203+
$Channel
198204
)
199205

200206
$actualVersion = Get-ContainerPowerShellVersion -TestContext $testContext -Name $Name
@@ -222,7 +228,11 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' {
222228

223229
[Parameter(Mandatory=$true)]
224230
[string]
225-
$ExpectedVersion
231+
$ExpectedVersion,
232+
233+
[Parameter(Mandatory=$true)]
234+
[string]
235+
$Channel
226236
)
227237

228238
$culture = Get-UICultureUsingContainer -Name $Name
@@ -249,9 +259,17 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' {
249259

250260
[Parameter(Mandatory=$true)]
251261
[string]
252-
$ExpectedVersion
262+
$ExpectedVersion,
263+
264+
[Parameter(Mandatory=$true)]
265+
[string]
266+
$Channel
253267
)
254268

269+
if ($Channel -ne 'preview') {
270+
Set-ItResult -Skipped -Because "Test is not applicable to $Channel"
271+
}
272+
255273
$psDistChannel = Get-PowerShellDistibutionChannel -TestContext $testContext -Name $Name
256274
$psDistChannel | Should -BeLike "PSDocker-*"
257275
}
@@ -550,6 +568,7 @@ Describe "Windows Containers" -Tags 'Behavior', 'Windows' {
550568
$runTestCases += @{
551569
Name = $_.Name
552570
ExpectedVersion = $_.ExpectedVersion
571+
Channel = $_.Channel
553572
}
554573
}
555574

@@ -574,7 +593,11 @@ Describe "Windows Containers" -Tags 'Behavior', 'Windows' {
574593

575594
[Parameter(Mandatory=$true)]
576595
[string]
577-
$ExpectedVersion
596+
$ExpectedVersion,
597+
598+
[Parameter(Mandatory=$true)]
599+
[string]
600+
$Channel
578601
)
579602

580603
Get-ContainerPowerShellVersion -TestContext $testContext -Name $Name | should -be $ExpectedVersion
@@ -607,15 +630,19 @@ Describe "Windows Containers" -Tags 'Behavior', 'Windows' {
607630
$path | should -Match ([System.Text.RegularExpressions.Regex]::Escape("C:\Windows\system32"))
608631
}
609632

610-
it "Has POWERSHELL_DISTRIBUTION_CHANNEL environment variable defined" -TestCases $runTestCases -Skip:$script:skipLinuxRun {
633+
it "Has POWERSHELL_DISTRIBUTION_CHANNEL environment variable defined" -TestCases $runTestCases -Skip:$script:skipWindowsRun {
611634
param(
612635
[Parameter(Mandatory=$true)]
613636
[string]
614637
$name,
615638

616639
[Parameter(Mandatory=$true)]
617640
[string]
618-
$ExpectedVersion
641+
$ExpectedVersion,
642+
643+
[Parameter(Mandatory=$true)]
644+
[string]
645+
$Channel
619646
)
620647

621648
$psDistChannel = Get-PowerShellDistibutionChannel -TestContext $testContext -Name $Name

tests/containerTestCommon.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ function Get-ContainerPath
311311
return (Invoke-Docker -Command run -Params $runParams -SuppressHostOutput -PassThru)
312312
}
313313

314-
function Get-PowerShellDistibutionChannelVariable
314+
function Get-PowerShellDistibutionChannel
315315
{
316316
param(
317317
[HashTable] $TestContext,

0 commit comments

Comments
 (0)