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

CI: Add matrix testing for both SQLite and PostgreSQL database backends #6670

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/ci-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.9', '3.12']
database-backend: [psql]
include:
- python-version: '3.9'
database-backend: sqlite

services:
postgres:
Expand Down Expand Up @@ -79,7 +83,7 @@ jobs:
run: |
${{ matrix.python-version == '3.9' && 'unset CI' || '' }}
${{ matrix.python-version == '3.9' && 'VIRTUAL_ENV=$PWD/.venv' || '' }}
pytest -n auto --db-backend psql -m 'not nightly' tests/ ${{ matrix.python-version == '3.9' && '--cov aiida' || '' }}
pytest -n auto --db-backend ${{ matrix.database-backend }} -m 'not nightly' tests/ ${{ matrix.python-version == '3.9' && '--cov aiida' || '' }}

- name: Upload coverage report
if: matrix.python-version == 3.9 && github.repository == 'aiidateam/aiida-core'
Expand All @@ -90,7 +94,6 @@ jobs:
file: ./coverage.xml
fail_ci_if_error: false # don't fail job, if coverage upload fails


tests-presto:

runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion docs/source/reference/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ Below is a list with all available subcommands.
--broker-host HOSTNAME Hostname for the message broker. [default: 127.0.0.1]
--broker-port INTEGER Port for the message broker. [default: 5672]
--broker-virtual-host TEXT Name of the virtual host for the message broker without
leading forward slash.
leading forward slash. [default: ""]
--repository DIRECTORY Absolute path to the file repository.
--test-profile Designate the profile to be used for running the test
suite only.
Expand Down
2 changes: 1 addition & 1 deletion tests/cmdline/commands/test_rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_tasks_revive_without_daemon(run_cli_command):
assert run_cli_command(cmd_rabbitmq.cmd_tasks_revive, raises=True)


@pytest.mark.usefixtures('started_daemon_client')
@pytest.mark.usefixtures('aiida_profile_clean')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can solve the failed test, I think here the problem was caused by the rmq resource racing the queue might be cleaned by the previous test maybe??

When I run only this test in CI, the test will pass. Test only fail when it is run with other tests. I guess it is because the daemon_client is shared and the rmq queue is getting cleaned by other tests (high likely the previous one? it is easy to check by just run the test in this file).

But no matter what the cause is, the solution I think is make the daemon_client independent for this test by using aiida_profile_clean fixture which will close the daemon (which will call broker_reset that close the rmq before running the test).

def test_revive(run_cli_command, monkeypatch, aiida_code_installed, submit_and_await):
"""Test ``tasks revive``."""
code = aiida_code_installed(default_calc_job_plugin='core.arithmetic.add', filepath_executable='/bin/bash')
Expand Down
4 changes: 2 additions & 2 deletions tests/tools/archive/orm/test_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_that_solo_code_is_exported_correctly(aiida_profile, tmp_path, aiida_loc
assert orm.load_node(code_uuid).label == code_label


def test_input_code(aiida_profile, tmp_path, aiida_localhost):
def test_input_code(aiida_profile_clean, tmp_path, aiida_localhost):
"""This test checks that when a calculation is exported then the
corresponding code is also exported. It also checks that the links
are also in place after the import.
Expand All @@ -59,7 +59,7 @@ def test_input_code(aiida_profile, tmp_path, aiida_localhost):
export_file = tmp_path / 'export.aiida'
create_archive([calc], filename=export_file)

aiida_profile.reset_storage()
unkcpz marked this conversation as resolved.
Show resolved Hide resolved
aiida_profile_clean.reset_storage()

import_archive(export_file)

Expand Down
Loading