-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into issue/4495
- Loading branch information
Showing
7 changed files
with
222 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
- Fix: Service path levels with 0 length should not be allowed (#4495) | ||
- Fix: changed the default value of `-dbTimeout` to 0 to resolve conflict with `-dbURI` (#4496) | ||
- Fix: wrong INFO startup log showing ORION_MONGO_TIMEOUT, ORION_IN_REQ_PAYLOAD_MAX_SIZE and ORION_OUT_REQ_MSG_MAX_SIZE env var values (#4496) | ||
- Fix: return 400 Bad Request when subject.entities exists but it is an empty array (#4499) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
193 changes: 193 additions & 0 deletions
193
...Test/cases/4499_subs_without_entities_return_error/sub_without_entities_return_error.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
# Copyright 2024 Telefonica Investigacion y Desarrollo, S.A.U | ||
# | ||
# This file is part of Orion Context Broker. | ||
# | ||
# Orion 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 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 Context Broker. If not, see http://www.gnu.org/licenses/. | ||
# | ||
# For those usages not covered by this license please contact with | ||
# iot_support at tid dot es | ||
|
||
# VALGRIND_READY - to mark the test ready for valgrindTestSuite.sh | ||
|
||
--NAME-- | ||
Subscription without entities return error | ||
|
||
--SHELL-INIT-- | ||
dbInit CB | ||
brokerStart CB | ||
|
||
--SHELL-- | ||
|
||
# | ||
# 01. Create subscription without subject.entities field, see error | ||
# 02. Create subscription with subject.entities field with 0 items, see error | ||
# 03. Create subscription | ||
# 04. Update subscription without subject.entities field, see error | ||
# 05. Update subscription with subject.entities field with 0 items, see error | ||
# | ||
|
||
|
||
echo "01. Create subscription without subject.entities field, see error" | ||
echo "=================================================================" | ||
payload='{ | ||
"subject": { | ||
}, | ||
"notification": { | ||
"http": { | ||
"url": "http://127.0.0.1:'${LISTENER_PORT}'/notify" | ||
} | ||
} | ||
}' | ||
orionCurl --url /v2/subscriptions --payload "$payload" | ||
echo | ||
echo | ||
|
||
|
||
echo "02. Create subscription with subject.entities field with 0 items, see error" | ||
echo "===========================================================================" | ||
payload='{ | ||
"subject": { | ||
"entities": [ | ||
] | ||
}, | ||
"notification": { | ||
"http": { | ||
"url": "http://127.0.0.1:'${LISTENER_PORT}'/notify" | ||
} | ||
} | ||
}' | ||
orionCurl --url /v2/subscriptions --payload "$payload" | ||
echo | ||
echo | ||
|
||
|
||
echo "03. Create subscription" | ||
echo "=======================" | ||
payload='{ | ||
"subject": { | ||
"entities": [ | ||
{ | ||
"id" : "E", | ||
"type": "T" | ||
} | ||
] | ||
}, | ||
"notification": { | ||
"http": { | ||
"url": "http://127.0.0.1:'${LISTENER_PORT}'/notify" | ||
} | ||
} | ||
}' | ||
orionCurl --url /v2/subscriptions --payload "$payload" | ||
echo | ||
echo | ||
|
||
|
||
SUB_ID=$(echo "$_responseHeaders" | grep Location | awk -F/ '{ print $4 }' | tr -d "\r\n") | ||
|
||
|
||
echo "04. Update subscription without subject.entities field, see error" | ||
echo "=================================================================" | ||
payload='{ | ||
"subject": { | ||
} | ||
}' | ||
orionCurl --url /v2/subscriptions/$SUB_ID -X PATCH --payload "$payload" | ||
echo | ||
echo | ||
|
||
|
||
echo "05. Update subscription with subject.entities field with 0 items, see error" | ||
echo "===========================================================================" | ||
payload='{ | ||
"subject": { | ||
"entities": [ | ||
] | ||
} | ||
}' | ||
orionCurl --url /v2/subscriptions/$SUB_ID -X PATCH --payload "$payload" | ||
echo | ||
echo | ||
|
||
|
||
--REGEXPECT-- | ||
01. Create subscription without subject.entities field, see error | ||
================================================================= | ||
HTTP/1.1 400 Bad Request | ||
Date: REGEX(.*) | ||
Fiware-Correlator: REGEX([0-9a-f\-]{36}) | ||
Content-Type: application/json | ||
Content-Length: 68 | ||
|
||
{ | ||
"description": "no subject entities specified", | ||
"error": "BadRequest" | ||
} | ||
|
||
|
||
02. Create subscription with subject.entities field with 0 items, see error | ||
=========================================================================== | ||
HTTP/1.1 400 Bad Request | ||
Date: REGEX(.*) | ||
Fiware-Correlator: REGEX([0-9a-f\-]{36}) | ||
Content-Type: application/json | ||
Content-Length: 64 | ||
|
||
{ | ||
"description": "subject entities is empty", | ||
"error": "BadRequest" | ||
} | ||
|
||
|
||
03. Create subscription | ||
======================= | ||
HTTP/1.1 201 Created | ||
Date: REGEX(.*) | ||
Fiware-Correlator: REGEX([0-9a-f\-]{36}) | ||
Location: /v2/subscriptions/REGEX([0-9a-f]{24}) | ||
Content-Length: 0 | ||
|
||
|
||
|
||
04. Update subscription without subject.entities field, see error | ||
================================================================= | ||
HTTP/1.1 400 Bad Request | ||
Date: REGEX(.*) | ||
Fiware-Correlator: REGEX([0-9a-f\-]{36}) | ||
Content-Type: application/json | ||
Content-Length: 68 | ||
|
||
{ | ||
"description": "no subject entities specified", | ||
"error": "BadRequest" | ||
} | ||
|
||
|
||
05. Update subscription with subject.entities field with 0 items, see error | ||
=========================================================================== | ||
HTTP/1.1 400 Bad Request | ||
Date: REGEX(.*) | ||
Fiware-Correlator: REGEX([0-9a-f\-]{36}) | ||
Content-Type: application/json | ||
Content-Length: 64 | ||
|
||
{ | ||
"description": "subject entities is empty", | ||
"error": "BadRequest" | ||
} | ||
|
||
|
||
--TEARDOWN-- | ||
brokerStop CB | ||
dbDrop CB |