Skip to content

Commit

Permalink
[CDF-21996] Make sdk data workflows test more robust (#1835)
Browse files Browse the repository at this point in the history
Initially, only a single execution was created for the test suite, which always was successful before the fixture dependant tests ran. Now, however, there's multiple executions and some are not terminal yet. To fix the test, we just select the first completed (i.e., now immutable) execution.
  • Loading branch information
VerstraeteBert authored Jul 4, 2024
1 parent d84b497 commit 2aa4995
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/tests_integration/test_api/test_data_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,12 @@ def test_retrieve_workflow_execution_detailed(
cognite_client: CogniteClient,
workflow_execution_list: WorkflowExecutionList,
) -> None:
assert workflow_execution_list, "There should be at least one workflow execution to test retrieve detailed with"
retrieved = cognite_client.workflows.executions.retrieve_detailed(workflow_execution_list[0].id)

assert retrieved.as_execution().dump() == workflow_execution_list[0].dump()
workflow_execution_completed = cognite_client.workflows.executions.list(statuses="completed", limit=1)
assert (
workflow_execution_completed
), "There should be at least one workflow execution to test retrieve detailed with"
retrieved = cognite_client.workflows.executions.retrieve_detailed(workflow_execution_completed[0].id)
assert retrieved.as_execution().dump() == workflow_execution_completed[0].dump()
assert retrieved.executed_tasks

def test_retrieve_non_existing_workflow_execution(self, cognite_client: CogniteClient) -> None:
Expand Down

0 comments on commit 2aa4995

Please sign in to comment.