-
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 pull request #4455 from telefonicaid/hardening/4454_false_posit…
…ive_in_log_deprecation_logic FIX false positive in log deprecation logic when entity name (or other literal) includes the token v1
- Loading branch information
Showing
3 changed files
with
100 additions
and
1 deletion.
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
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
98 changes: 98 additions & 0 deletions
98
...4454_false_positive_in_log_deprecation_logic/false_positive_in_log_deprecation_logic.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,98 @@ | ||
# Copyright 2023 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-- | ||
Disable NGSIv1 CLI | ||
|
||
--SHELL-INIT-- | ||
dbInit CB | ||
brokerStart CB 0 IPV4 -logDeprecate | ||
|
||
--SHELL-- | ||
|
||
# | ||
# 01. GET /v2/entities/glory_ev1 | ||
# 02. GET /v1/contextEntities/glory_ev2/attributes/A | ||
# 03. Get WARNING trace in logs corresponding only to the second case | ||
# | ||
|
||
echo "01. GET /v2/entities/glory_ev1" | ||
echo "==============================" | ||
orionCurl --url /v2/entities/glory_ev1 | ||
echo | ||
echo | ||
|
||
|
||
echo "02. GET /v1/contextEntities/glory_ev2/attributes/A" | ||
echo "==================================================" | ||
orionCurl --url /v1/contextEntities/glory_ev2/attributes/A | ||
echo | ||
echo | ||
|
||
|
||
echo "03. Get WARNING trace in logs corresponding only to the second case" | ||
echo "===================================================================" | ||
cat /tmp/contextBroker.log | grep 'WARN' | awk -F 'msg=' '{print $2}' | ||
echo | ||
echo | ||
|
||
|
||
--REGEXPECT-- | ||
01. GET /v2/entities/glory_ev1 | ||
============================== | ||
HTTP/1.1 404 Not Found | ||
Date: REGEX(.*) | ||
Fiware-Correlator: REGEX([0-9a-f\-]{36}) | ||
Content-Type: application/json | ||
Content-Length: 95 | ||
|
||
{ | ||
"description": "The requested entity has not been found. Check type and id", | ||
"error": "NotFound" | ||
} | ||
|
||
|
||
02. GET /v1/contextEntities/glory_ev2/attributes/A | ||
================================================== | ||
HTTP/1.1 200 OK | ||
Date: REGEX(.*) | ||
Fiware-Correlator: REGEX([0-9a-f\-]{36}) | ||
Content-Type: application/json | ||
Content-Length: 106 | ||
|
||
{ | ||
"statusCode": { | ||
"code": "404", | ||
"details": "Entity id: /glory_ev2/", | ||
"reasonPhrase": "No context element found" | ||
} | ||
} | ||
|
||
|
||
03. Get WARNING trace in logs corresponding only to the second case | ||
=================================================================== | ||
Deprecated NGSIv1 request received: GET /v1/contextEntities/glory_ev2/attributes/A, response code: 200 | ||
|
||
|
||
--TEARDOWN-- | ||
brokerStop CB | ||
dbDrop CB |