diff --git a/images/macos/provision/core/postgresql.sh b/images/macos/provision/core/postgresql.sh index 25414638f..5a5c381f9 100644 --- a/images/macos/provision/core/postgresql.sh +++ b/images/macos/provision/core/postgresql.sh @@ -1,13 +1,16 @@ #!/bin/bash -e -o pipefail source ~/utils/utils.sh -#Install latest version of postgresql -brew_smart_install "postgres" +# Fetch PostgreSQL version to install from the toolset +toolsetVersion=$(get_toolset_value '.postgresql.version') -#Service postgresql should be started before use. +# Install latest version of PostgreSQL +brew_smart_install postgresql@$toolsetVersion + +# Service PostgreSQL should be started before use brew services start postgresql -#Verify PostgreSQL is ready for accept incoming connections +# Verify PostgreSQL is ready for accept incoming connections echo "Check PostgreSQL service is running" i=10 COMMAND='pg_isready' @@ -23,7 +26,7 @@ while [ $i -gt 0 ]; do sleep 10 done -#Stop postgresql +# Stop PostgreSQL brew services stop postgresql invoke_tests "Databases" "PostgreSQL" diff --git a/images/macos/tests/Databases.Tests.ps1 b/images/macos/tests/Databases.Tests.ps1 index 9872866f5..9c6f9a263 100644 --- a/images/macos/tests/Databases.Tests.ps1 +++ b/images/macos/tests/Databases.Tests.ps1 @@ -9,11 +9,11 @@ Describe "MongoDB" { } Describe "PostgreSQL" { - It "PostgreSQL-Client" { - "psql --version" | Should -ReturnZeroExitCode - } - - It "PostgreSQL-Server" { - "pg_config --version" | Should -ReturnZeroExitCode + It "PostgreSQL version should correspond to the version in the toolset" { + $toolsetVersion = Get-ToolsetValue 'postgresql.version' + # Client version + (psql --version).split()[-1] | Should -BeLike "$toolsetVersion*" + # Server version + (pg_config --version).split()[-1] | Should -BeLike "$toolsetVersion*" } } \ No newline at end of file diff --git a/images/macos/toolsets/toolset-10.15.json b/images/macos/toolsets/toolset-10.15.json index 76df1ffa7..6597a3fe6 100644 --- a/images/macos/toolsets/toolset-10.15.json +++ b/images/macos/toolsets/toolset-10.15.json @@ -343,5 +343,8 @@ }, "mongodb": { "version": "5.0" + }, + "postgresql": { + "version": "14" } } \ No newline at end of file diff --git a/images/macos/toolsets/toolset-11.json b/images/macos/toolsets/toolset-11.json index b2ef89a48..aa19099b3 100644 --- a/images/macos/toolsets/toolset-11.json +++ b/images/macos/toolsets/toolset-11.json @@ -295,5 +295,8 @@ }, "mongodb": { "version": "5.0" + }, + "postgresql": { + "version": "14" } } \ No newline at end of file diff --git a/images/macos/toolsets/toolset-12.json b/images/macos/toolsets/toolset-12.json index 3e0434f0a..4cf2be7f5 100644 --- a/images/macos/toolsets/toolset-12.json +++ b/images/macos/toolsets/toolset-12.json @@ -193,5 +193,8 @@ }, "mongodb": { "version": "5.0" + }, + "postgresql": { + "version": "14" } }