Skip to content
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

Update CI so that it does not start fractal-server from within Python #697

Closed
tcompa opened this issue Sep 11, 2024 · 0 comments · Fixed by #717
Closed

Update CI so that it does not start fractal-server from within Python #697

tcompa opened this issue Sep 11, 2024 · 0 comments · Fixed by #717
Assignees
Labels

Comments

@tcompa
Copy link
Collaborator

tcompa commented Sep 11, 2024

The reason for this became more clear while working on #695, where we noticed that not starting the server in the standard way (which includes calling the fractal_server.__main__.set_db function) may lead to inconsistencies.


First plan would be:

  1. We have a bash script that starts up a daemon server instance - similar to https://github.com/fractal-analytics-platform/fractal-server/blob/main/benchmarks/serve.sh, with additional setup of env variables and with poetry run fractalctl set-db.
  2. Note that the script above should also dropdb --if-exists and createdb for the test_fractal_client db
  3. pytest does not run this bash script above. This has to be already running, or pytest will fail.
  4. A session-scoped fixture should call the /alive endpoint (up to a few times, with 1 second of delay), and fail if no attempt succeeds
  5. backend should be on 8765, which is hardcoded both in bash script and pytest configuration
  6. No test should rely on absolute counts of db objects
  7. All tests should have access to a unique identifier, to be used e.g. in new-db-object names (to avoid violating uniqueness constraints). First option: integer timestamp. If more is needed, we can have a function-scoped fixture with a global counter, that grows by one every time it's called. Or something else.
  8. No test should make assumptions on the pre-existing database state. Tests should create all necessary objects, and make assertions only about those.
  9. No test can access the db directly. The current ones that do so (if any) should be refactored. This also means we cannot use current factories.
  10. Perhaps include https://github.com/pytest-dev/pytest-randomly
@tcompa tcompa added the testing label Sep 11, 2024
@tcompa tcompa changed the title Update CI so that it does not start fractal-server from within Python - TBD Update CI so that it does not start fractal-server from within Python Sep 25, 2024
@ychiucco ychiucco linked a pull request Oct 22, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

2 participants