-
Notifications
You must be signed in to change notification settings - Fork 54
Testing
When working on unit tests for a REANA cluster component, please always use separate terminal window and separate Python virtual environment for each component in order not to mix dependencies.
For example:
$ cd ~/src/reana-server
$ mkvirtualenv _reana_server -p python3.12
$ pip install --upgrade pip
$ pip install '.[all]' --upgrade --use-feature=fast-deps
$ cd ~/src/reana-workflow-controller
$ mkvirtualenv _reana_server -p python3.12
$ pip install --upgrade pip
$ pip install '.[all]' --upgrade --use-feature=fast-deps
$ workon _reana_server
$ ./run-tests.sh
$ workon _reana_workflow_controller
$ ./run-tests.sh
The run-tests.sh
helper command has an option to run only those kind of tests
that you are interested in, for example Python tests:
$ workon _reana_server
$ ./run-tests.sh --check-pytest
Instead of creating virtual environments manually, you can also use the
reana-dev
helper script command to run all the tests for one or more
components automatically. This is mostly useful when reviewing code of a
component without actually working on the implementation or the tests. For
example:
$ reana-dev python-unit-tests -c r-j-controller -k
The above command will automatically create _reana-job-controller
virtual
environment in which the tests will be run. The option -k
will optionally
keep the environments after tests are finished for any eventual manual
inspection and editing.
If you encounter the error Resource 'api' has no operation 'new_endpoint'
while running a unit test that involves a new endpoint, follow these steps to resolve the issue:
-
Ensure that the new endpoint is included in the OpenAPI spec in both
reana-commons
and thereana-commons
module inreana-server
. -
Reinstall
reana-commons
with editable (-e
) mode in your virtual environment:cd reana-commons pip install -e .
-
Retry the unit test after reinstalling reana-commons.
REANA reproducible analysis platform
blog.reana.io | docs.reana.io | forum.reana.io | www.reana.io |
@gitter | @mattermost | @twitter
Introduction
Getting started
- Setting up your system
- Cloning sources
- Using production-like development mode
- Using live-code-reload and debug mode
Issue lifecycle
Understanding code base
Technology tips and tricks
- Tips for Docker
- Tips for Git
- Tips for GitLab
- Tips for Keycloak
- Tips for Kind
- Tips for Kubernetes
- Tips for OpenAPI
- Tips for PostgreSQL
- Tips for Python
- Tips for RabbitMQ
- Tips for SQLAlchemy