-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
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
Fixing Postgres tests #2250
base: as-postgres
Are you sure you want to change the base?
Fixing Postgres tests #2250
Conversation
In case I don't finish this PR today, @LuiggiTenorioK , this PR includes work to fix But the idea for the tests, would be,
# integration/database/conftest.py
@pytest.fixture(scope='function', autouse=True)
def as_pg_fixture...():
with PostgresContainer('postgres:16', port=??, username: 'autosubmit', ...) as postgres:
psql_url = postgres.get_connection_url()
# create AS objects, or update the connection setting, etc... using data for container above if needed
yield postgres
# integration/database/some_test.py
def test_something():
# every function in every test under integration/database/<FILE> should
# have a database created -- if needed, we can set the scope to module, but
# I think if we don't have hundreds of tests it should be executed in < 3 mins?
... Then, a developer can run this locally with But in reality, developers will run |
@kinow this looks quite interesting! Hope you make this work before leaving on holidays 🤞 Anyway I could try to fix it later. The only thing that makes me worry is the high number of changes, which I hope doesn't make the main PostgreSQL branch hard to review. However, I could split the PR into 2 in the future to make it easier to review, if needed. |
You are correct, @LuiggiTenorioK . It'd probably be easier for me to rebase this against master, remove the postgres changes, and get this merged separately (as this is not directly related to PG). But I will have to fix this once I'm back (definitely no time to finish that today). FTR, here's an example we have in the code, of what I showed above, although that is not a fixture: autosubmit/test/integration/test_paramiko_platform.py Lines 120 to 143 in 53b2a14
👋 |
Will try to continue tomorrow and finish before the end of the day on Friday.
autosubmit_config
, test with a real experimentdatabase
package (in tests)