From 6ea412abf249a2266b01aa7036a550b5c7807954 Mon Sep 17 00:00:00 2001 From: Ken Zangelin Date: Wed, 11 Dec 2024 10:31:21 +0100 Subject: [PATCH] More REGEX needed for a functest. Added one more functest --- ...xt_in_subscription_and_broker_restart.test | 4 +- ...xt_in_subscription_and_broker_restart.test | 367 ++++++++++++++++++ 2 files changed, 369 insertions(+), 2 deletions(-) create mode 100644 test/functionalTest/cases/0000_ngsild/ngsild_new_complex_context_in_subscription_and_broker_restart.test diff --git a/test/functionalTest/cases/0000_ngsild/ngsild_complex_context_in_subscription_and_broker_restart.test b/test/functionalTest/cases/0000_ngsild/ngsild_complex_context_in_subscription_and_broker_restart.test index 57d96eee96..96eb199db1 100644 --- a/test/functionalTest/cases/0000_ngsild/ngsild_complex_context_in_subscription_and_broker_restart.test +++ b/test/functionalTest/cases/0000_ngsild/ngsild_complex_context_in_subscription_and_broker_restart.test @@ -206,7 +206,7 @@ Date: REGEX(.*) 04. GET the subscription - see especially its jsonldContext =========================================================== HTTP/1.1 200 OK -Content-Length: 750 +Content-Length: REGEX(.*) Content-Type: application/json Date: REGEX(.*) Link: /dev/null +echo +echo + + +echo "06. Dump and reset the accumulator - see one notification" +echo "=========================================================" +accumulatorDump +accumulatorReset +echo +echo + + +echo "06. See the jsonldContext in mongo" +echo "==================================" +contextId=$(echo $jsonldContext | awk -F jsonldContexts/ '{ print $2 }') +mongoCmd2 orionld 'db.contexts.findOne({"_id": "'$contextId'"})' +echo +echo + + +echo "07. Restart the broker" +echo "======================" +brokerStop CB +brokerStart CB +echo "The broker should be running again" +echo +echo + + +echo "08. GET the subscription 'urn:s1', make sure all is OK" +echo "======================================================" +orionCurl --url /ngsi-ld/v1/subscriptions/urn:s1 +echo +echo + + +echo "09. GET the jsonldContext of the subscription" +echo "=============================================" +curl $jsonldContext 2> /dev/null +echo +echo +echo + + +--REGEXPECT-- +01. Create an entity urn:ngsi-ld:test_entity_id, as from the issue #1708 +======================================================================== +HTTP/1.1 201 Created +Content-Length: 0 +Date: REGEX(.*) +Location: /ngsi-ld/v1/entities/urn:ngsi-ld:test_entity_id + + + +02. Create a matching subscription 'urn:s1' (with a complex @context), to notify the accumulator +================================================================================================ +HTTP/1.1 201 Created +Content-Length: 0 +Date: REGEX(.*) +Location: /ngsi-ld/v1/subscriptions/urn:s1 + + + +03. Modify the entity, to provoke a notification to the accumulator +=================================================================== +HTTP/1.1 204 No Content +Date: REGEX(.*) + + + +04. GET the subscription - see especially its jsonldContext +=========================================================== +HTTP/1.1 200 OK +Content-Length: REGEX(.*) +Content-Type: application/json +Date: REGEX(.*) +Link: