Skip to content

Commit

Permalink
Remove sessions cleaning for data workflows tests (#1788)
Browse files Browse the repository at this point in the history
Sessions are revoked by data workflows. No need to revoke the sessions after tests anymore.
  • Loading branch information
VerstraeteBert authored May 30, 2024
1 parent 90b1d5e commit bf4cc5a
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions tests/tests_integration/test_api/test_data_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,6 @@ def workflow_execution_list(
return cognite_client.workflows.executions.list(workflow_version_ids=add_multiply_workflow.as_id(), limit=5)


@pytest.fixture()
def clean_created_sessions(cognite_client: CogniteClient) -> None:
existing_active_sessions = cognite_client.iam.sessions.list(status="active", limit=-1)
yield None
current_sessions = cognite_client.iam.sessions.list(status="active", limit=-1)
existing_ids = {session.id for session in existing_active_sessions}
to_revoked = [session.id for session in current_sessions if session.id not in existing_ids]
cognite_client.iam.sessions.revoke(to_revoked)


class TestWorkflows:
def test_upsert_delete(self, cognite_client: CogniteClient) -> None:
workflow = WorkflowUpsert(
Expand Down Expand Up @@ -388,9 +378,6 @@ def test_retrieve_non_existing_workflow_execution(self, cognite_client: CogniteC

assert non_existing is None

# Each trigger creates a new execution, so we need to clean up after each test to avoid
# running out of quota
@pytest.mark.usefixtures("clean_created_sessions")
def test_trigger_retrieve_detailed_update_update_task(
self,
cognite_client: CogniteClient,
Expand All @@ -411,7 +398,6 @@ def test_trigger_retrieve_detailed_update_update_task(
async_task = cognite_client.workflows.tasks.update(async_task.id, "completed")
assert async_task.status == "completed"

@pytest.mark.usefixtures("clean_created_sessions")
def test_trigger_cancel_retry_workflow(
self, cognite_client: CogniteClient, add_multiply_workflow: WorkflowVersion
) -> None:
Expand Down

0 comments on commit bf4cc5a

Please sign in to comment.