Enable Experimental Features by default on Preview builds (#10228)

This commit is contained in:
Steve Lee
2019-08-08 11:37:25 -07:00
committed by Dongbo Wang
parent 0d817aa547
commit 882cbf367f
6 changed files with 128 additions and 24 deletions
@@ -36,10 +36,6 @@ Describe "Experimental Feature Basic Tests - Feature-Disabled" -tags "CI" {
}
}
It "No experimental feature is enabled" {
$EnabledExperimentalFeatures.Count | Should -Be 0
}
It "Replace existing command <Name> - version one should be shown" -TestCases @(
@{ Name = "Invoke-AzureFunction"; CommandType = "Function" }
@{ Name = "Invoke-AzureFunctionCSharp"; CommandType = "Cmdlet" }
@@ -129,3 +129,51 @@ Describe "Get-ExperimentalFeature Tests" -tags "Feature","RequireAdminOnWindows"
}
}
}
Describe "Default enablement of Experimental Features" -Tags CI {
BeforeAll {
$isPreview = $PSVersionTable.GitCommitId.Contains("preview")
Function BeEnabled {
[CmdletBinding()]
Param(
$ActualValue,
$Name,
[switch]$Negate
)
$failure = if ($Negate) {
"Expected: Feature $Name to not be Enabled"
}
else {
"Expected: Feature $Name to be Enabled"
}
return [PSCustomObject]@{
Succeeded = if ($Negate) {
$ActualValue -eq $false
}
else {
$ActualValue -eq $true
}
FailureMessage = $failure
}
}
Add-AssertionOperator -Name 'BeEnabled' -Test $Function:BeEnabled
}
It "On stable builds, Experimental Features are not enabled" -Skip:($isPreview) {
foreach ($expFeature in Get-ExperimentalFeature) {
$expFeature.Enabled | Should -Not -BeEnabled -Name $expFeature.Name
}
}
It "On preview builds, Experimental Features are enabled" -Skip:(!$isPreview) {
(Join-Path -Path $PSHOME -ChildPath 'powershell.config.json') | Should -Exist
foreach ($expFeature in Get-ExperimentalFeature) {
$expFeature.Enabled | Should -BeEnabled -Name $expFeature.Name
}
}
}