Closed iariasleon closed 1 week ago
Re-tested in CB version and it issue still fails, it returns 201-Created
"version" : "1.2.0-next",
"git_hash" : "d81dcf28e71d8d63dc0929ef7a6b73d7db47421b"
I looked into this issue a little and found the following solution (detecting trailing garbage in the date string):
p = strptime(s.c_str(), " %Y-%m-%dT%T", &tm);
if (p == NULL)
{
return -1;
}
else if (*p != 0) // trailing garbage
{
return -1;
}
This fix (the addition is the else part) works just fine, however, in many many of our functests we use dates with the following format:
2016-04-05T14:10:00:00.00Z
The fix receives .00Z
as trailing garbage and the functest fails. Many many functests.
Now, what do we do with this?
Change all functests?
Accept .00Z
as 'good garbage' :-) ?
I haven read in deep last comment, sorry... My only concern here if is changing the way we deal with dates could break (or "make it worse" if already broken :) our support to ISO8601
Take into account that rencelty (1.6.0, Nov 2016) we implemented the following functionality:
- Add: support ISO8601 timezones at DateTime attributes and metadata creation/update time and filters (#2632)
- Add: support for partial representation format at DateTime attributes and metadata creation/update and filters (#2631)
Take that into account (in particular, the PRs linked from these issues) in order to fix this issue.
In addition, the issue https://github.com/telefonicaid/fiware-orion/issues/2718 seems to be very related with this.
This issue seems to have been fixed. Functest added in PR #2814
Re-tested with:
"version" : "1.6.0-next",
"git_hash" : "4bbe1edfcc8a5cbd3a91bc05a07d6671d089f2f2"
And all cases are OK, except the first case in the dataset:
url: POST http://localhost:1026/v2/subscriptions
headers:
Content-Type: application/json
Fiware-Service: test_csub_expires
Fiware-ServicePath: /test
payload: {"notification": {"http": {"url": "http://localhost:1234"}, "attrs": ["temperature"]}, "expires": "2016-04-05T14:10:0x.00Z", "description": "my first subscription", "subject": {"entities": [{"idPattern": ".*", "type": "room"}], "condition": {"attrs": ["temperature_0", "temperature_1", "temperature_2"]}}}
----------------- Response ---------------------------------
http code: 201 - Created
headers:
Connection: Keep-Alive
Content-Length: 0
Location: /v2/subscriptions/587c9b59c3373ce3dfe91fe3
Fiware-Correlator: 922c8e3e-dbd3-11e6-9fd2-005056a20feb
Date: Mon, 16 Jan 2017 10:07:21 GMT
payload:
(As the issue is still open, then it seems I incorrectly put it in the 1.6.0 milestone. Moved back to NGSIv2SubscriptionValidation milestone)
(feedback required from @fgalan)
I think this issue also can be closed. similar to issue #4541 @fgalan what is your opinion.
@ArqamFarooqui110719 maybe you could do a PR including a .test covering the cases:
| expires |
|--------------------------|
| 2016-04-05T14:10:0x.00Z |
| 2016-04-05T14:10:00,00Z |
| 2016-04-05T14:10:00.h00Z |
| 2016-04-05T14:10:00.0h0Z |
| 2016-04-05T14:10:00.,00L |
That way we strengthen our test base and check that issue is actually solved.
in POST v2/subscriptions if expires has invalid date the subscription is created
dataset
subscription request
subscription response
expected response