Merge "rest: do not duplicate non-existing resource ids"

This commit is contained in:
Jenkins 2017-05-18 20:30:07 +00:00 committed by Gerrit Code Review
commit c4183fe4fa
2 changed files with 34 additions and 0 deletions

View File

@ -1422,6 +1422,7 @@ class ResourcesMetricsMeasuresBatchController(rest.RestController):
unknown_resources.append({
'resource_id': six.text_type(resource_id),
'original_resource_id': original_resource_id})
break
except indexer.IndexerException as e:
# This catch NoSuchArchivePolicy, which is unlikely
# be still possible

View File

@ -227,6 +227,39 @@ tests:
- original_resource_id: "bbbbbbbb-d63b-4cdd-be89-111111111111"
resource_id: "bbbbbbbb-d63b-4cdd-be89-111111111111"
- name: push measurements to unknown named metrics and resource with create_metrics with uuid resource id where resources is several times listed
POST: /v1/batch/resources/metrics/measures?create_metrics=true
request_headers:
content-type: application/json
accept: application/json
data:
aaaaaaaa-d63b-4cdd-be89-111111111111:
auto.test:
- timestamp: "2015-03-06T14:33:57"
value: 43.1
- timestamp: "2015-03-06T14:34:12"
value: 12
auto.test2:
- timestamp: "2015-03-06T14:33:57"
value: 43.1
- timestamp: "2015-03-06T14:34:12"
value: 12
bbbbbbbb-d63b-4cdd-be89-111111111111:
auto.test:
- timestamp: "2015-03-06T14:33:57"
value: 43.1
- timestamp: "2015-03-06T14:34:12"
value: 12
status: 400
response_json_paths:
$.description.cause: "Unknown resources"
$.description.detail[/original_resource_id]:
- original_resource_id: "aaaaaaaa-d63b-4cdd-be89-111111111111"
resource_id: "aaaaaaaa-d63b-4cdd-be89-111111111111"
- original_resource_id: "bbbbbbbb-d63b-4cdd-be89-111111111111"
resource_id: "bbbbbbbb-d63b-4cdd-be89-111111111111"
- name: push measurements to unknown named metrics and resource with create_metrics with non uuid resource id
POST: /v1/batch/resources/metrics/measures?create_metrics=true
request_headers: