Skip to content

🧪 Stabilize several flaky tests - #7469

Draft
agoscinski wants to merge 1 commit into
aiidateam:mainfrom
agoscinski:test/flaky-get-info
Draft

🧪 Stabilize several flaky tests#7469
agoscinski wants to merge 1 commit into
aiidateam:mainfrom
agoscinski:test/flaky-get-info

Conversation

@agoscinski

Copy link
Copy Markdown
Collaborator

Reset the profile before test_get_info so the node creation timestamps are not affected by data created in earlier tests.

This avoids flaky assertions on the first and last created node reported by the storage backend.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The test_get_info backend test now uses the aiida_profile_clean fixture through a pytest marker.

Changes

Backend test fixture

Layer / File(s) Summary
Apply clean profile fixture
tests/storage/psql_dos/test_backend.py
Adds the aiida_profile_clean fixture marker to test_get_info.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is related to the change, though it overstates the scope by saying several tests instead of one.
Description check ✅ Passed The description matches the change by explaining the profile reset and the flaky timestamp assertions it fixes.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.54%. Comparing base (1242b6f) to head (92baa99).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7469      +/-   ##
==========================================
- Coverage   80.61%   80.54%   -0.06%     
==========================================
  Files         580      580              
  Lines       46757    46757              
==========================================
- Hits        37689    37657      -32     
- Misses       9068     9100      +32     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Reset the profile before `test_get_info` so the node creation
timestamps are not affected by data created in earlier tests.

This avoids flaky assertions on the first and last created node
reported by the storage backend.
@agoscinski
agoscinski force-pushed the test/flaky-get-info branch from 8c12de9 to 92baa99 Compare July 21, 2026 08:02
@agoscinski

Copy link
Copy Markdown
Collaborator Author

Flaky test

  FAILED tests/engine/processes/calcjobs/test_calc_job.py::test_monitor_result_action_disable_self - assert 0 == 1
   +  where 0 = len([])
  = 1 failed, 3810 passed, 51 skipped, 1 xfailed, 354 warnings in 1086.15s (0:18:06) =

@agoscinski agoscinski changed the title 🧪 Stabilize psql_dos get_info test 🧪 Stabilize several flaky tests Jul 21, 2026
@agoscinski
agoscinski marked this pull request as draft July 21, 2026 09:22
@agoscinski

Copy link
Copy Markdown
Collaborator Author

TODO add:
https://github.com/aiidateam/aiida-core/actions/runs/30903585802/job/91973420310?pr=7521

_______________________ test_change_workers_without_wait _______________________
[gw0] linux -- Python 3.14.6 /home/runner/work/aiida-core/aiida-core/.venv/bin/python3
tests/engine/daemon/test_client.py:414: in test_change_workers_without_wait
    assert response['status'] == 'ok'
E   AssertionError: assert 'error' == 'ok'
E     - ok
E     + error

@agoscinski

Copy link
Copy Markdown
Collaborator Author
___________________ test_monitor_result_action_disable_self ____________________
[gw0] linux -- Python 3.10.20 /home/runner/work/aiida-core/aiida-core/.venv/bin/python3
tests/engine/processes/calcjobs/test_calc_job.py:1322: in test_monitor_result_action_disable_self
    assert len([record for record in caplog.records if 'Disable self.' in record.message]) == 1
E   assert 0 == 1
E    +  where 0 = len([])

@agoscinski

Copy link
Copy Markdown
Collaborator Author
________________ test_processes_all_exclusivity[play_processes] ________________
[gw0] linux -- Python 3.10.20 /home/runner/work/aiida-core/aiida-core/.venv/bin/python3
tests/engine/processes/test_control.py:17: in test_processes_all_exclusivity
    node = submit_and_await(WaitProcess, ProcessState.WAITING)
src/aiida/tools/pytest_fixtures/daemon.py:136: in factory
    node = submit(submittable, **kwargs)
src/aiida/engine/launch.py:160: in submit
    process_inited = instantiate_process(runner, process, **inputs)
src/aiida/engine/utils.py:87: in instantiate_process
    process = process_class(runner=runner, inputs=inputs)
.venv/lib/python3.10/site-packages/plumpy/base/state_machine.py:205: in __call__
    inst.transition_to(inst.create_initial_state())
.venv/lib/python3.10/site-packages/plumpy/base/state_machine.py:357: in transition_to
    self.transition_failed(initial_state_label, label, *sys.exc_info()[1:])
.venv/lib/python3.10/site-packages/plumpy/processes.py:1092: in transition_failed
    raise exception.with_traceback(trace)
.venv/lib/python3.10/site-packages/plumpy/base/state_machine.py:343: in transition_to
    self._enter_next_state(new_state)
.venv/lib/python3.10/site-packages/plumpy/base/state_machine.py:414: in _enter_next_state
    self._fire_state_event(StateEventHook.ENTERED_STATE, last_state)
.venv/lib/python3.10/site-packages/plumpy/base/state_machine.py:311: in _fire_state_event
    callback(self, hook, state)
.venv/lib/python3.10/site-packages/plumpy/processes.py:358: in <lambda>
    state_machine.StateEventHook.ENTERED_STATE: lambda _s, _h, from_state: self.on_entered(
src/aiida/engine/processes/process.py:476: in on_entered
    self.node.set_process_state(self._state.LABEL)  # type: ignore[arg-type]
src/aiida/orm/nodes/process/process.py:365: in set_process_state
    return self.base.attributes.set(self.PROCESS_STATE_KEY, state)
src/aiida/orm/nodes/attributes.py:119: in set
    self._node._check_mutability_attributes([key])
src/aiida/orm/utils/mixins.py:220: in _check_mutability_attributes
    raise exceptions.ModificationNotAllowed('attributes of a sealed node are immutable')
E   aiida.common.exceptions.ModificationNotAllowed: attributes of a sealed node are immutable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant