Skip to content

Commit

Permalink
Merge pull request #1715 from maxim-lobanov/v-malob/big-sur
Browse files Browse the repository at this point in the history
Enable Java tests since Java switching was fixed in MacOS 11.0
  • Loading branch information
maxim-lobanov authored Nov 9, 2020
2 parents fa9109c + 589cb6f commit 0a3cb90
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
6 changes: 2 additions & 4 deletions images/macos/software-report/SoftwareReport.Generator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ $homebrewVersion = Run-Command "brew --version" | Select-Object -First 1
$npmVersion = Run-Command "npm --version"
$yarnVersion = Run-Command "yarn --version"
$nugetVersion = Run-Command "nuget help" | Select-Object -First 1 | Take-Part -Part 2
$pipVersion = Get-PipVersion -Version 2
$pip3Version = Get-PipVersion -Version 3
$pipxVersion = Get-PipxVersion
$condaVersion = Invoke-Expression "conda --version"
Expand All @@ -93,12 +94,9 @@ if ($os.IsHigherThanMojave) {
$vcpkgVersion = Get-VcpkgVersion
$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 @(
"Pip ${pipVersion}",
"Pip ${pip3Version}",
$pipxVersion,
$bundlerVersion,
Expand Down
21 changes: 10 additions & 11 deletions images/macos/tests/Java.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
Import-Module "$PSScriptRoot/../helpers/Common.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 {
param($Version)
if ($Version -in "7", "8") {
Expand All @@ -11,7 +9,7 @@ function Get-NativeVersionFormat {
return $Version
}

Describe "Java" -Skip:($os.IsBigSur) {
Describe "Java" {
BeforeAll {
function Validate-JavaVersion {
param($JavaCommand, $ExpectedVersion)
Expand All @@ -37,18 +35,19 @@ Describe "Java" -Skip:($os.IsBigSur) {
"/usr/libexec/java_home -v${Version}" | Should -ReturnZeroExitCode
}

It "Version is valid" -TestCases $_ {
$javaRootPath = (Get-CommandResult "/usr/libexec/java_home -v${Version}").Output
$javaBinPath = Join-Path $javaRootPath "/bin/java"
Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version
if ($_.Title -ne "Default") {
It "Version is valid" -TestCases $_ {
$javaRootPath = "/Library/Java/JavaVirtualMachines/adoptopenjdk-${Title}.jdk/Contents/Home"
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 $_ {
$envVariablePath = Get-EnvironmentVariable $EnvVariable
$commandResult = Get-CommandResult "/usr/libexec/java_home -v${Version}"
$commandResult.ExitCode | Should -Be 0
$commandResult.Output | Should -Not -BeNullOrEmpty
$commandResult.Output | Should -Be $envVariablePath
$javaBinPath = Join-Path $envVariablePath "/bin/java"
Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version
}

if ($_.Title -eq "Default") {
Expand Down
4 changes: 2 additions & 2 deletions images/macos/tests/Python.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Describe "Python" {
(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*"
}

Expand All @@ -24,7 +24,7 @@ Describe "Python" {
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
}

Expand Down

0 comments on commit 0a3cb90

Please sign in to comment.