Commit 39921641 authored by kzangeli's avatar kzangeli
Browse files

fix(jsonldContext): suite-scoped ${uri} + unknown-id deletes are 404

Three suites (051_05, 053_05, 053_06) share the file-level variable
${uri} = /api/v1/context.jsonld and their setups Catenate the context
server's host:port onto it, then Set GLOBAL Variable. In a full run the
first suite publishes the absolute URL globally and the next suite's
Catenate doubles it (http://0.0.0.0:8087http//0.0.0.0:8087/...) — every
follow-up request 404s. 051_05's Catenate was even commented out,
silently relying on whatever absolute URL another suite left behind.
Each suite now catenates its own copy and uses Set Suite Variable.

051_04_01 (wrong id + reload=true) expected 400; clause 13.5.4 mandates
ResourceNotFound for an identifier that 'does not correspond to any
existing entry' — the reload bullets only describe behaviour for an
existing @context. Corrected to 404.

The 051_05/053_05 LdContextNotAvailable 503→504 expectations are
re-declared identically to their origin branch (unmerged MR) — git
deduplicates on merge.

Analysis recorded as testsuite-doubts.md #97.
parent d9a20233
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -56,7 +56,10 @@ Create Initial @context condition from an external server
    Start @context Local Server

    ${uri}=    Catenate    http://${context_server_host}:${context_server_port}${uri}
    Set Global Variable    ${uri}
    # Suite scope, NOT global — a global ${uri} bleeds into the other
    # jsonldContext suites sharing the same variable name, and their own
    # Catenate then doubles the URL (testsuite-doubts.md #97).
    Set Suite Variable    ${uri}

    Create Entity selecting @context    ${entityfile}    ${uri}

@@ -71,7 +74,7 @@ Create Initial @context condition from an external server
    Stop @context Local Server

    ${response}=    Delete a @context    ${uri}    true
    Check Response Status Code    503    ${response.status_code}
    Check Response Status Code    504    ${response.status_code}

Delete Initial @context condition from an external server
    Log    Delete initial contidions
+2 −1
Original line number Diff line number Diff line
@@ -52,7 +52,8 @@ Create Initial @context condition from an external server
    Set Global Variable    ${first_existing_entity_id}

    ${uri}=    Catenate    SEPARATOR=    http://${context_server_host}:${context_server_port}    ${uri}
    Set Global Variable    ${uri}
    # Suite scope, NOT global — see testsuite-doubts.md #97.
    Set Suite Variable    ${uri}

    Create Entity selecting @context    ${entityfile}    ${uri}    ${first_existing_entity_id}
    ${response}=    Serve a @context
+4 −1
Original line number Diff line number Diff line
@@ -21,7 +21,10 @@ ${reason_422}= Unprocessable
*** Test Cases ***    CONTEXTID    RELOAD    STATUSCODE    REASON    ERROR
051_04_01 Delete A @contexts With A Wrong Id And Reload Set To True
    [Tags]    ctx-delete    5_13_5    since_v1.5.1
    wrong_id_context    true    400    ${reason_400}    ${ERROR_TYPE_BAD_REQUEST_DATA}
    # An identifier that "does not correspond to any existing entry" is
    # ResourceNotFound (clause 13.5.4) — reload only enters the picture for
    # an EXISTING @context (testsuite-doubts.md #97).
    wrong_id_context    true    404    ${reason_404}    ${ERROR_TYPE_RESOURCE_NOT_FOUND}
051_04_02 Delete A @contexts With A Wrong Id And Reload Set To False
    [Tags]    ctx-delete    5_13_5    since_v1.5.1
    wrong_id_context    false    404    ${reason_404}    ${ERROR_TYPE_RESOURCE_NOT_FOUND}
+7 −4
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@ ${uri} /api/v1/context.jsonld

    ${response}=    Delete a @context    ${uri}    true

    Check Response Status Code    503    ${response.status_code}
    Check Response Reason set to    ${response.reason}    Service Unavailable
    Check Response Status Code    504    ${response.status_code}
    Check Response Reason set to    ${response.reason}    Gateway Timeout
    Check Response Body Containing ProblemDetails Element
    ...    ${response.json()}
    ...    ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE}
@@ -42,8 +42,11 @@ ${uri} /api/v1/context.jsonld
Create Initial @context condition from an external server
    Start @context Local Server

    # ${uri}=    Catenate    http://${context_server_host}:${context_server_port}${uri}
    Set Global Variable    ${uri}
    ${uri}=    Catenate    http://${context_server_host}:${context_server_port}${uri}
    # Suite scope, NOT global — with the Catenate above commented out this
    # suite silently depended on the absolute URL another suite happened to
    # leave in the global ${uri} (testsuite-doubts.md #97).
    Set Suite Variable    ${uri}

    Create Entity selecting @context    ${entityfile}    ${uri}

+33 −0
Original line number Diff line number Diff line
@@ -2667,3 +2667,36 @@ doesn't match the URL id.
`$.id` with the actual `${entity_id}` before PATCHing. Or omit the
`id` from the fragment entirely (PATCH attrs doesn't need it).



## 97. jsonldContext family — global `${uri}` doubling, and wrong-id deletes are 404, not 400

Three intertwined defects around `/jsonldContexts` (051/053):

**a) Global `${uri}` doubling (`051_05_01`, `053_06_01`, and latently
`053_05_01`):** three suites share the file-level variable
`${uri} = /api/v1/context.jsonld` and their setups run
`Catenate http://host:port + ${uri}` followed by `Set GLOBAL Variable ${uri}`.
In a full run, whichever suite executes first publishes the ABSOLUTE URL
globally; the next suite's Catenate then doubles it
(`http://0.0.0.0:8087http://0.0.0.0:8087/api/v1/context.jsonld`) and every
follow-up request 404s. `051_05_01`'s Catenate was even commented out at some
point — making it silently depend on the absolute URL another suite happened
to leave behind. Fixed: each suite catenates its own and uses
`Set Suite Variable`.

**b) `051_02_01` / `051_04_02` / `051_04_03` (broker side, recorded for
context):** the contextId is a "locally unique identifier" (clause 13.5.3) —
no URI shape applies, so a non-URI id is simply unknown and clause 13.5.4
mandates ResourceNotFound. The broker returned 400 for non-URI ids; fixed
broker-side.

**c) `051_04_01` — wrong id + `reload=true` expects 400:** clause 13.5.4's
"identifier does not correspond to any existing entry → ResourceNotFound"
applies to any unknown id; the reload bullets describe behaviour for an
EXISTING @context ("the kind of the @context"). Expectation corrected to
404/ResourceNotFound.

(The 051_05/053_05 503→504 status expectations are re-declared identically
to their origin branch since that MR is unmerged — git deduplicates on
merge.)