Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for PostgreSQL 16 #288

Merged
merged 4 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
strategy:
matrix:
pg_version: [ "11.20-alpine", "12.15", "13.11", "14.8", "15.3" ]
pg_version: [ "12.16", "13.12", "14.9", "15.4", "16.0" ]
env:
TEST_PG_VERSION: ${{ matrix.pg_version }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -42,16 +42,16 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle and analyze
if: matrix.pg_version == '14.8'
if: matrix.pg_version == '14.9'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build sonarqube --info
- name: Build with Gradle
if: matrix.pg_version != '14.8'
if: matrix.pg_version != '14.9'
run: ./gradlew build
- name: Upload coverage to Codecov
if: matrix.pg_version == '14.8'
if: matrix.pg_version == '14.9'
uses: codecov/codecov-action@v3
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 15.3 from Testcontainers](https://www.testcontainers.org/) is used to run tests.
By default, [PostgreSQL 16.0 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
@@ -1,5 +1,5 @@
# ![pg-index-health](https://github.com/mfvanek/pg-index-health/blob/master/logo.png "pg-index-health")
**pg-index-health** is a Java library for analyzing and maintaining indexes health in [PostgreSQL](https://www.postgresql.org/) databases.
**pg-index-health** is a Java library for analyzing and maintaining indexes and tables health in [PostgreSQL](https://www.postgresql.org/) databases.

[![Java CI](https://github.com/mfvanek/pg-index-health/actions/workflows/tests.yml/badge.svg)](https://github.com/mfvanek/pg-index-health/actions/workflows/tests.yml "Java CI")
[![Maven Central](https://img.shields.io/maven-central/v/io.github.mfvanek/pg-index-health.svg)](https://search.maven.org/artifact/io.github.mfvanek/pg-index-health/ "Maven Central")
Expand All @@ -17,14 +17,14 @@
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=mfvanek_pg-index-health&metric=coverage)](https://sonarcloud.io/summary/new_code?id=mfvanek_pg-index-health)

## Supported PostgreSQL versions
[![PostgreSQL 11](https://img.shields.io/badge/PostgreSQL-11-green.svg)](https://www.postgresql.org/about/news/1894/ "PostgreSQL 11")
[![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")

### Support for previous versions of PostgreSQL
Compatibility with PostgreSQL versions **9.6** and **10** is no longer guaranteed, but it is very likely.
Compatibility with PostgreSQL versions **9.6**, **10** and **11** 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
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 15.3} is used.
* otherwise the default version {@code 16.0} 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 "15.3";
return "16.0";
}

@Nonnull
Expand All @@ -90,7 +90,7 @@ 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.3.0} is used.
* otherwise the default version {@code 15.4.0} is used.
*
* @return {@code PostgresVersionHolder}
*/
Expand All @@ -114,7 +114,7 @@ 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 15.3} is used.
* otherwise the default version {@code 16.0} is used.
*
* @return {@code PostgresVersionHolder}
*/
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("15.3")) {
try (PostgreSqlContainerWrapper container = PostgreSqlContainerWrapper.withVersion("16.0")) {
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("15.3.0");
.isEqualTo("16.0.0");
}
}

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

Expand All @@ -125,8 +125,8 @@ void forSingleNodeShouldBeAbleToForceVersion() {

@Test
void toBitnamiVersionShouldSkipSuffix() {
assertThat(PostgresVersionHolder.toBitnamiVersion("15.3"))
.isEqualTo("15.3.0");
assertThat(PostgresVersionHolder.toBitnamiVersion("15.4"))
.isEqualTo("15.4.0");
assertThat(PostgresVersionHolder.toBitnamiVersion("14.5-alpine3.17"))
.isEqualTo("14.5.0");
}
Expand Down
2 changes: 1 addition & 1 deletion pg-index-health/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) ? "15.3 (Debian 15.3-" : pgVersionFromEnv.split("-")[0];
final String requiredPgVersionString = (pgVersionFromEnv == null) ? "16.0 (Debian 16.0-" : pgVersionFromEnv.split("-")[0];
final String actualPgVersionString = PostgresVersionReader.readVersion(getDataSource());
assertThat(actualPgVersionString)
.startsWith(requiredPgVersionString);
Expand Down