Skip to content

[BUG] Backend integration tests fail on main due to PostgreSQL connection error #760

@adityabhatkar23

Description

@adityabhatkar23

Description

Backend integration tests are failing on the default branch because the PostgreSQL database required by stream-lifecycle.test.ts is unavailable during test execution.

Steps to Reproduce

  1. Check out the current main branch.
  2. Navigate to the backend package.
  3. Run:
npm test
  1. Observe failures in tests/integration/stream-lifecycle.test.ts.

Expected Behavior

The backend test suite should pass on the default branch, with integration tests able to connect to the required PostgreSQL test database.

Actual Behavior

Integration tests fail with Prisma database connection errors:

Can't reach database server at 127.0.0.1:5432

The failures originate from tests/integration/stream-lifecycle.test.ts, which uses a real PostgreSQL database.

Screenshots

See attached GitHub Actions failure logs.

Environment

  • FlowFi Version: Current main branch
  • Browser: N/A
  • Operating System: GitHub Actions Linux runner (also reproducible locally without a configured test database)
  • Node.js Version: As configured by CI
  • Wallet: N/A

Component

  • Backend
  • Frontend
  • Smart Contracts
  • Documentation
  • Other (please specify)

Logs/Error Messages

PrismaClientInitializationError:

Can't reach database server at 127.0.0.1:5432

Please make sure your database server is running at 127.0.0.1:5432

Test file:

tests/integration/stream-lifecycle.test.ts

Additional Context

The test file explicitly states that it uses a real PostgreSQL database:

/**
 * These tests use real Postgres database
 */

and falls back to:

postgresql://postgres:password@127.0.0.1:5432/flowfi_test

when DATABASE_URL is not provided.

The issue is currently causing backend CI failures on the default branch.

Possible Solution

Investigate the CI test environment and ensure that:

  • PostgreSQL is started and healthy before integration tests run, or
  • DATABASE_URL is configured correctly in CI, or
  • Integration tests that require a real database are gated behind explicit setup steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions