From 39921641f0e1f113961ecd4baaebdfb56bb2d2e3 Mon Sep 17 00:00:00 2001 From: kzangeli Date: Fri, 5 Jun 2026 16:03:14 +0200 Subject: [PATCH] fix(jsonldContext): suite-scoped ${uri} + unknown-id deletes are 404 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../Consumption/ServeContext/053_05.robot | 7 ++-- .../Consumption/ServeContext/053_06.robot | 3 +- .../Provision/DeleteContext/051_04.robot | 5 ++- .../Provision/DeleteContext/051_05.robot | 11 ++++--- testsuite-doubts.md | 33 +++++++++++++++++++ 5 files changed, 51 insertions(+), 8 deletions(-) diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_05.robot b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_05.robot index f01cb49f..cf446a8a 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_05.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_05.robot @@ -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 diff --git a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_06.robot b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_06.robot index af9ad2b9..fcce8992 100644 --- a/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_06.robot +++ b/TP/NGSI-LD/jsonldContext/Consumption/ServeContext/053_06.robot @@ -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 diff --git a/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_04.robot b/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_04.robot index fdbb783e..00a9b2f6 100644 --- a/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_04.robot +++ b/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_04.robot @@ -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} diff --git a/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_05.robot b/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_05.robot index 61a7e17e..b2270d17 100644 --- a/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_05.robot +++ b/TP/NGSI-LD/jsonldContext/Provision/DeleteContext/051_05.robot @@ -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} diff --git a/testsuite-doubts.md b/testsuite-doubts.md index 50417d0d..e921eabd 100644 --- a/testsuite-doubts.md +++ b/testsuite-doubts.md @@ -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.) -- GitLab