From 79054b28cb450bb82225daae8dc9cb5263156108 Mon Sep 17 00:00:00 2001 From: Ivan Kalinovski Date: Mon, 23 Dec 2024 16:52:57 +0200 Subject: [PATCH] [Core] Add retry for failed upserts and handle circular dependencies 1. Fix lint 2. change order of assert in test --- .../sonarqube/examples/project.entity.json | 22 +++++++++---------- .../core/handlers/mixins/test_sync_raw.py | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/integrations/sonarqube/examples/project.entity.json b/integrations/sonarqube/examples/project.entity.json index 52ae086867..cc24ab6056 100644 --- a/integrations/sonarqube/examples/project.entity.json +++ b/integrations/sonarqube/examples/project.entity.json @@ -3,17 +3,17 @@ "title": "Port API", "team": [], "properties": { - "organization": "port-labs", - "link": "https://sonarcloud.io/project/overview?id=port-labs_Port_port-api", - "qualityGateStatus": "ERROR", - "numberOfBugs": 20, - "numberOfCodeSmells": 262, - "numberOfVulnerabilities": 0, - "numberOfHotSpots": 3, - "numberOfDuplications": 18, - "coverage": 0, - "mainBranch": "main" + "organization": "port-labs", + "link": "https://sonarcloud.io/project/overview?id=port-labs_Port_port-api", + "qualityGateStatus": "ERROR", + "numberOfBugs": 20, + "numberOfCodeSmells": 262, + "numberOfVulnerabilities": 0, + "numberOfHotSpots": 3, + "numberOfDuplications": 18, + "coverage": 0, + "mainBranch": "main" }, "relations": {}, "icon": "sonarqube" - } +} diff --git a/port_ocean/tests/core/handlers/mixins/test_sync_raw.py b/port_ocean/tests/core/handlers/mixins/test_sync_raw.py index 32ef6b2ede..7101e18a2d 100644 --- a/port_ocean/tests/core/handlers/mixins/test_sync_raw.py +++ b/port_ocean/tests/core/handlers/mixins/test_sync_raw.py @@ -375,10 +375,10 @@ def get_entities_wrapper(*args: Any, **kwargs: Any) -> Any: trigger_type="machine", user_agent_type=UserAgentType.exporter ) + assert event.entity_topological_sorter.register_entity.call_count == 5 assert ( len(event.entity_topological_sorter.entities) == 5 ), "Expected one failed entity callback due to retry logic" - assert event.entity_topological_sorter.register_entity.call_count == 5 assert event.entity_topological_sorter.get_entities.call_count == 1 assert len(raiesed_error_handle_failed) == 0 assert mock_ocean.port_client.client.post.call_count == 10 # type: ignore