Merge pull request #1715 from maxim-lobanov/v-malob/big-sur

Enable Java tests since Java switching was fixed in MacOS 11.0
This commit is contained in:
Maxim Lobanov
2020-11-09 12:29:43 +03:00
committed by GitHub
3 changed files with 14 additions and 17 deletions

View File

@@ -82,6 +82,7 @@ $homebrewVersion = Run-Command "brew --version" | Select-Object -First 1
$npmVersion = Run-Command "npm --version" $npmVersion = Run-Command "npm --version"
$yarnVersion = Run-Command "yarn --version" $yarnVersion = Run-Command "yarn --version"
$nugetVersion = Run-Command "nuget help" | Select-Object -First 1 | Take-Part -Part 2 $nugetVersion = Run-Command "nuget help" | Select-Object -First 1 | Take-Part -Part 2
$pipVersion = Get-PipVersion -Version 2
$pip3Version = Get-PipVersion -Version 3 $pip3Version = Get-PipVersion -Version 3
$pipxVersion = Get-PipxVersion $pipxVersion = Get-PipxVersion
$condaVersion = Invoke-Expression "conda --version" $condaVersion = Invoke-Expression "conda --version"
@@ -93,12 +94,9 @@ if ($os.IsHigherThanMojave) {
$vcpkgVersion = Get-VcpkgVersion $vcpkgVersion = Get-VcpkgVersion
$markdown += New-MDList -Lines $vcpkgVersion -Style Unordered -NoNewLine $markdown += New-MDList -Lines $vcpkgVersion -Style Unordered -NoNewLine
} }
if ($os.IsLessThanBigSur) {
$pipVersion = Get-PipVersion -Version 2
$markdown += New-MDList -Style Unordered -Lines @("Pip ${pipVersion}") -NoNewLine
}
$markdown += New-MDList -Style Unordered -Lines @( $markdown += New-MDList -Style Unordered -Lines @(
"Pip ${pipVersion}",
"Pip ${pip3Version}", "Pip ${pip3Version}",
$pipxVersion, $pipxVersion,
$bundlerVersion, $bundlerVersion,

View File

@@ -1,8 +1,6 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
#Java tests are disabled because Java is not working properly on macOS 11.0 yet.
$os = Get-OSVersion
function Get-NativeVersionFormat { function Get-NativeVersionFormat {
param($Version) param($Version)
if ($Version -in "7", "8") { if ($Version -in "7", "8") {
@@ -11,7 +9,7 @@ function Get-NativeVersionFormat {
return $Version return $Version
} }
Describe "Java" -Skip:($os.IsBigSur) { Describe "Java" {
BeforeAll { BeforeAll {
function Validate-JavaVersion { function Validate-JavaVersion {
param($JavaCommand, $ExpectedVersion) param($JavaCommand, $ExpectedVersion)
@@ -37,18 +35,19 @@ Describe "Java" -Skip:($os.IsBigSur) {
"/usr/libexec/java_home -v${Version}" | Should -ReturnZeroExitCode "/usr/libexec/java_home -v${Version}" | Should -ReturnZeroExitCode
} }
It "Version is valid" -TestCases $_ { if ($_.Title -ne "Default") {
$javaRootPath = (Get-CommandResult "/usr/libexec/java_home -v${Version}").Output It "Version is valid" -TestCases $_ {
$javaBinPath = Join-Path $javaRootPath "/bin/java" $javaRootPath = "/Library/Java/JavaVirtualMachines/adoptopenjdk-${Title}.jdk/Contents/Home"
Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version if ($Title -eq "7") { $javaRootPath = "/Library/Java/JavaVirtualMachines/zulu-7.jdk/Contents/Home" }
$javaBinPath = Join-Path $javaRootPath "/bin/java"
Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version
}
} }
It "<EnvVariable>" -TestCases $_ { It "<EnvVariable>" -TestCases $_ {
$envVariablePath = Get-EnvironmentVariable $EnvVariable $envVariablePath = Get-EnvironmentVariable $EnvVariable
$commandResult = Get-CommandResult "/usr/libexec/java_home -v${Version}" $javaBinPath = Join-Path $envVariablePath "/bin/java"
$commandResult.ExitCode | Should -Be 0 Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version
$commandResult.Output | Should -Not -BeNullOrEmpty
$commandResult.Output | Should -Be $envVariablePath
} }
if ($_.Title -eq "Default") { if ($_.Title -eq "Default") {

View File

@@ -12,7 +12,7 @@ Describe "Python" {
(Get-CommandResult "python --version").Output | Should -BeLike "Python 2.*" (Get-CommandResult "python --version").Output | Should -BeLike "Python 2.*"
} }
It "Python 2 is installed under /usr/local/bin" -Skip:($os.IsBigSur) { It "Python 2 is installed under /usr/local/bin" {
Get-WhichTool "python" | Should -BeLike "/usr/local/bin*" Get-WhichTool "python" | Should -BeLike "/usr/local/bin*"
} }
@@ -24,7 +24,7 @@ Describe "Python" {
Get-WhichTool "python3" | Should -BeLike "/usr/local/bin*" Get-WhichTool "python3" | Should -BeLike "/usr/local/bin*"
} }
It "Pip 2 is available" -Skip:($os.IsBigSur) { It "Pip 2 is available" {
"pip --version" | Should -ReturnZeroExitCode "pip --version" | Should -ReturnZeroExitCode
} }