From 243cbef4928284a4db43c5bbe39d3356aa1ad8df Mon Sep 17 00:00:00 2001 From: Ken Zangelin Date: Thu, 23 May 2024 20:40:16 +0200 Subject: [PATCH] CHANGES_NEXT_RELEASE + new functest for issue #1612 --- CHANGES_NEXT_RELEASE | 3 +- .../ngsild_issue_1612-q-over-modifiedAt.test | 2 +- ...sild_new_issue_1612-q-over-modifiedAt.test | 218 ++++++++++++++++++ 3 files changed, 221 insertions(+), 2 deletions(-) create mode 100644 test/functionalTest/cases/0000_ngsild/ngsild_new_issue_1612-q-over-modifiedAt.test diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index d195f7a5d3..9caed8bdf0 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,11 +1,12 @@ ## Fixed Issues: * #1535: Ignore Subscription::q when matching subscriptions for deletion of an entity * #1542: Array Reduction (arrays of one single element are "flattened" to that very element) - * SOF: https://stackoverflow.com/questions/77911109/fiware-to-payload-too-large * #1551: format=simplified for distribute GET /entities gave Normalized for entities from other brokers * #1573: pagination not working when entities have the exact same creation date (sort also by entity id) * #1583: If a 'q' contains an ampersand, that ampersand needs to be forwarded as a semicolon * #1593: Modify the type of an entity in a Replace operation (only working in legacy mode) + * #1612: Support for ISO8601 timezones expressed in +/- HH:mm in 'q' for entity query + * SOF: https://stackoverflow.com/questions/77911109/fiware-to-payload-too-large * Fixed a possible crash for TRoE and attributes of type Vocab/Json/Language * Forbidden to DELETE the Core Context !!! (it can be reloaded) * Bug fix: JSON NULL literal is no longer forwarded! diff --git a/test/functionalTest/cases/0000_ngsild/ngsild_issue_1612-q-over-modifiedAt.test b/test/functionalTest/cases/0000_ngsild/ngsild_issue_1612-q-over-modifiedAt.test index 7620b54ab3..26d4ae2636 100644 --- a/test/functionalTest/cases/0000_ngsild/ngsild_issue_1612-q-over-modifiedAt.test +++ b/test/functionalTest/cases/0000_ngsild/ngsild_issue_1612-q-over-modifiedAt.test @@ -21,7 +21,7 @@ # VALGRIND_READY - to mark the test ready for valgrindTestSuite.sh --NAME-- -Query over modifiedAt with GT and timezone +Entity query with q over modifiedAt with GT and timezone --SHELL-INIT-- dbInit CB diff --git a/test/functionalTest/cases/0000_ngsild/ngsild_new_issue_1612-q-over-modifiedAt.test b/test/functionalTest/cases/0000_ngsild/ngsild_new_issue_1612-q-over-modifiedAt.test new file mode 100644 index 0000000000..975a8b4d7c --- /dev/null +++ b/test/functionalTest/cases/0000_ngsild/ngsild_new_issue_1612-q-over-modifiedAt.test @@ -0,0 +1,218 @@ +# Copyright 2024 FIWARE Foundation e.V. +# +# This file is part of Orion-LD Context Broker. +# +# Orion-LD Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion-LD Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion-LD Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# orionld at fiware dot org + +# VALGRIND_READY - to mark the test ready for valgrindTestSuite.sh + +--NAME-- +Entity query with q over modifiedAt with GT and timezone + +--SHELL-INIT-- +dbInit CB +orionldStart CB -experimental + +--SHELL-- + +# +# 01. Create an entity urn:E1 +# 02. Sleep 100 ms and create two timestamp strings, T1 w/o timezone, just Z, and T2 with timezone (+02:00) +# 03. Create an entity urn:E2 +# 04. Create an entity urn:E3 +# 05. Query entities with q=modifiedAt>T1 - see urn:E2 and urn:E3 +# 06. Query entities with q=modifiedAt>T2 - see urn:E2 and urn:E3 (issue #1612 says we get all three) +# + +echo "01. Create an entity urn:E1" +echo "===========================" +payload='{ + "id": "urn:E1", + "type": "T", + "P1": 1 +}' +orionCurl --url /ngsi-ld/v1/entities --payload "$payload" +echo +echo + + +echo "02. Sleep 100 ms and create two timestamp strings, T1 w/o timezone, just Z, and T2 with timezone (+02:00)" +echo "=========================================================================================================" +sleep 1 +T=$(date +%s) +T1=$(date --date="@$T" --utc --iso-8601=seconds) +T2=$(date --date="@$T" --iso-8601=seconds) +echo T1: $T1 +echo T2: $T2 +T1=$(echo $T1 | sed 's/+00:00//') +T2=$(echo $T2 | sed 's/+02:00/%2B02:00/') +echo T1: $T1 +echo T2: $T2 +sleep 1 +echo +echo + + +echo "03. Create an entity urn:E2" +echo "===========================" +payload='{ + "id": "urn:E2", + "type": "T", + "P1": 1 +}' +orionCurl --url /ngsi-ld/v1/entities --payload "$payload" +echo +echo + + +echo "04. Create an entity urn:E3" +echo "===========================" +payload='{ + "id": "urn:E3", + "type": "T", + "P1": 1 +}' +orionCurl --url /ngsi-ld/v1/entities --payload "$payload" +echo +echo + + +echo "05. Query entities with q=modifiedAt>T1 - see urn:E2 and urn:E3" +echo "===============================================================" +orionCurl --url "/ngsi-ld/v1/entities?q=modifiedAt>$T1&options=sysAttrs" +echo +echo + + +echo "06. Query entities with q=modifiedAt>T2 - see urn:E2 and urn:E3 (issue #1612 says we get all three)" +echo "===================================================================================================" +orionCurl --url "/ngsi-ld/v1/entities?q=modifiedAt>$T2&options=sysAttrs" +echo +echo + + +--REGEXPECT-- +01. Create an entity urn:E1 +=========================== +HTTP/1.1 201 Created +Content-Length: 0 +Date: REGEX(.*) +Location: /ngsi-ld/v1/entities/urn:E1 + + + +02. Sleep 100 ms and create two timestamp strings, T1 w/o timezone, just Z, and T2 with timezone (+02:00) +========================================================================================================= +T1: 202REGEX(.*) +T2: 202REGEX(.*) +T1: 202REGEX(.*) +T2: 202REGEX(.*) + + +03. Create an entity urn:E2 +=========================== +HTTP/1.1 201 Created +Content-Length: 0 +Date: REGEX(.*) +Location: /ngsi-ld/v1/entities/urn:E2 + + + +04. Create an entity urn:E3 +=========================== +HTTP/1.1 201 Created +Content-Length: 0 +Date: REGEX(.*) +Location: /ngsi-ld/v1/entities/urn:E3 + + + +05. Query entities with q=modifiedAt>T1 - see urn:E2 and urn:E3 +=============================================================== +HTTP/1.1 200 OK +Content-Length: 441 +Content-Type: application/json +Date: REGEX(.*) +Link: T2 - see urn:E2 and urn:E3 (issue #1612 says we get all three) +=================================================================================================== +HTTP/1.1 200 OK +Content-Length: 441 +Content-Type: application/json +Date: REGEX(.*) +Link: