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

Tests: Manually stop daemon after verdi devel revive test #5689

Merged
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
2 changes: 2 additions & 0 deletions .github/workflows/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ verdi computer test slurm-ssh --print-traceback

verdi profile setdefault test_aiida
verdi config set runner.poll.interval 0
verdi config set warnings.development_version False
verdi config set warnings.rabbitmq_version False
5 changes: 5 additions & 0 deletions aiida/manage/tests/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ def create_profile(self):
if created:
user.store()
profile.default_user_email = user.email

# Set options to suppress certain warnings
config.set_option('warnings.development_version', False)
config.set_option('warnings.rabbitmq_version', False)

config.store()

def repo_ok(self):
Expand Down
1 change: 0 additions & 1 deletion aiida/manage/tests/pytest_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ def test_1(aiida_localhost):
computer.store()
computer.set_minimum_job_poll_interval(0.)
computer.set_default_mpiprocs_per_machine(1)
computer.set_default_memory_per_machine(100000)
computer.configure()

return computer
Expand Down
9 changes: 7 additions & 2 deletions tests/cmdline/commands/test_devel.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def test_revive_without_daemon(run_cli_command):
assert run_cli_command(cmd_devel.devel_revive, raises=True)


@pytest.mark.usefixtures('aiida_profile', 'started_daemon_client')
def test_revive(run_cli_command, monkeypatch, aiida_local_code_factory, submit_and_await):
@pytest.mark.usefixtures('aiida_profile')
def test_revive(run_cli_command, monkeypatch, aiida_local_code_factory, submit_and_await, started_daemon_client):
"""Test ``verdi devel revive``."""
code = aiida_local_code_factory('core.arithmetic.add', '/bin/bash')
builder = code.get_builder()
Expand All @@ -56,3 +56,8 @@ def test_revive(run_cli_command, monkeypatch, aiida_local_code_factory, submit_a
# should timeout and raise an exception
submit_and_await(node, ProcessState.FINISHED)
assert node.is_finished_ok

# Need to manually stop the daemon such that it cleans all state related to the submitted processes. It is not quite
# understood how, but leaving the daemon running, a following test that will submit to the daemon may hit an
# an exception because the node submitted here would no longer exist and the daemon would try to operate on it.
started_daemon_client.stop_daemon(wait=True)
7 changes: 5 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def reset_log_level():


@pytest.fixture
def submit_and_await():
def submit_and_await(daemon_client):
"""Submit a process and wait for it to achieve the given state."""

def _factory(
Expand Down Expand Up @@ -548,8 +548,11 @@ def _factory(
raise RuntimeError(f'The process excepted: {node.exception}')

if time.time() - start_time >= timeout:
daemon_log_file = pathlib.Path(daemon_client.daemon_log_file).read_text(encoding='utf-8')
daemon_status = 'running' if daemon_client.is_daemon_running else 'stopped'
raise RuntimeError(
f'Timed out waiting for process with state `{node.process_state}` to enter state `{state}`.'
f'Timed out waiting for process with state `{node.process_state}` to enter state `{state}`.\n'
f'Daemon <{daemon_client.profile.name}|{daemon_status}> log file content: \n{daemon_log_file}'
)

return node
Expand Down