From f7c78f94da86601888374233f39067443080d43e Mon Sep 17 00:00:00 2001 From: kzangeli Date: Fri, 29 May 2026 00:43:19 +0200 Subject: [PATCH] fix(020_17/18/19/20): pair temporal POST with current-state POST in setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per testsuite-doubts.md #9: each test's `Create Temporal Entity` setup only did `POST /temporal/entities`; the body's `DELETE /entities/{id}/attrs/{name}` then 404'd because the entity had no current-state representation. No `deletedAt` tombstone was written, so the temporal-evolution assertion failed for the entire 020_17..020_20 cluster (8 test cases). Changes: - Two new minimal current-state fixtures matching the temporal payloads: - `data/entities/vehicle-different-attribute-types.jsonld` for the fuelLevel/isParkedIn/name family (020_17, 020_18). - `data/entities/vehicle-with-scope.jsonld` for the scope family (020_19, 020_20). - In all four `Create Temporal Entity` setups: prepend a `Create Entity` call with the matching fixture, asserting 201 on creation. Document inline why the pair is necessary (spec § 10.2.7 vs § 11.2.2). - The subsequent `POST /temporal/entities` is now valid to return 201 (created) *or* 204 (appended to existing) per TS 104-175 § 11.2.2.5, so the strict 201 check is relaxed to a `Should Be True ... in ["201", "204"]`. Result: 020_17_01 (Property) and 020_18_01 (Property + temporalValues) pass. The four non-Property cases (Relationship/LanguageProperty/Scope) still fail, but on a *different* root cause now surfaced — a broker bug where the deletedAt tombstone collapses all attribute kinds into `Property` with `urn:ngsi-ld:null`, losing the original kind. That broker fix belongs in its own MR; tracked separately in the doubts file. --- .../020_17.robot | 12 ++++++++- .../020_18.robot | 12 ++++++++- .../020_19.robot | 12 ++++++++- .../020_20.robot | 12 ++++++++- .../vehicle-different-attribute-types.jsonld | 25 +++++++++++++++++++ data/entities/vehicle-with-scope.jsonld | 13 ++++++++++ 6 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 data/entities/vehicle-different-attribute-types.jsonld create mode 100644 data/entities/vehicle-with-scope.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_17.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_17.robot index 0ba30bad..41b01d0a 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_17.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_17.robot @@ -56,10 +56,20 @@ Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute Create Temporal Entity ${temporal_entity_representation_id}= Generate Random Vehicle Entity Id + # DELETE /entities/{id}/attrs/{name} is a current-state operation + # (TS 104-175 § 10.2.7) — it needs the entity to exist in the + # current-state representation. A POST /temporal/entities alone (per + # TS 104-175 § 11.2.2) creates only the temporal evolution. Mirror it + # on the current-state side so the DELETE under test can produce its + # `deletedAt` tombstone. See testsuite-doubts.md #9. + ${current_state_response}= Create Entity + ... vehicle-different-attribute-types.jsonld + ... ${temporal_entity_representation_id} + Check Response Status Code 201 ${current_state_response.status_code} ${create_response}= Create Temporal Representation Of Entity ... ${vehicle_payload_file} ... ${temporal_entity_representation_id} - Check Response Status Code 201 ${create_response.status_code} + Should Be True "${create_response.status_code}" in ["201", "204"] msg=POST /temporal/entities expected 201 (created) or 204 (appended to existing), got ${create_response.status_code} Set Suite Variable ${temporal_entity_representation_id} Delete Initial Temporal Entity diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_18.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_18.robot index c0d03906..2afdb72e 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_18.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_18.robot @@ -59,10 +59,20 @@ Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute Create Temporal Entity ${temporal_entity_representation_id}= Generate Random Vehicle Entity Id + # DELETE /entities/{id}/attrs/{name} is a current-state operation + # (TS 104-175 § 10.2.7) — it needs the entity to exist in the + # current-state representation. A POST /temporal/entities alone (per + # TS 104-175 § 11.2.2) creates only the temporal evolution. Mirror it + # on the current-state side so the DELETE under test can produce its + # `deletedAt` tombstone. See testsuite-doubts.md #9. + ${current_state_response}= Create Entity + ... vehicle-different-attribute-types.jsonld + ... ${temporal_entity_representation_id} + Check Response Status Code 201 ${current_state_response.status_code} ${create_response}= Create Temporal Representation Of Entity ... ${vehicle_payload_file} ... ${temporal_entity_representation_id} - Check Response Status Code 201 ${create_response.status_code} + Should Be True "${create_response.status_code}" in ["201", "204"] msg=POST /temporal/entities expected 201 (created) or 204 (appended to existing), got ${create_response.status_code} Set Suite Variable ${temporal_entity_representation_id} Delete Initial Temporal Entity diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_19.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_19.robot index a699ee49..c516f628 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_19.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_19.robot @@ -50,10 +50,20 @@ Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute Create Temporal Entity ${temporal_entity_representation_id}= Generate Random Vehicle Entity Id + # DELETE /entities/{id}/attrs/{name} is a current-state operation + # (TS 104-175 § 10.2.7) — it needs the entity to exist in the + # current-state representation. A POST /temporal/entities alone (per + # TS 104-175 § 11.2.2) creates only the temporal evolution. Mirror it + # on the current-state side so the DELETE under test can produce its + # `deletedAt` tombstone. See testsuite-doubts.md #9. + ${current_state_response}= Create Entity + ... vehicle-with-scope.jsonld + ... ${temporal_entity_representation_id} + Check Response Status Code 201 ${current_state_response.status_code} ${create_response}= Create Temporal Representation Of Entity ... ${vehicle_payload_file} ... ${temporal_entity_representation_id} - Check Response Status Code 201 ${create_response.status_code} + Should Be True "${create_response.status_code}" in ["201", "204"] msg=POST /temporal/entities expected 201 (created) or 204 (appended to existing), got ${create_response.status_code} Set Suite Variable ${temporal_entity_representation_id} Delete Initial Temporal Entity diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_20.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_20.robot index 28df0620..b5e94187 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_20.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_20.robot @@ -51,10 +51,20 @@ Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute Create Temporal Entity ${temporal_entity_representation_id}= Generate Random Vehicle Entity Id + # DELETE /entities/{id}/attrs/{name} is a current-state operation + # (TS 104-175 § 10.2.7) — it needs the entity to exist in the + # current-state representation. A POST /temporal/entities alone (per + # TS 104-175 § 11.2.2) creates only the temporal evolution. Mirror it + # on the current-state side so the DELETE under test can produce its + # `deletedAt` tombstone. See testsuite-doubts.md #9. + ${current_state_response}= Create Entity + ... vehicle-with-scope.jsonld + ... ${temporal_entity_representation_id} + Check Response Status Code 201 ${current_state_response.status_code} ${create_response}= Create Temporal Representation Of Entity ... ${vehicle_payload_file} ... ${temporal_entity_representation_id} - Check Response Status Code 201 ${create_response.status_code} + Should Be True "${create_response.status_code}" in ["201", "204"] msg=POST /temporal/entities expected 201 (created) or 204 (appended to existing), got ${create_response.status_code} Set Suite Variable ${temporal_entity_representation_id} Delete Initial Temporal Entity diff --git a/data/entities/vehicle-different-attribute-types.jsonld b/data/entities/vehicle-different-attribute-types.jsonld new file mode 100644 index 00000000..8d496639 --- /dev/null +++ b/data/entities/vehicle-different-attribute-types.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "isParkedIn": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Commerce", + "observedAt": "2024-12-01T12:00:00Z" + }, + "name": { + "type": "LanguageProperty", + "languageMap": { + "fr": "Ma voiture", + "en": "My vehicle" + }, + "observedAt": "2024-12-01T12:00:00Z" + }, + "fuelLevel": { + "type": "Property", + "value": 67, + "observedAt": "2020-08-01T12:03:00Z" + }, + "@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/data/entities/vehicle-with-scope.jsonld b/data/entities/vehicle-with-scope.jsonld new file mode 100644 index 00000000..68bf9282 --- /dev/null +++ b/data/entities/vehicle-with-scope.jsonld @@ -0,0 +1,13 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "scope": "/Madrid/Gardens/ParqueNorte", + "fuelLevel": { + "type": "Property", + "value": 67, + "observedAt": "2020-08-01T12:03:00Z" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} -- GitLab