Closed portante closed 1 year ago
The cause seems to be that the Database.db_session
somehow becomes None
. The problem doesn't happen every time, so presumably it's due to some sort of interference from another test running in parallel. 🤷
My suspicion is that it's implicitly depending on someone else's client
or db_session
fixture, but doesn't specify that dependency itself. In the CI parallel runs, it sometimes gets scheduled into a session where nobody else has done the setup, and fails.
E.g., note that the client
fixture calls create_app
which opens the database, and then app.app_context()
, while these tests just call app.app_context()
.
I decided to take a look at this, because it's causing repeated pain. I'm pretty sure I've verified my suspicion:
pytest -k test_verify_auth_oidc_user_update lib/pbench/test/unit/server/auth/test_auth.py
Fails reliably by isolating just that failing test.
Adding the db_session
fixture explicitly makes it work. I'm going to figure out which other test cases require DB setup, and I'll push a PR.
I re-triggered. We've seen this unit test failure before; it'd be great to figure out why and fix it...
Originally posted by @dbutenhof in https://github.com/distributed-system-analysis/pbench/issues/3380#issuecomment-1507233423