diff options
author | grabinsk <maciej.grabinski@nokia.com> | 2019-05-23 13:34:38 +0200 |
---|---|---|
committer | grabinsk <maciej.grabinski@nokia.com> | 2019-05-23 13:34:38 +0200 |
commit | 08a9c63a95ad22472c358bd062d775d8b7b7505a (patch) | |
tree | 68b3c868afc66741491228595e8c7b96dc365f62 /tests/dcaegen2 | |
parent | db4c4a5f83b674d6c04f9e6f3355171b13d67fa4 (diff) |
Improve PRH tests to make json comparison more flexible
Update expected PNF ready event to be an array of events
Improve logging in DMaaP simulator
Change-Id: I1c6c76dd7ef742fd474870b0cb23b5bbaa265357
Issue-ID: DCAEGEN2-1501
Signed-off-by: grabinsk <maciej.grabinski@nokia.com>
Diffstat (limited to 'tests/dcaegen2')
6 files changed, 38 insertions, 22 deletions
diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-pnf-ready-event.json index 9da0201c..0ccc1dfb 100644 --- a/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-pnf-ready-event.json +++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-attachment-point/expected-pnf-ready-event.json @@ -1,6 +1,8 @@ -{ - "additionalFields": { - "attachmentPoint": "bbs-link" - }, - "correlationId": "NOK6061ZW9" -} +[ + { + "additionalFields": { + "attachmentPoint": "bbs-link" + }, + "correlationId": "NOK6061ZW9" + } +]
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-additional-fields/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-additional-fields/expected-pnf-ready-event.json index 6c92285c..7d6c240b 100644 --- a/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-additional-fields/expected-pnf-ready-event.json +++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-additional-fields/expected-pnf-ready-event.json @@ -1,3 +1,5 @@ -{ - "correlationId": "NOK6061ZW8" -} +[ + { + "correlationId": "NOK6061ZW8" + } +]
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/expected-pnf-ready-event.json index 75cb4a2e..d2cf9547 100644 --- a/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/expected-pnf-ready-event.json +++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-empty-attachment-point/expected-pnf-ready-event.json @@ -1,6 +1,8 @@ -{ - "additionalFields": { - "attachmentPoint": "" - }, - "correlationId": "NOK6061ZW8" -} +[ + { + "additionalFields": { + "attachmentPoint": "" + }, + "correlationId": "NOK6061ZW8" + } +]
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-without-additional-fields/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-without-additional-fields/expected-pnf-ready-event.json index 4ac7f6e3..7d6c240b 100644 --- a/tests/dcaegen2/prh-testcases/assets/ves-event-without-additional-fields/expected-pnf-ready-event.json +++ b/tests/dcaegen2/prh-testcases/assets/ves-event-without-additional-fields/expected-pnf-ready-event.json @@ -1,3 +1,5 @@ -{ - "correlationId": "NOK6061ZW8" -}
\ No newline at end of file +[ + { + "correlationId": "NOK6061ZW8" + } +]
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot index 5680f2f4..bdf12acd 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -96,8 +96,12 @@ Set VES event in DMaaP Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As JSON - [Arguments] ${given} ${expected} - Should Be True ${given}==${expected} + [Arguments] ${actual} ${expected} + Log EXPECTED: ${expected} + Log ACTUAL: ${actual} + ${expected_json}= Evaluate json.loads("""${expected}""") json + ${actual_json}= Evaluate json.loads("""${actual}""") json + Should Be Equal ${actual_json} ${expected_json} Create sessions Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL} diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py index 92985cb6..7507a46b 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py @@ -41,7 +41,7 @@ class DmaapSetup(BaseHTTPRequestHandler): global ves_event ves_event = httpServerLib.get_payload(self) httpServerLib.set_response_200_ok(self) - logger.debug('DmaapSetup PUT /setup/ves_event -> 200 OK') + logger.debug('DmaapSetup PUT /setup/ves_event -> 200 OK, content: ' + ves_event.decode("utf-8")) else: httpServerLib.set_response_404_not_found(self) logger.info('DmaapSetup PUT ' + self.path + ' -> 404 Not found') @@ -73,7 +73,8 @@ class DMaaPHandler(BaseHTTPRequestHandler): global captured_prh_event captured_prh_event = httpServerLib.get_payload(self) httpServerLib.set_response_200_ok(self) - logger.debug('DMaaPHandler POST /events/unauthenticated.PNF_READY -> 200') + logger.debug('DMaaPHandler POST /events/unauthenticated.PNF_READY -> 200, content: ' + + captured_prh_event.decode("utf-8")) else: httpServerLib.set_response_404_not_found(self) logger.info('DMaaPHandler POST ' + self.path + ' -> 404 Not found') @@ -86,6 +87,9 @@ class DMaaPHandler(BaseHTTPRequestHandler): if re.search('/events/unauthenticated.VES_PNFREG_OUTPUT/OpenDCAE-c12/c12', self.path): global ves_event httpServerLib.set_response_200_ok(self, payload = ves_event) + logger.debug( + 'DMaaPHandler GET /events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12 -> 200, content: ' + + ves_event.decode("utf-8")) ves_event = DMAAP_EMPTY logger.debug('DMaaPHandler GET /events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12 -> 200') else: |