| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,16 @@ | ||
| import sqlalchemy | ||
| from testcontainers.postgres import PostgresContainer | ||
|
|
||
|
|
||
| def test_docker_run_postgres(): | ||
| postgres_container = PostgresContainer("postgres:9.5") | ||
| with postgres_container as postgres: | ||
| engine = sqlalchemy.create_engine(postgres.get_connection_url()) | ||
| with engine.begin() as connection: | ||
| result = connection.execute(sqlalchemy.text("select version()")) | ||
| for row in result: | ||
| assert row[0].lower().startswith("postgresql 9.5") | ||
| # https://www.postgresql.org/support/versioning/ | ||
| supported_versions = ["11", "12", "13", "14", "latest"] | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualityplease add 15 and 16 and maybe remove 11 (not supported anymore)
Sorry, something went wrong.
All reactions
|
||
|
|
||
| for version in supported_versions: | ||
| postgres_container = PostgresContainer(f"postgres:{version}") | ||
| with postgres_container as postgres: | ||
| status, msg = postgres.exec( | ||
| f"pg_isready -hlocalhost -p{postgres.port} -U{postgres.username}" | ||
| ) | ||
|
|
||
| def test_docker_run_postgres_with_driver_pg8000(): | ||
| postgres_container = PostgresContainer("postgres:9.5", driver="pg8000") | ||
| with postgres_container as postgres: | ||
| engine = sqlalchemy.create_engine(postgres.get_connection_url()) | ||
| with engine.begin() as connection: | ||
| connection.execute(sqlalchemy.text("select 1=1")) | ||
| assert msg.decode("utf-8").endswith("accepting connections\n") | ||
| assert status == 0 | ||
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityLet's stick with 9.5 here. Pinning the version in the docs is to ensure that things don't accidentally break because one of the dependencies changed.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityAccording to https://www.postgresql.org/support/versioning/, 9.5 is not supported anymore, the oldest supported version is 11. My suggestion would be to go with 15 and then have another 5 years until the docs have to be changed... :-)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityMakes sense, let's bump to 15.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality... so now 16 :-)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.