Commit 80d354ac authored by kzangeli's avatar kzangeli
Browse files

Merge branch 'fix/038-csub-create-fixes' into integration/all-fixes

# Conflicts:
#	testsuite-doubts.md
parents 426038eb 92c19ff4
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -22,7 +22,10 @@ ${subscription_id}= ${EMPTY}
    ${response}=    Create Context Source Registration Subscription    ${subscription_payload}

    Dictionary Should Contain Key    ${response.headers}    Location    msg=HTTP Headers do not contain key 'Location'
    ${subscription_id}=    Get From Dictionary    ${response.headers}    Location
    ${location}=    Get From Dictionary    ${response.headers}    Location
    # Location is a URI reference (RFC 9110 § 10.2.2) — typically the resource
    # path /ngsi-ld/v1/csourceSubscriptions/<id>. Extract the generated id.
    ${subscription_id}=    Fetch From Right    ${location}    /
    Set Suite Variable    ${subscription_id}

    Check Response Status Code    201    ${response.status_code}
@@ -32,7 +35,18 @@ ${subscription_id}= ${EMPTY}
    ...    subscription_id=${subscription_id}
    ...    context=${ngsild_test_suite_context}
    ...    accept=${CONTENT_TYPE_LD_JSON}
    ${ignored_attributes}=    Create List    ${id_regex_expr}    ${status_regex_expr}
    # Ignore the Additional Members ('lastFailure', 'lastNotification', 'timesFailed',
    # 'timesSent', 'status'), both at root level and inside 'notification' (clause
    # 5.2.14), where they may have been set already by the initial notification sent
    # upon subscription creation (clause 12.4.7).
    ${ignored_attributes}=    Create List
    ...    ${id_regex_expr}
    ...    ${status_regex_expr}
    ...    ${lastfailure_regex_expr}
    ...    ${lastNotification_regex_expr}
    ...    ${timesFailed_regex_expr}
    ...    ${timesSent_regex_expr}
    ...    ${notification_result_regex_expr}
    Check Created Resource Set To    ${subscription_payload}    ${response1.json()}    ${ignored_attributes}


+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
         "type":"Building"
      }
   ],
   "q": "invalidQuery",
   "q": "(invalidQuery",
   "notification":{
      "format":"keyValues",
      "endpoint":{
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ ${lastNotification_regex_expr}= root\\['lastNotification'\\]
${timesFailed_regex_expr}=                  root\\['timesFailed'\\]
${timesSent_regex_expr}=                    root\\['timesSent'\\]
${is_active_expr}=                          root\\['isActive'\\]
${notification_result_regex_expr}=          \\['notification'\\]\\['(lastNotification|lastSuccess|lastFailure|timesSent|timesFailed|status)'\\]
${context_source_ignored_regex_expr}=       root\\['@context'\\]
# Broker-computed Additional Members of NotificationParams (5.2.14.2), nested under
# the Subscription's 'notification' object — non-deterministic (present only after a
+29 −0
Original line number Diff line number Diff line
@@ -3295,3 +3295,32 @@ twins WITH `speed` — `vehicle-simple-different-attributes.jsonld`).
(The `entity_id2=` keyword support and the exclusive fixture are
re-declared identically to their origin branch since that MR is unmerged —
git deduplicates on merge.)


## 96. `038_02_01` / `038_08_03` — Location parsed as an id, and a syntactically valid `q` expected to fail

Two independent defects in the csourceSubscription-creation tests; both also
LEAK their subscription (the teardown's delete fails / never runs), and the
leaked subscriptions then poison the `041_*` count assertions
(`Query All Subscriptions: 5 != 3` etc.) in full-suite runs.

**a) `038_02_01` (create without id):** the test stores the raw `Location`
response header as `${subscription_id}`. `Location` is a URI reference
(RFC 9110 § 10.2.2) — brokers return the resource path
`/ngsi-ld/v1/csourceSubscriptions/<id>` — so the follow-up retrieve and the
teardown delete build doubled URLs and fail. Fixed by extracting the last
path segment. The retrieve comparison additionally needs the clause-12.4.7
Additional-Members ignores (root level and inside `notification`) like its
siblings 038_01/038_03 — the initial notification to the dead fixture
endpoint sets `timesSent`/`timesFailed`/`lastNotification`/`lastFailure`/
`status` immediately.

**b) `038_08_03` (InvalidQuery):** the fixture's `"q": "invalidQuery"` is a
bare attribute path — per TS 104-175 § 7.x ABNF (`QueryTerm = Attribute`)
that is a syntactically VALID query (an existence predicate), so a broker
must accept it with 201. The fixture now uses `"(invalidQuery"` (unbalanced
parenthesis — genuinely invalid), mirroring `037_03_02`.

(The `notification_result_regex_expr` variable and the assertionUtils.py
`threshold_to_diff_deeper=0` fix are re-declared identically to their origin
branch since that MR is unmerged — git deduplicates on merge.)