Commit f7c78f94 authored by kzangeli's avatar kzangeli
Browse files

fix(020_17/18/19/20): pair temporal POST with current-state POST in setup

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.
parent aed085be
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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
+11 −1
Original line number Diff line number Diff line
@@ -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
+11 −1
Original line number Diff line number Diff line
@@ -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
+11 −1
Original line number Diff line number Diff line
@@ -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
+25 −0
Original line number Diff line number Diff line
{
  "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"
  ]
}
Loading