diff --git a/images/macos/provision/core/mongodb.sh b/images/macos/provision/core/mongodb.sh index 9e6c2bba2..a8522e56b 100644 --- a/images/macos/provision/core/mongodb.sh +++ b/images/macos/provision/core/mongodb.sh @@ -4,9 +4,11 @@ source ~/utils/utils.sh # MongoDB object-value database # Install latest release version of MongoDB Community Edition # https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x +toolsetVersion=$(get_toolset_value '.mongodb.version') -echo "Installing mongodb..." brew tap mongodb/brew -brew_smart_install "mongodb-community@5.0" +versionToInstall=$(brew search --formulae /mongodb-community@$toolsetVersion/ | awk -F'/' '{print $3}' | tail -1) +echo "Installing mongodb $versionToInstall" +brew_smart_install "$versionToInstall" invoke_tests "Databases" "MongoDB" diff --git a/images/macos/tests/Databases.Tests.ps1 b/images/macos/tests/Databases.Tests.ps1 index 5f4548ac7..9872866f5 100644 --- a/images/macos/tests/Databases.Tests.ps1 +++ b/images/macos/tests/Databases.Tests.ps1 @@ -1,7 +1,10 @@ Describe "MongoDB" { - It "mongodb" { - "mongo --version" | Should -ReturnZeroExitCode - "mongod --version"| Should -ReturnZeroExitCode + It "" -TestCases @( + @{ ToolName = "mongo" } + @{ ToolName = "mongod" } + ) { + $toolsetVersion = Get-ToolsetValue 'mongodb.version' + (&$ToolName --version)[2].Split('"')[-2] | Should -BeLike "$toolsetVersion*" } } diff --git a/images/macos/toolsets/toolset-10.14.json b/images/macos/toolsets/toolset-10.14.json index 18cc772bf..7e4f7899c 100644 --- a/images/macos/toolsets/toolset-10.14.json +++ b/images/macos/toolsets/toolset-10.14.json @@ -383,5 +383,8 @@ "12", "14" ] + }, + "mongodb": { + "version": "5" } } diff --git a/images/macos/toolsets/toolset-10.15.json b/images/macos/toolsets/toolset-10.15.json index 8b80a88ce..2c499ad3e 100644 --- a/images/macos/toolsets/toolset-10.15.json +++ b/images/macos/toolsets/toolset-10.15.json @@ -341,5 +341,8 @@ }, "llvm": { "version": "13" + }, + "mongodb": { + "version": "5" } -} +} \ No newline at end of file diff --git a/images/macos/toolsets/toolset-11.json b/images/macos/toolsets/toolset-11.json index 45b784a75..4de3e965c 100644 --- a/images/macos/toolsets/toolset-11.json +++ b/images/macos/toolsets/toolset-11.json @@ -293,5 +293,8 @@ }, "llvm": { "version": "13" + }, + "mongodb": { + "version": "5" } -} +} \ No newline at end of file diff --git a/images/macos/toolsets/toolset-12.json b/images/macos/toolsets/toolset-12.json index 628238cfa..17e22e0dd 100644 --- a/images/macos/toolsets/toolset-12.json +++ b/images/macos/toolsets/toolset-12.json @@ -191,5 +191,8 @@ "12", "14" ] + }, + "mongodb": { + "version": "5" } }