fix(D010, D013, D016): distributed retrieve and batch assertions

  • D010_01_aux / D010_01_red: the local entity is created from the .jsonld fixtures (body @context), and D010_01_aux retrieves with the suite context and expects the compacted 'brandName', not its expanded IRI.
  • D010_01_exc: the stub count queried the by-type URL, never stubbed nor requested; it now counts the by-id stub the test registers. The speed check uses Dictionary Should Contain Key (Should Contain on a value).
  • D010_03_inc: the queryEntity leg is stubbed at /entities?id= - a query forwarded for one entity - and handled as retrieveEntity is.
  • D013_01_red / D013_02_red: the second registration was posted with the first one's id (409 AlreadyExists, the setup failed); it now uses ${registration_id2}, as D006_01_red does. The forwarded entities are compared without @context: the forwarded request may carry its context in the Link header (TS 104-176 clause 6.3.5).
  • D016_01_inc / D016_01_red: Should Contain ${response.json()} speed tested whether the string is an element of a list of entities; they now check the speed key of each entity. D016_01_red's mock sources reply with the merged entities, with their own @context.
  • HttpCtrl http_stub: a GET stub with no query parameters and no id matches on its decoded path, whatever optional parameters (pick, sysAttrs, ...) the broker adds to the forwarded request.

Tested - Against coraine, DistributedOperations (101 TCs): develop 60 pass / 41 fail, this branch 66 / 35 - D010_01_red, D010_03_inc_02, D013_01_red, D013_02_red, D016_01_inc, D016_01_red; nothing else changed.

🤖 Generated with Claude Code

Edited by Ken Zangelin

Merge request reports

Loading
+3 −3
Changes for TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_aux.robot: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -15,11 +15,11 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour


*** Variables ***
${entity_payload_filename}              vehicle-simple-attributes.json
${entity_payload_filename}              vehicle-simple-attributes.jsonld
${entity_payload_filename2}             vehicle-simple-attributes-second.jsonld
${registration_payload_file_path}       csourceRegistrations/context-source-registration-vehicle-complete.jsonld
${fragment_filename}                    vehicle-brandname-fragment.json
${expected_attribute}                   https://ngsi-ld-test-suite/context#brandName
${expected_attribute}                   brandName


*** Test Cases ***
@@ -35,7 +35,7 @@ D010_01_aux Retrieve Entity That Exists On Both The Context Source And The Conte
    # mock ends up sending headers only). Serialise to a JSON string first.
    ${entity_body_json}=    Evaluate    json.dumps($entity_body)    json
    Set Stub Reply    GET    /ngsi-ld/v1/entities/${entity_id}    200    ${entity_body_json}
    ${response}=    Retrieve Entity    ${entity_id}
    ${response}=    Retrieve Entity    ${entity_id}    context=${ngsild_test_suite_context}

    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing an Attribute set to
+2 −4
Changes for TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_exc.robot: 2 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -32,12 +32,10 @@ D010_01_exc Query Context Broker And Retrieve Entity By Id
    ${response}=    Retrieve Entity    ${entity_id}    context=${ngsild_test_suite_context}
    Check Response Status Code    200    ${response.status_code}

    ${stub_count}=    Get Stub Count    GET    /broker1/ngsi-ld/v1/entities?type=Vehicle
    ${stub_count}=    Get Stub Count    GET    /broker1/ngsi-ld/v1/entities/${entity_id}
    Should Be True    ${stub_count} > 0

    ${body}=    Get From Dictionary    ${response.json()}    speed
    Should Contain    ${body}    speed

    Dictionary Should Contain Key    ${response.json()}    speed

*** Keywords ***
Create Entity And Registration On The Context Broker And Start Context Source Mock Server
+2 −2
Changes for TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_01_red.robot: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour

*** Variables ***
${entity_id_prefix}                     urn:ngsi-ld:Vehicle:
${entity_payload_filename}              vehicle-simple-attributes.json
${entity_payload_filename2}             vehicle-simple-attributes-second.json
${entity_payload_filename}              vehicle-simple-attributes.jsonld
${entity_payload_filename2}             vehicle-simple-attributes-second.jsonld
${registration_id_prefix}               urn:ngsi-ld:Registration:
${registration_payload_file_path}       csourceRegistrations/context-source-registration-vehicle-redirection-ops.jsonld

+2 −2
Changes for TP/NGSI-LD/DistributedOperations/Consumption/Entity/RetrieveEntity/D010_03_inc.robot: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ D010_03_inc_01 Retrieve Entity By Id Using The retrieveEntity Operation
D010_03_inc_02 Retrieve Entity By Id Using The queryEntity Operation
    [Documentation]    Check that if one retrieves entity living on a Context Source from a Context Broker, and the registration only allows the queryEntity operation, the request is forwarded as expected
    [Tags]    since_v1.6.1    dist-ops    core_4_3_3    cf_04    additive-inclusive    core_9_3_2    core_10_4_2
    queryEntity    GET    /ngsi-ld/v1/entities?type=Vehicle
    queryEntity    GET    /ngsi-ld/v1/entities?id=
D010_03_inc_03 Retrieve Entity By Id Using The queryBatch Operation
    [Documentation]    Check that if one retrieves entity living on a Context Source from a Context Broker, and the registration only allows the queryBatch operation, the request is forwarded as expected
    [Tags]    since_v1.6.1    dist-ops    core_4_3_3    cf_04    additive-inclusive    core_9_3_2    core_10_4_2
@@ -40,7 +40,7 @@ Setup Registration And Context Source Mock Server And Retrieve Entity
    [Arguments]    ${operation}    ${method}    ${url}
    ${entity_id}=    Generate Random Vehicle Entity Id

    IF    '${operation}' == 'retrieveEntity'
    IF    '${operation}' == 'retrieveEntity' or '${operation}' == 'queryEntity'
        ${url}=    Set Variable    ${url}${entity_id}
    END

+4 −1
Changes for TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/MergeBatchOfEntities/D016_01_inc.robot: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -45,7 +45,10 @@ D016_01_inc Merge Batch Entities On Both Context Broker And Context Source
    ...    context=${ngsild_test_suite_context}
    ...    accept=${CONTENT_TYPE_LD_JSON}

    Should Contain    ${response.json()}    speed
    Should Not Be Empty    ${response.json()}
    FOR    ${entity}    IN    @{response.json()}
        Dictionary Should Contain Key    ${entity}    speed
    END


*** Keywords ***
Loading
Loading