From bf4cc5a181cb0081d8146f202129cffb1de61c2c Mon Sep 17 00:00:00 2001 From: Bert Verstraete Date: Thu, 30 May 2024 15:49:16 +0200 Subject: [PATCH] Remove sessions cleaning for data workflows tests (#1788) Sessions are revoked by data workflows. No need to revoke the sessions after tests anymore. --- .../test_api/test_data_workflows.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/tests_integration/test_api/test_data_workflows.py b/tests/tests_integration/test_api/test_data_workflows.py index 197bd5e10e..680d55b353 100644 --- a/tests/tests_integration/test_api/test_data_workflows.py +++ b/tests/tests_integration/test_api/test_data_workflows.py @@ -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( @@ -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, @@ -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: