Skip to content

Commit

Permalink
Add support for PostgreSQL 17 (#470)
Browse files Browse the repository at this point in the history
* Add support for PostgreSQL 17

* Add support for PostgreSQL 17 #2

* Add badge for PostgreSQL 17

* Update sql queries

* Update PostgreSQL versions

* Update PostgreSQL version in tests
  • Loading branch information
mfvanek authored Nov 26, 2024
1 parent 1721b6b commit f0b0f8e
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pg_version: [ "12.20", "13.16", "14.13", "15.8", "16.4" ]
pg_version: [ "13.18", "14.15", "15.10", "16.6", "17.2" ]
env:
TEST_PG_VERSION: ${{ matrix.pg_version }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -43,17 +43,17 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle and analyze
if: matrix.pg_version == '14.13'
if: matrix.pg_version == '16.6'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
run: ./gradlew build sonarqube --info
- name: Build with Gradle
if: matrix.pg_version != '14.13'
if: matrix.pg_version != '16.6'
run: ./gradlew build
- name: Upload coverage to Codecov
if: matrix.pg_version == '14.13'
if: matrix.pg_version == '16.6'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Java >= 11 is required.

This will build the project and run tests.

By default, [PostgreSQL 16.4 from Testcontainers](https://www.testcontainers.org/) is used to run tests.
By default, [PostgreSQL 17.2 from Testcontainers](https://www.testcontainers.org/) is used to run tests.
Set `TEST_PG_VERSION` environment variable to use any of other available PostgreSQL version:
```
TEST_PG_VERSION=11.20-alpine
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

## Supported PostgreSQL versions

[![PostgreSQL 12](https://img.shields.io/badge/PostgreSQL-12-green.svg)](https://www.postgresql.org/about/news/1976/ "PostgreSQL 12")
[![PostgreSQL 13](https://img.shields.io/badge/PostgreSQL-13-green.svg)](https://www.postgresql.org/about/news/postgresql-13-released-2077/ "PostgreSQL 13")
[![PostgreSQL 14](https://img.shields.io/badge/PostgreSQL-14-green.svg)](https://www.postgresql.org/about/news/postgresql-14-released-2318/ "PostgreSQL 14")
[![PostgreSQL 15](https://img.shields.io/badge/PostgreSQL-15-green.svg)](https://www.postgresql.org/about/news/postgresql-15-released-2526/ "PostgreSQL 15")
[![PostgreSQL 16](https://img.shields.io/badge/PostgreSQL-16-green.svg)](https://www.postgresql.org/about/news/postgresql-16-released-2715/ "PostgreSQL 16")
[![PostgreSQL 17](https://img.shields.io/badge/PostgreSQL-17-green.svg)](https://www.postgresql.org/about/news/postgresql-17-released-2936/ "PostgreSQL 17")

### Support for previous versions of PostgreSQL

Compatibility with PostgreSQL versions **9.6**, **10** and **11** is no longer guaranteed, but it is very likely.
Compatibility with PostgreSQL versions **10**, **11** and **12** is no longer guaranteed, but it is very likely.
We focus only on the currently maintained versions of PostgreSQL.
For more information please see [PostgreSQL Versioning Policy](https://www.postgresql.org/support/versioning/).

Expand Down Expand Up @@ -168,7 +168,7 @@ Using Maven:
| 2.4.x | 8 | 0.3.x — 0.4.x |
| 2.5.x | 8 | 0.5.x — 0.6.x |
| 2.6.x | 8 | 0.7.x |
| 2.7.x | 11 | 0.8.x — 0.13.x |
| 2.7.x | 11 | 0.8.x — 0.14.x |

#### Spring Boot 3 compatibility

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| Version | Supported |
|---------| ------------------ |
| 0.13.x | :white_check_mark: |
| 0.14.x | :white_check_mark: |

## Reporting a Vulnerability

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.9"

services:
postgres:
image: postgres:16.4
image: postgres:17.2
shm_size: "2gb"
environment:
POSTGRES_DB: "pgih-db"
Expand Down
2 changes: 1 addition & 1 deletion pg-index-health-core/src/main/resources
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class PostgresVersionTest extends DatabaseAwareTestBase {
@Test
void checkPgVersion() {
final String pgVersionFromEnv = System.getenv(PG_VERSION_ENVIRONMENT_VARIABLE);
final String requiredPgVersionString = (pgVersionFromEnv == null) ? "16.4 (Debian 16.4-" : pgVersionFromEnv.split("-")[0];
final String requiredPgVersionString = (pgVersionFromEnv == null) ? "17.2 (Debian 17.2-" : pgVersionFromEnv.split("-")[0];
final String actualPgVersionString = PostgresVersionReader.readVersion(getDataSource());
assertThat(actualPgVersionString)
.startsWith(requiredPgVersionString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public boolean isOutParametersInProcedureSupported() {
/**
* Creates {@code PostgreSqlContainerWrapper} with default PostgreSQL version.
* The default version is taken from the environment variable {@code TEST_PG_VERSION} if it is set,
* otherwise the default version {@code 16.4} is used.
* otherwise the default version {@code 17.2} is used.
*
* @return {@code PostgreSqlContainerWrapper}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private static String preparePostgresVersion() {
if (pgVersion != null) {
return pgVersion;
}
return "16.4";
return "17.2";
}

/**
Expand All @@ -103,7 +103,7 @@ public static String toBitnamiVersion(@Nonnull final String pgVersion) {
/**
* Creates {@code PostgresVersionHolder} for Bitnami cluster installation.
* The version is taken from the environment variable {@code TEST_PG_VERSION} if it is set,
* otherwise the default version {@code 15.4.0} is used.
* otherwise the default version {@code 17.2.0} is used.
*
* @return {@code PostgresVersionHolder}
*/
Expand All @@ -127,7 +127,7 @@ public static PostgresVersionHolder forCluster(@Nonnull final String pgVersion)
/**
* Creates {@code PostgresVersionHolder} for single node installation.
* The version is taken from the environment variable {@code TEST_PG_VERSION} if it is set,
* otherwise the default version {@code 16.4} is used.
* otherwise the default version {@code 17.2} is used.
*
* @return {@code PostgresVersionHolder}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ void builderWithForcedVersion() {
.withUsername("user")
.withPassword("password")
.withDatabaseName("test_db_with_repmgr")
.withPostgresVersion("14.7");
.withPostgresVersion("16.6");
assertThat(builder.getPostgresVersion())
.isEqualTo("14.7");
.isEqualTo("16.6");
try (PostgreSqlClusterWrapper cluster = builder.build()) {
assertThat(cluster)
.satisfies(it -> {
Expand All @@ -104,7 +104,7 @@ void builderWithForcedVersion() {
assertThat(it.getSecondContainerJdbcUrl()).contains("/test_db_with_repmgr");
});
final String actualPgVersionString = PostgresVersionReader.readVersion(cluster.getDataSourceForPrimary());
assertThat(actualPgVersionString).startsWith("14.7");
assertThat(actualPgVersionString).startsWith("16.6");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void withDefaultVersionShouldWork() {

@Test
void withVersionShouldWork() {
try (PostgreSqlContainerWrapper container = PostgreSqlContainerWrapper.withVersion("16.4")) {
try (PostgreSqlContainerWrapper container = PostgreSqlContainerWrapper.withVersion("17.2")) {
assertThat(container)
.isNotNull()
.satisfies(c -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void forClusterShouldBeBitnamiAware() {
.isEqualTo(System.getenv("TEST_PG_VERSION").split("-")[0] + ".0");
} else {
assertThat(versionHolder.getVersion())
.isEqualTo("16.4.0");
.isEqualTo("17.2.0");
}
}

Expand Down Expand Up @@ -110,7 +110,7 @@ void forSingleNodeShouldBeEnvAware() {
.isEqualTo(System.getenv("TEST_PG_VERSION"));
} else {
assertThat(versionHolder.getVersion())
.isEqualTo("16.4");
.isEqualTo("17.2");
}
}

Expand Down

0 comments on commit f0b0f8e

Please sign in to comment.