Skip to content

fix(modules): Fix postgres deprecation warning. - #883

Closed
surister wants to merge 2 commits into
testcontainers:mainfrom
surister:fix_postgres
Closed

fix(modules): Fix postgres deprecation warning.#883
surister wants to merge 2 commits into
testcontainers:mainfrom
surister:fix_postgres

Conversation

@surister

Copy link
Copy Markdown
Contributor

Removed the wait_container_is_ready decorator as per deprecation warning into the new container.waiting_for

Remove the `wait_container_is_ready` decorator as per deprecation warning into the new `container.waiting_for`
@surister

Copy link
Copy Markdown
ContributorAuthor

The string database system is ready to accept connections is valid for all postgres versions from postgres:9 to postgres:18

@surister

surister commented Sep 30, 2025

Copy link
Copy Markdown
ContributorAuthor

I was testing this thoroughly and sometimes, maybe 1/10 runs this fails, the log successfully emits 'database system is ready...' and the waiting strategy picks it up but still the database is not ready.

<re.Match object; span=(1342, 1388), match='database system is ready to accept connections'>
... we try connect in _connect
ExecResult(exit_code=2, output=b'psql: error: connection to server at "127.0.0.1", port 5432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\n')

Adding a 1s sleep in the _connect makes this go away, the funny thing is that postgres says it's ready when it's actually not.

@codecov

codecovBot commented Oct 5, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.78%. Comparing base (bb646e9) to head (f0a2ee6).

Additional details and impacted files
@@ Coverage Diff @@## main #883 +/- ##
=======================================
Coverage 79.78% 79.78% =======================================
Files 14 14 Lines 1182 1182 Branches 184 184 =======================================
Hits 943 943 Misses 197 197 Partials 42 42 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@surister

surister commented Oct 5, 2025

Copy link
Copy Markdown
ContributorAuthor

Pipeline failing due to missing import (bad cherrypicking on my part 🥲) Anyway, will close this and properly migrate the module once #892 is finished.

@suristersurister closed this Oct 5, 2025
@jankatins

Copy link
Copy Markdown
Contributor

I guess this could be done with a healthcheck waiting strategy or by adding a new waiting strategy which runs a function or runs a command with sh in the container

@alexanderankin

alexanderankin commented Oct 18, 2025 via email

Copy link
Copy Markdown
Member

Sign up for freeto 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.

4 participants

@surister@jankatins@alexanderankin@Tranquility2