Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

test: enable integration tests for PG on emulator#1526

Merged
gcf-merge-on-green[bot] merged 3 commits into
mainfrom
enable-postgresql-tests-on-emulator
Mar 6, 2024
Merged

test: enable integration tests for PG on emulator#1526
gcf-merge-on-green[bot] merged 3 commits into
mainfrom
enable-postgresql-tests-on-emulator

Conversation

@olavloite

Copy link
Copy Markdown
Collaborator

The emulator now supports PostgreSQL, so we can enable the integration tests for PostgreSQL when running on the emulator.

This change also changes some of the tests that had workarounds for features that were initially missing in PostgreSQL, such as support for DATE and TIMESTAMPTZ.

The emulator now supports PostgreSQL, so we can enable the integration
tests for PostgreSQL when running on the emulator.

This change also changes some of the tests that had workarounds for
features that were initially missing in PostgreSQL, such as support for
DATE and TIMESTAMPTZ.
@olavloite olavloite requested review from a team and ankiaga March 5, 2024 11:18
@product-auto-label product-auto-label Bot added size: l Pull request size is large. api: spanner Issues related to the googleapis/java-spanner-jdbc API. labels Mar 5, 2024
Comment thread src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcPgDatabaseMetaDataTest.java Outdated
Comment thread src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadWriteAutocommitTest.java Outdated
public void test04_TestGetCommitTimestamp() throws Exception {
// Skipping test as Commit Timestamp not supported in POSTGRES
assumeFalse(dialect.dialect == Dialect.POSTGRESQL);
try (CloudSpannerJdbcConnection connection = createConnection(env, database)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a try block?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, JDBC connections are auto-closeables, and should therefore be enclosed in try-with-resources blocks whenever possible. This ensures that the connection is closed at the end of the block, regardless what happens (e.g. exceptions, early returns, just reaching the end of the block, etc.).

Failing to close JDBC connection can cause resource leaks.

@olavloite olavloite added the automerge Merge the pull request once unit tests and other checks pass. label Mar 6, 2024
@gcf-merge-on-green gcf-merge-on-green Bot merged commit 90f35b3 into main Mar 6, 2024
@gcf-merge-on-green gcf-merge-on-green Bot deleted the enable-postgresql-tests-on-emulator branch March 6, 2024 17:10
@gcf-merge-on-green gcf-merge-on-green Bot removed the automerge Merge the pull request once unit tests and other checks pass. label Mar 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: spanner Issues related to the googleapis/java-spanner-jdbc API. size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants