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

Fix false positive for verdi database integrity detect-invalid-links #3591

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
25 changes: 25 additions & 0 deletions aiida/backends/tests/cmdline/commands/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,31 @@
class TestVerdiDatabasaIntegrity(AiidaTestCase):
"""Tests for `verdi database integrity`."""

@classmethod
def setUpClass(cls, *args, **kwargs):
"""Create a basic valid graph that should help detect false positives."""
super(TestVerdiDatabasaIntegrity, cls).setUpClass(*args, **kwargs)
data_input = Data().store()
data_output = Data().store()
calculation = CalculationNode()
workflow_parent = WorkflowNode()
workflow_child = WorkflowNode()

workflow_parent.add_incoming(data_input, link_label='input', link_type=LinkType.INPUT_WORK)
workflow_parent.store()

workflow_child.add_incoming(data_input, link_label='input', link_type=LinkType.INPUT_WORK)
workflow_child.add_incoming(workflow_parent, link_label='call', link_type=LinkType.CALL_WORK)
workflow_child.store()

calculation.add_incoming(data_input, link_label='input', link_type=LinkType.INPUT_CALC)
calculation.add_incoming(workflow_child, link_label='input', link_type=LinkType.CALL_CALC)
calculation.store()

data_output.add_incoming(calculation, link_label='output', link_type=LinkType.CREATE)
data_output.add_incoming(workflow_child, link_label='output', link_type=LinkType.RETURN)
data_output.add_incoming(workflow_parent, link_label='output', link_type=LinkType.RETURN)

def setUp(self):
self.cli_runner = CliRunner()

Expand Down
2 changes: 1 addition & 1 deletion aiida/manage/database/integrity/sql/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
JOIN db_dblink AS link ON node_in.id = link.input_id
JOIN db_dbnode AS node_out ON node_out.id = link.output_id
WHERE node_in.node_type LIKE 'process.calculation%'
AND link.type = 'call_calc' OR link.type = 'call_work';
AND (link.type = 'call_calc' OR link.type = 'call_work');
"""

SELECT_CALCULATIONS_WITH_OUTGOING_RETURN = """
Expand Down