Skip to content

test: update psqlreplicatests#307

Open
niazkhansap wants to merge 2 commits into
mainfrom
task/psqlreplica-tests
Open

test: update psqlreplicatests#307
niazkhansap wants to merge 2 commits into
mainfrom
task/psqlreplica-tests

Conversation

@niazkhansap

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ae5e0654-b7a7-4132-9603-ec937e2953b6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds a PostgreSQL replica container helper, updates integration tests to use real containers, removes the static replica config, and broadens Sonar coverage exclusions.

Changes

Replica test helper and integration coverage

Layer / File(s) Summary
Replica container helper
internal/testutils/postgres_replica.go
Defines StartPostgresReplicaContainer, which starts a PostgreSQL 16 container, waits for readiness, reads the mapped connection details, and returns a config.Database for the replica.
Replica integration suite
test/integration/psqlreplicatests/psqlreplica_test.go, test/integration/integration_utils/db.go
Reworks the replica integration suite to start primary and replica databases, removes the exported replica DB slice, and updates the connection tests for success, empty replica input, and replica connection failure.
Coverage exclusions
sonar-project.properties
Updates sonar.coverage.exclusions to exclude **/testutils/** and **/test/integration/integration_utils/** instead of the narrower testutils path.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@niazkhansap

Copy link
Copy Markdown
Contributor Author

@coderabbitai summary

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
✅ Action performed

Summary regeneration triggered.

@niazkhansap
niazkhansap force-pushed the task/psqlreplica-tests branch 3 times, most recently from f356d7c to 2c638a6 Compare July 8, 2026 13:27
@jmpTeixeira02

Copy link
Copy Markdown
Contributor

Honestly speaking I dont see much value in this tests. This seems to be testing GORM DBResolver and not anything implemented by us

@niazkhansap
niazkhansap force-pushed the task/psqlreplica-tests branch from 2c638a6 to 325f2ac Compare July 8, 2026 14:35
@niazkhansap

Copy link
Copy Markdown
Contributor Author

@coderabbitai summary

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
✅ Action performed

Summary regeneration triggered.

@niazkhansap

Copy link
Copy Markdown
Contributor Author

Honestly speaking I dont see much value in this tests. This seems to be testing GORM DBResolver and not anything implemented by us

Good catch — dropped the GORM/dbresolver tests, suite now covers only db.StartDBConnection paths plus fixture sanity checks.

@jmpTeixeira02

Copy link
Copy Markdown
Contributor

Good catch — dropped the GORM/dbresolver tests, suite now covers only db.StartDBConnection paths plus fixture sanity checks.

I might be missing something, but all of these tests that currently exist are testing the GORM DbResolver. We don't have anything implemented by us for DB Replication. All of those checking if the replicas work are testing GORM. IMO none of these tests are really needed. The only code that this runs that could possibly cause issues is the OpenConnection that is not related with any Replication

Also, as a side note, I'm not entirely sure if we even use Replication at this level at all. I might be mistaken but we have a proxy on the DB that handles all of that internally, so we don't really ever use the DB Replicas

@niazkhansap
niazkhansap force-pushed the task/psqlreplica-tests branch 2 times, most recently from dca1740 to 02a90c6 Compare July 8, 2026 17:00
@niazkhansap

Copy link
Copy Markdown
Contributor Author

@coderabbitai summary

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
✅ Action performed

Summary regeneration triggered.

@jmpTeixeira02 jmpTeixeira02 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looking cleaner

Comment thread internal/testutils/postgres_replica.go Outdated
@niazkhansap
niazkhansap force-pushed the task/psqlreplica-tests branch from 02a90c6 to 5d66987 Compare July 10, 2026 13:34
Signed-off-by: Niaz Khan <niazkhansap@gmail.com>
Signed-off-by: Niaz Khan <niazkhansap@gmail.com>
@niazkhansap
niazkhansap force-pushed the task/psqlreplica-tests branch from 5d66987 to 3c185d2 Compare July 14, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants