Commit 806bcaa8 authored by kzangeli's avatar kzangeli
Browse files

Merge branch 'fix/d010-retrieve-assertions' into integration/all-fixes

# Conflicts:
#	testsuite-doubts.md
parents 98a4c50d f7e1f0a1
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -31,11 +31,15 @@ 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
    # The stub (and the broker's by-id retrieve forward) live at the
    # by-id URL registered above — the by-type listing URL was never
    # stubbed nor requested (testsuite-doubts.md #82a).
    ${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
    # The response entity carries the speed attribute served by the
    # Context Source (the Get From Dictionary itself fails if absent).
    Dictionary Should Contain Key    ${response.json()}    speed
    
*** Keywords ***
Create Entity And Registration On The Context Broker And Start Context Source Mock Server
+5 −2
Original line number Diff line number Diff line
@@ -27,7 +27,10 @@ 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    4_3_3    cf_06    additive-inclusive    4_3_6_2    5_7_1
    queryEntity    GET    /ngsi-ld/v1/entities?type=Vehicle
    # A retrieve converted to the queryEntity form selects by ENTITY ID —
    # the broker knows the target id, not necessarily a type it can
    # compact for the receiver. The keyword appends the generated id.
    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    4_3_3    cf_06    additive-inclusive    4_3_6_2    5_7_1
@@ -40,7 +43,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

+29 −0
Original line number Diff line number Diff line
@@ -3399,3 +3399,32 @@ the pagination one.
EntityInfos constrained only by `idPattern` — they matched any queried id;
and a bare `georel` without `geometry`/`coordinates` slipped past validation
once the too-wide gate learned about geo-queries. Both fixed broker-side.)


## 99. D010 retrieve family — wrong-URL count, self-defeating assertion, type-form stub

Three test-side defects in RetrieveEntity (plus two broker bugs they
surfaced, recorded for context):

**a) `D010_01_exc`:** the stub-count assertion queried the by-type listing
URL while the test stubs (and the broker forwards) the by-id retrieve —
0 by construction. See [[#82a]]; fixed as prescribed there. Its final
assertion also fetched the `speed` attribute and then searched the
attribute's VALUE OBJECT for the key 'speed' — now a
`Dictionary Should Contain Key` on the entity.

**b) `D010_03_inc_02`:** the queryEntity-form stub keyed on
`?type=Vehicle`, but a retrieve converted to the query form selects by
ENTITY ID — the broker knows the target id; the registration's type is an
expanded IRI it need not be able to compact for the receiver. The stub now
keys on `?id=<the generated id>` (appended by the setup keyword, like the
by-id case).

**(Broker side, recorded for context: D010_01_red exposed the § 4.3.6.3
local-strip running interleaved with upstream merging — one redirect
source's wildcard claim erased what another source had just contributed;
and D010_03_inc_02/03 needed the § 9.2 ops-aware conversion of a retrieve
into the queryEntity / queryBatch forward forms. Both fixed broker-side.
The HttpCtrl stub matcher's parameterised-request branch also never
compared the path prefix — /broker2 requests matched the /broker1 stub;
fixed on the vendored fork's branch.)**