Skip to content

Bugs investigation#3

Closed
wasifsarwar wants to merge 2 commits into
mainfrom
cursor/bugs-investigation-27a1
Closed

Bugs investigation#3
wasifsarwar wants to merge 2 commits into
mainfrom
cursor/bugs-investigation-27a1

Conversation

@wasifsarwar
Copy link
Copy Markdown
Owner

Configure backend tests to use an in-memory H2 database and disable Flyway to allow them to run without a PostgreSQL instance.


Open in Cursor Open in Web

Run Spring context tests without requiring a local Postgres instance by activating a test profile backed by in-memory H2 and skipping Flyway migrations.

Co-authored-by: wasif.sarwar9 <wasif.sarwar9@gmail.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Jan 14, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@wasifsarwar wasifsarwar marked this pull request as ready for review January 14, 2026 11:07
@wasifsarwar
Copy link
Copy Markdown
Owner Author

@cursoragent review this PR for bugs

@cursor
Copy link
Copy Markdown

cursor Bot commented Jan 14, 2026

PR review: “Bugs investigation”

What looks good

  • Fixes the root cause: @SpringBootTest was failing because Flyway tried to connect to local Postgres; switching tests to in-memory H2 removes that environment dependency.
  • Scoped to tests: using application-test.properties + @ActiveProfiles("test") keeps production/dev config unchanged.
  • CI-friendly: ./gradlew test runs green without provisioning Postgres.

Potential issues / improvements

  • Flyway disabled in tests: this means tests won’t catch migration errors. That’s fine for contextLoads(), but consider adding a separate integration test profile later (e.g., Testcontainers Postgres) to validate migrations.
  • DDL strategy difference: spring.jpa.hibernate.ddl-auto=create-drop in tests won’t reflect your Flyway schema exactly. Again OK for now, but be aware it can hide schema mismatches.
  • H2 PostgreSQL mode is helpful but not perfect: some Postgres-specific SQL/features can still behave differently under H2.

Nits (optional)

  • If you add more tests later, you may want a global test configuration (e.g., @ActiveProfiles("test") via a base test class) so you don’t repeat the annotation.

Verdict

LGTM for the stated goal: making backend tests run without a PostgreSQL instance.


Open in Cursor Open in Web

@wasifsarwar wasifsarwar changed the base branch from CategoryWork to main January 14, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants