Commit d5ed03c3 authored by kzangeli's avatar kzangeli
Browse files

fix(local): D002_02_01_inc / D002_02_02_inc expect 204, not 207

Both tests do an inclusive Delete Entity where one leg returns 404 and
expect a 207 BatchOperationResult surfacing that 404. That contradicts
the operation definition.

TS 104-175 § 10.2.8.4 (Delete Entity behaviour):
- ResourceNotFound is reserved for total absence — "no existing Entity
  held locally, AND no matching registrations apply". A matching
  inclusive registration exists here, so this never fires.
- For inclusive matches the request "is also forwarded ... The input
  data shall be used to remove the entity locally if it exists."

So a 404 from one inclusive Context Source (which simply does not hold
the entity — inclusive registrations are commonly by entity type, and
not every entity of a type lives on every source) is not in the error
model, and local absence is explicitly a non-error ("if it exists").
The delete succeeds → 204 No Content.

- D002_02_01_inc: entity exists locally, CSR returns 404 → 204.
- D002_02_02_inc: entity absent locally, CSR deletes it (204) → 204.

The only text pulling toward 207 is the coarse HTTP-binding rule in
TS 104-176 § 6.3.5 ("inclusive + an error response from one or more
sources → 207"); § 10.2.8.4 (normative behaviour) takes precedence and
backs 204. Broker is correct; expectations corrected. See forge issue
#105 (spec-discussion). Local branch only, no MR.
parent 36cf748b
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -21,12 +21,11 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi

*** Test Cases ***
D002_02_01_inc Delete Entity On The Context Broker
    [Documentation]    Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities locally and should get a BatchOperationResult structure
    [Documentation]    Verify that, when one has an inclusive registration on a Context Broker, one is able to delete an entity that exists locally. A 404 from an inclusive Context Source that simply does not hold the entity is not an error (TS 104-175 § 10.2.8.4 reserves ResourceNotFound for the case where neither the broker nor any registration knows the entity), so the operation returns 204 No Content.
    [Tags]    since_v1.6.1    dist-ops    4_3_3    cf_06    additive-inclusive    4_3_6_2    5_6_6    6_3_3
    Set Stub Reply    DELETE    /ngsi-ld/v1/entities/${entity_id}    404
    ${response}=    Delete Entity    ${entity_id}
    Check Response Status Code    207    ${response.status_code}
    Check JSON Value In Response Body    ['status']    404    ${response.json()['errors'][0]['error']}
    Check Response Status Code    204    ${response.status_code}

    ${response_retrieve}=    Retrieve Entity    ${entity_id}    local=true
    Check Response Status Code    404    ${response_retrieve.status_code}
+2 −6
Original line number Diff line number Diff line
@@ -21,15 +21,11 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi

*** Test Cases ***
D002_02_02_inc Delete Entity On A Context Source
    [Documentation]    Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities on a Context Source and should get a BatchOperationResult structure
    [Documentation]    Verify that, when one has an inclusive registration on a Context Broker, one is able to delete an entity that lives on a Context Source. The entity is absent locally and the inclusive Context Source deletes it successfully; per TS 104-175 § 10.2.8.4 ("remove the entity locally if it exists") local absence is not an error, so the operation returns 204 No Content.
    [Tags]    since_v1.6.1    dist-ops    4_3_3    cf_06    additive-inclusive    4_3_6_2    5_6_6    6_3_3
    Set Stub Reply    DELETE    /ngsi-ld/v1/entities/${entity_id}    204
    ${response}=    Delete Entity    ${entity_id}
    Check Response Status Code    207    ${response.status_code}

    Check JSON Value In Response Body    ['status']    404    ${response.json()['errors'][0]['error']}
    ${length}=    Get Length    ${response.json()['errors']}
    Should Be Equal As Integers    ${length}    1
    Check Response Status Code    204    ${response.status_code}


*** Keywords ***