[Windows] Move Windows features to toolset (#3838)

* move windows features to toolset

* Update WindowsFeatures.Tests.ps1

* revert templates
This commit is contained in:
Maxim Lobanov
2021-08-03 20:17:31 +03:00
committed by GitHub
parent c960549cb1
commit f93413492e
7 changed files with 60 additions and 51 deletions

View File

@@ -1,33 +1,17 @@
Describe "WindowsFeatures" {
$windowsFeatures = (Get-ToolsetContent).windowsFeatures
$testCases = $windowsFeatures | ForEach-Object { @{ Name = $_.name; OptionalFeature = $_.optionalFeature } }
$testCases = @(
@{ FeatureName = "NET-Framework-Features" }
@{ FeatureName = "NET-Framework-45-Features" }
@{ FeatureName = "FS-iSCSITarget-Server" }
)
if (Test-isWin16) {
$testCases += @{ FeatureName = "BITS" }
$testCases += @{ FeatureName = "DSC-Service" }
}
if (Test-isWin19) {
$testCases += @{ FeatureName = "Microsoft-Windows-Subsystem-Linux" }
}
It "Windows Feature <FeatureName> is installed" -TestCases $testCases {
(Get-WindowsFeature -Name $FeatureName).InstallState | Should -Be "Installed"
}
if (Test-isWin19) {
it "Check WSL is on path" {
(Get-Command -Name 'wsl') | Should -BeTrue
It "Windows Feature <Name> is installed" -TestCases $testCases {
if ($OptionalFeature) {
(Get-WindowsOptionalFeature -Online -FeatureName $Name).State | Should -Be "Enabled"
} else {
(Get-WindowsFeature -Name $Name).InstallState | Should -Be "Installed"
}
}
}
Describe "ContainersFeature" {
It "Windows containers feature is installed" {
(Get-WindowsFeature -Name "Containers").InstallState | Should -Be "Installed"
it "Check WSL is on path" -Skip:(-not (Test-IsWin19)) {
(Get-Command -Name 'wsl') | Should -BeTrue
}
}