diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchOfEntities/D012_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchOfEntities/D012_01_exc.robot index 443e6865f0e5e3ae023ed45486b8d8fe8b8644eb..d6c14efe003e20fce6313ac36e560b2521c91643 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchOfEntities/D012_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/CreateBatchOfEntities/D012_01_exc.robot @@ -18,7 +18,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour ${entity_payload_filename} vehicle-simple-attributes.jsonld ${entity_speed_payload_filename} vehicle-speed-attribute.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** @@ -59,7 +59,8 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/DeleteBatchOfEntities/D015_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/DeleteBatchOfEntities/D015_01_exc.robot index b00be3e83fde278a50e0ffde20c42a26680f7303..53af542f898a0e3f5cd5d8e63c0ac802e7ea48ae 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/DeleteBatchOfEntities/D015_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/DeleteBatchOfEntities/D015_01_exc.robot @@ -11,9 +11,9 @@ Resource ${EXECDIR}/resources/MockServerUtils.resource Test Setup Create Entities And Registration And Start Context Source Mock Server Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** -${entity_payload_filename} vehicle-simple-different-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes-second.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** D015_01_exc Delete Batch Of Entities On Both Context Broker And Context Source @@ -54,7 +54,8 @@ Create Entities And Registration And Start Context Source Mock Server ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response}= Create Context Source Registration With Return ${registration_payload} diff --git a/data/csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..5961a60538e7c465629356059fa2b48d1b5f8cc4 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld @@ -0,0 +1,29 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle" + } + ], + "propertyNames":["speed"] + }, + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID2", + "type": "Vehicle" + } + ], + "propertyNames":["speed"] + } + ], + "operations": ["redirectionOps", "createBatch", "upsertBatch", "updateBatch", "deleteBatch", "mergeBatch"], + "endpoint": "http://my.csource.org:1026/", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/resources/ApiUtils/ContextSourceRegistration.resource b/resources/ApiUtils/ContextSourceRegistration.resource index 5263add93348be2015d956f6ab1daca29b9eef09..6c334031edaa76c49c85527b2f555477c8413a16 100755 --- a/resources/ApiUtils/ContextSourceRegistration.resource +++ b/resources/ApiUtils/ContextSourceRegistration.resource @@ -33,6 +33,7 @@ Prepare Context Source Registration From File ... ${endpoint}=${EMPTY} ... ${broker_url}=${EMPTY} ... ${operations}=[] + ... ${entity_id2}=${EMPTY} ${payload}= Load JSON From File ${EXECDIR}/data/${registration_file} ${final_context_source_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${context_source_url} @@ -51,6 +52,13 @@ Prepare Context Source Registration From File ... $..entities[*] ... ${dict} END + IF '${entity_id2}' != '' + ${dict}= Create Dictionary id=${entity_id2} + ${registration_payload}= Add Object To JSON + ... ${registration_payload} + ... $.information[1].entities[*] + ... ${dict} + END IF '${entity_id_pattern}' != '' ${dict}= Create Dictionary idPattern=${entity_id_pattern} ${registration_payload}= Add Object To JSON diff --git a/testsuite-doubts.md b/testsuite-doubts.md index 50417d0d9ed842c484c57b911fbd007b17b2d9cc..7d43af9b7aeeab1c127a8bcdef8857fa2d167cf6 100644 --- a/testsuite-doubts.md +++ b/testsuite-doubts.md @@ -2667,3 +2667,40 @@ doesn't match the URL id. `$.id` with the actual `${entity_id}` before PATCHing. Or omit the `id` from the fragment entirely (PATCH attrs doesn't need it). + + +## 95. `D012_01_exc` / `D015_01_exc` — missed by the § 9.3.3 exclusive-pinning sweep; their setup failures leak entities into D001/D011 + +**Hit (full-suite runs):** both tests fail in setup — the CSR create returns +400 (`exclusive Registration 'entities[]' entry must specify a specific +'id'`), and for D015 (after pinning) 409 (`registration overlaps with +locally-stored entity`). Because setup aborts before the test body sets its +suite variables, the teardown crashes (`Variable '@{expected_entities_ids}' +not found` / 404 on the registration delete) and the two `local=true` +entities created in setup are never removed. Those leaked Vehicles then +surface in every later unpinned `type=Vehicle` query — +`D001_01_inc` / `D001_02_inc` / `D001_03_03_inc` fail with +`Lengths are different: 1 != 5`. + +**Analysis:** the exclusive-mode batch tests were restructured to satisfy +TS 104-175 § 9.3.3 (an exclusive registration shall pin specific entity ids; +the broker also rejects an exclusive claim over an entity it stores locally +with the claimed Attribute): `D013_*_exc` / `D014_*_exc` / `D016_01_exc` use +`entity_id=` + `entity_id2=` and the two-information-group fixture +`context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld`, +and seed their local twins without the exclusively-claimed `speed`. +`D012_01_exc` and `D015_01_exc` were missed by that sweep and still used +`entity_id_pattern=urn:ngsi-ld:Vehicle:*` (D015 additionally seeding local +twins WITH `speed` — `vehicle-simple-different-attributes.jsonld`). + +**Fix:** same recipe as the sweep — + +- both tests register with `entity_id=` + `entity_id2=` and the + `…-with-batch-ops-exclusive.jsonld` fixture; +- D015's local twins switch to `vehicle-simple-attributes-second.jsonld` + (no `speed`), so the exclusive claim doesn't overlap locally-stored + Attributes. + +(The `entity_id2=` keyword support and the exclusive fixture are +re-declared identically to their origin branch since that MR is unmerged — +git deduplicates on merge.)