From 4d0da0adf92531c491e0d19fcf88c76e9d285850 Mon Sep 17 00:00:00 2001 From: Ginny Guan Date: Fri, 28 Aug 2020 17:17:22 +0800 Subject: [PATCH] Implement app service V2 API test cases Fix https://github.com/edgexfoundry/edgex-taf/issues/155 Signed-off-by: Ginny Guan --- .../keywords/app-service/AppServiceAPI.robot | 55 ++++++++++++++++++ .../keywords/common/commonKeywords.robot | 56 +++++++++++++++---- TAF/testData/app-service/secrets_data.json | 36 ++++++++++++ TAF/testData/app-service/trigger_data.json | 37 ++++++++++++ .../app-service/trigger_response_content.py | 13 +++++ .../V2-API/app-service/info/GET.robot | 31 +++++++--- .../V2-API/app-service/secrets/POST.robot | 49 +++++++++++++--- .../app-service/trigger/POST-negative.robot | 25 +++++++-- .../app-service/trigger/POST-positive.robot | 40 ++++++++----- .../core-data/UC_readings/add_reading.robot | 2 +- .../docker/docker-compose-end-to-end.yaml | 53 ++++++++++++++++++ TAF/utils/scripts/docker/get-compose-file.sh | 13 +++++ 12 files changed, 364 insertions(+), 46 deletions(-) create mode 100644 TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot create mode 100644 TAF/testData/app-service/secrets_data.json create mode 100644 TAF/testData/app-service/trigger_data.json create mode 100644 TAF/testData/app-service/trigger_response_content.py diff --git a/TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot b/TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot new file mode 100644 index 000000000..fc04395d0 --- /dev/null +++ b/TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot @@ -0,0 +1,55 @@ +*** Settings *** +Library RequestsLibrary +Library OperatingSystem +Library TAF/testCaseModules/keywords/setup/edgex.py +Library TAF/testCaseModules/keywords/setup/startup_checker.py +Library TAF/testCaseModules/keywords/consul/consul.py +Resource TAF/testCaseModules/keywords/common/commonKeywords.robot + +*** Keywords *** +Setup Suite for App Service + [Arguments] ${appServiceUrl} + Run Keywords Setup Suite AND Set Suite Variable ${url} ${appServiceUrl} + ... AND Deploy services app-service-${edgex_profile} + ... AND Check app-service is available + ... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Get Token + +Check app-service is available + ${port}= Split String ${url} : + Check service is available ${port}[2] /api/v2/ping + +Suite Teardown for App Service + Run Keywords Suite Teardown AND Remove services app-service-${edgex_profile} + ... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Remove Token + +Set Functions ${functions} + ${path}= Set variable /v1/kv/edgex/appservices/1.0/AppService-${edgex_profile}/Writable/Pipeline/ExecutionOrder + Modify consul config ${path} ${functions} + sleep 1 + +Trigger Function Pipeline With ${data} + ${trigger_data}= Run keyword if '${data}' != 'Invalid Data' set variable Valid Data + ... ELSE set variable ${data} + ${trigger_data}= Load data file "app-service/trigger_data.json" and get variable "${trigger_data}" + Run keyword if '${data}' == 'No Matching DeviceName' + ... Run keywords set to dictionary ${trigger_data} device="DeiveNotMatch" + ... AND set to dictionary ${trigger_data}[readings][0] device="DeviceNotMatch" + Create Session Trigger url=${url} disable_warnings=true + ${headers}= Create Dictionary Authorization=Bearer ${jwt_token} + ${resp}= Post request Trigger api/${api_version}/trigger json=${trigger_data} headers=${headers} + Set Response to Test Variables ${resp} + Run keyword if ${response} != 200 log to console ${content} + +Store Secret Data With ${data} + ${secrets_data}= Load data file "app-service/secrets_data.json" and get variable "${data}" + Create Session Secrets url=${url} disable_warnings=true + ${headers}= Create Dictionary Authorization=Bearer ${jwt_token} + ${resp}= Post request Secrets api/${api_version}/secrets json=${secrets_data} headers=${headers} + Set Response to Test Variables ${resp} + Run keyword if ${response} != 201 log to console ${content} + ... ELSE Run Keywords Set test variable ${secrets_path} ${secrets_data}[path] + ... AND Set test variable ${secrets_key} ${secrets_data}[secrets][0][key] + ... AND Set test variable ${secrets_value} ${secrets_data}[secrets][0][value] + + + diff --git a/TAF/testCaseModules/keywords/common/commonKeywords.robot b/TAF/testCaseModules/keywords/common/commonKeywords.robot index 30445002d..16c08e60e 100644 --- a/TAF/testCaseModules/keywords/common/commonKeywords.robot +++ b/TAF/testCaseModules/keywords/common/commonKeywords.robot @@ -68,20 +68,19 @@ Get random "${value}" from "${list}" ${random_value}= convert to string ${random}[${value}] [Return] ${random_value} -Should return status code "200" - Should be true ${response} == 200 +Should return status code "${status_code}" + Should be true ${response} == ${status_code} -Should return status code "400" - Should be true ${response} == 400 +Should return Content-Type "${content_type}" + Should be true '${headers}' == '${content_type}' -Should return status code "404" - Should be true ${response} == 404 +Should contain "${element}" + Should Not be empty ${content}[${element}] -Should return status code "423" - Should be true ${response} == 423 - -Should return status code "500" - Should be true ${response} == 500 +Should Return Status Code "${status_code}" And ${element} + Should return status code "${status_code}" + Should return Content-Type "application/json" + Should contain "${element}" Get current milliseconds epoch time ${current_epoch_time}= Get current epoch time @@ -126,3 +125,38 @@ Load data file "${json_file}" and get variable "${use_variable}" ${json_string}= Evaluate json.loads('''${json_data}''') json [Return] ${json_string}[${use_variable}] +Set Response to Test Variables + [Arguments] ${resp} + Set test variable ${response} ${resp.status_code} + ${headers}= Run keyword if 'Content-Type' in ${resp.headers} Set variable ${resp.headers}[Content-Type] + ... ELSE Set variable None + ${content}= Run Keyword If '${headers}' == 'application/json' Evaluate json.loads('''${resp.content}''') json + ... ELSE Set variable ${resp.content} + Set test variable ${headers} ${headers} + Set test variable ${content} ${content} + +Query Ping + ${headers}= Create Dictionary Authorization=Bearer ${jwt_token} + Create Session Ping url=${url} disable_warnings=true + ${resp}= Get request Ping api/${api_version}/ping headers=${headers} + Set Response to Test Variables ${resp} + +Query Config + ${headers}= Create Dictionary Authorization=Bearer ${jwt_token} + Create Session Config url=${url} disable_warnings=true + ${resp}= Get request Config api/${api_version}/config headers=${headers} + Set Response to Test Variables ${resp} + +Query Version + ${headers}= Create Dictionary Authorization=Bearer ${jwt_token} + Create Session Ping url=${url} disable_warnings=true + ${resp}= Get request Ping api/${api_version}/version headers=${headers} + Set Response to Test Variables ${resp} + +Query Metrics + ${headers}= Create Dictionary Authorization=Bearer ${jwt_token} + Create Session Ping url=${url} disable_warnings=true + ${resp}= Get request Ping api/${api_version}/metrics headers=${headers} + Set Response to Test Variables ${resp} + + diff --git a/TAF/testData/app-service/secrets_data.json b/TAF/testData/app-service/secrets_data.json new file mode 100644 index 000000000..5a8348d60 --- /dev/null +++ b/TAF/testData/app-service/secrets_data.json @@ -0,0 +1,36 @@ +{ + "Empty Path": { + "path" : "", + "secrets" : [ + { + "key" : "MySecretKey", + "value" : "MySecretValue" + } + ] + }, + "Path": { + "path" : "MyPath", + "secrets" : [ + { + "key" : "MySecretKey", + "value" : "MySecretValue" + } + ] + }, + "Missing Key": { + "path" : "MyPath", + "secrets" : [ + { + "value" : "MySecretValue" + } + ] + }, + "Missing Value": { + "path" : "MyPath", + "secrets" : [ + { + "key" : "MySecretKey" + } + ] + } +} diff --git a/TAF/testData/app-service/trigger_data.json b/TAF/testData/app-service/trigger_data.json new file mode 100644 index 000000000..723859f2d --- /dev/null +++ b/TAF/testData/app-service/trigger_data.json @@ -0,0 +1,37 @@ +{ + "Valid Data": { + "id": "5bd794de0e36080001f53eab", + "pushed": 0, + "device": "Random-Float-Device", + "created": 1540855006481, + "modified": 0, + "origin": 1540855006469, + "schedule": null, + "event": null, + "readings": [ + { + "id": "5bd794de0e36080001f53eac", + "pushed": 0, + "created": 1540855006481, + "origin": 1540855006469, + "modified": 0, + "device": "Random-Float-Device", + "name": "RandomValue_Float64", + "value": "QAFk2HxRUOo=" + } + ] + }, + "Invalid Data": { + "id": "5bd794de0e36080001f53eab", + "origin": 1540855006469, + "readings": [ + { + "id": "5bd794de0e36080001f53eac", + "origin": 1540855006469, + "device": "Random-Float-Device", + "name": "RandomValue_Float64", + "value": "QAFk2HxRUOo=" + } + ] + } +} diff --git a/TAF/testData/app-service/trigger_response_content.py b/TAF/testData/app-service/trigger_response_content.py new file mode 100644 index 000000000..818910d41 --- /dev/null +++ b/TAF/testData/app-service/trigger_response_content.py @@ -0,0 +1,13 @@ +trigger_content={ + "XML String": '5bd794de0e36080001f53eab0Random-Float-Device' + '154085500648101540855006469' + '5bd794de0e36080001f53eac015408550064811540855006469' + '0Random-Float-DeviceRandomValue_Float64QAFk2HxRUOo=' + '', + "JSON String": '{"id":"5bd794de0e36080001f53eab","device":"Random-Float-Device","created":1540855006481,"origin":1540855006469,' + '"readings":[{"id":"5bd794de0e36080001f53eac","created":1540855006481,"origin":1540855006469,' + '"device":"Random-Float-Device","name":"RandomValue_Float64","value":"QAFk2HxRUOo="}]}', + "JSON-GZIP String": 'H4sIAAAAAAAA/5SOwYrCMBiE32XOKfzdJtk2sIeFpext2YJeRCRtfkuwTaDWIkjfXdSDeFE8zjfDzJzgHQxU7T4L6Zg405QTUbpVGdsaAo4n3zAMKhtc7JOyi3ZMfm5UoBnYjuxgUiUpV4pIyzwViINvfXjAuhAY2Dof2j3M6vl08373i6fB9ndzabsDb64JLSEwXTQM/r/L3cfvsVr8xS/M6/kcAAD//766olAgAQAA', + "JSON-ZLIB String": 'eJyUjsGKwjAYhN9lzin83SbZNrCHhaXsbdmCXkQkbX5LsE2g1iJI313Ug3hRPM43w8yc4B0MVO0+C+mYONOUE1G6VRnbGgKOJ98wDCobXOyTsot2TH5uVKAZ2I7sYFIlKVeKSMs8FYiDb314wLoQGNg6H9o9zOr5dPN+94unwfZ3c2m7A2+uCS0hMF00DP6/y93H77Fa/MUvzOv5HAAA//9QTVQF', + "JSON-ZLIB-AES String": '7E/CbWn7FhxheP2OgLT1OFCquTKtVXGVDLqjX8EWL8vlnYEhRIKII2KA9MJQlXx5pxXzMkA8dYW5uXDpm4UbKqVVpi7QqQoYPJ4tBo0D7LIT4NJpRwg5qAXQ0FaZtEPvO6tpK1KA1wWMrnj9uXCa2zphifSxDRG+W2Hbm/Hc2GItheZI+yS2+2nbuANVOhtBeYblT31B1rr4wPX4wCxwzil2SVSLRclR3eLy/fiokzv3s423em5TsN34SsG5R9JcsEPZtAt9tTWhw2k8vY8osJd1ZWOq1S0s3+Hkscp2mO9d+NUBZD+MbMwUPTrdfCCkh9pTCQIBs5OSkGxIb2JVHCzutX+kC6MJnE+KfmHKezfF+AlgzHKZ5rScPrkbnO7Cp5aJ6Aarw0dhog97y/Q2K/CsE5A9W1L/bgIP1W/EgZm94rtDFqGnzGP8FihHSeLn' +} diff --git a/TAF/testScenarios/functionalTest/V2-API/app-service/info/GET.robot b/TAF/testScenarios/functionalTest/V2-API/app-service/info/GET.robot index ed3163464..432736e6f 100644 --- a/TAF/testScenarios/functionalTest/V2-API/app-service/info/GET.robot +++ b/TAF/testScenarios/functionalTest/V2-API/app-service/info/GET.robot @@ -1,28 +1,43 @@ *** Settings *** -Resource TAF/testCaseModules/keywords/common/commonKeywords.robot -Suite Setup Run Keywords Setup Suite AND Deploy App Service -Suite Teardown Run Keywords Suite Teardown AND Remove App Service +Resource TAF/testCaseModules/keywords/common/commonKeywords.robot +Resource TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot +Suite Setup Setup Suite for App Service ${AppServiceUrl_blackbox} +Suite Teardown Suite Teardown for App Service +Default Tags v2-api *** Variables *** ${SUITE} App-Service GET Testcases ${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/app-service-get.log ${edgex_profile} blackbox-tests +${AppServiceUrl_blackbox} http://${BASE_URL}:48095 +${api_version} v2 *** Test Cases *** InfoGET001 - Query ping When Query Ping - Then Should Return Status Code "200" And Timestamp + Then Should Return Status Code "200" And timestamp + And apiVersion Should be ${api_version} InfoGET002 - Query version When Query Version - Then Should Return Status Code "200" And Version - And Should Return SDK Version + Then Should Return Status Code "200" And version + And Should Return SDK Version + And apiVersion Should be ${api_version} InfoGET003 - Query metrics When Query Metrics - Then Should Return Status Code "200" And Metrics + Then Should Return Status Code "200" And metrics + And apiVersion Should be ${api_version} InfoGET004 - Query config When Query Config - Then Should Return Status Code "200" And Config + Then Should Return Status Code "200" And config + And apiVersion Should be ${api_version} +**** Keywords *** +Should Return SDK Version + Should contain "sdk_version" + +apiVersion Should be ${api_version} + Should contain "apiVersion" + Should be true '${content}[apiVersion]' == '${api_version}' diff --git a/TAF/testScenarios/functionalTest/V2-API/app-service/secrets/POST.robot b/TAF/testScenarios/functionalTest/V2-API/app-service/secrets/POST.robot index 8f35689aa..c7cb0cacb 100644 --- a/TAF/testScenarios/functionalTest/V2-API/app-service/secrets/POST.robot +++ b/TAF/testScenarios/functionalTest/V2-API/app-service/secrets/POST.robot @@ -1,23 +1,28 @@ *** Settings *** -Resource TAF/testCaseModules/keywords/common/commonKeywords.robot -Suite Setup Run Keywords Setup Suite AND Deploy App Service -Suite Teardown Run Keywords Suite Teardown AND Remove App Service +Library Process +Resource TAF/testCaseModules/keywords/common/commonKeywords.robot +Resource TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot +Suite Setup Setup Suite for App Service Secrets +Suite Teardown Suite Teardown for App Service +Default Tags v2-api *** Variables *** ${SUITE} App-Service Secrets POST Testcases ${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/app-service-secrets.log -${edgex_profile} http-export +${api_version} v2 *** Test Cases *** SecretsPOST001 - Stores secrets to the secret client - When Store Secret Data + When Store Secret Data With Empty Path Then Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' - ... Should Return Status Code "201" + ... Run keywords Should Return Status Code "201" + ... AND Secrets Should be Stored -SecretsPOST002 - Stores secrets to the secret client With Path +SecretsPOST002 - Stores secrets to the secret client with Path When Store Secret Data With Path Then Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' - ... Should Return Status Code "201" + ... Run keywords Should Return Status Code "201" + ... AND Secrets Should be Stored ErrSecretsPOST001 - Stores secrets to the secret client fails (missing key) When Store Secret Data With Missing Key @@ -32,5 +37,31 @@ ErrSecretsPOST002 - Stores secrets to the secret client fails (missing value) ErrSecretsPOST003 - Stores secrets to the secret client fails (security not enabled) When Store Secret Data With Path Then Run Keyword if $SECURITY_SERVICE_NEEDED == 'false' - ... Should Return Status Code "500" + ... Should Return Status Code "500" + +*** Keywords *** +Setup Suite for App Service Secrets + Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Run Keywords + #EDGEX_SECURITY_SECRET_STORE: "true" + ... Set Suite Variable ${edgex_profile} http-export-secrets + ... AND Setup Suite for App Service http://${BASE_URL}:48098 + #EDGEX_SECURITY_SECRET_STORE: "false" + ... ELSE Run keywords Set Suite Variable ${edgex_profile} http-export + ... AND Setup Suite for App Service http://${BASE_URL}:48096 + +Get AppService Token + ${command}= Set Variable docker exec app-service-${edgex_profile} cat /tmp/edgex/secrets/appservice-${edgex_profile}/secrets-token.json + ${result} = Run Process ${command} shell=yes output_encoding=UTF-8 + ${result_string}= Evaluate json.loads('''${result.stdout}''') json + Set Test Variable ${token} ${result_string}[auth][client_token] + +Secrets Should be Stored + Get AppService Token + Create Session GetSecrets url=https://${BASE_URL}:8200 disable_warnings=true + ${headers}= Create Dictionary X-Vault-Token ${token} + ${resp}= Get request GetSecrets /v1/secret/edgex/appservice-${edgex_profile}/${secrets_path} headers=${headers} + Set Response to Test Variables ${resp} + Run keyword if ${response} != 200 log to console ${content} + Should Contain ${content}[data] ${secrets_key} ${secrets_value} + diff --git a/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-negative.robot b/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-negative.robot index 0f25557cb..e62ddc451 100644 --- a/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-negative.robot +++ b/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-negative.robot @@ -1,18 +1,35 @@ *** Settings *** -Resource TAF/testCaseModules/keywords/common/commonKeywords.robot -Suite Setup Run Keywords Setup Suite AND Deploy App Service -Suite Teardown Run Keywords Suite Teardown AND Remove App Service +Resource TAF/testCaseModules/keywords/common/commonKeywords.robot +Resource TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot +Library TAF/testCaseModules/keywords/consul/consul.py +Suite Setup Setup Suite for App Service ${AppServiceUrl_blackbox} +Suite Teardown Suite Teardown for App Service +Default Tags v2-api *** Variables *** ${SUITE} App-Service Trigger POST Negative Testcases ${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/app-service-trigger-negative.log ${edgex_profile} blackbox-tests +${AppServiceUrl_blackbox} http://${BASE_URL}:48095 +${api_version} v2 *** Test Cases *** ErrTriggerPOST001 - Trigger pipeline fails (Invalid Data) + Given Set Functions FilterByDeviceName, TransformToXML, SetOutputData When Trigger Function Pipeline With Invalid Data Then Should Return Status Code "400" ErrTriggerPOST002 - Trigger pipeline fails (Unprocessable Entity) - When Trigger Function Pipeline With Unprocessable Entity + Given Set Functions FilterByDeviceName, TransformToXML, SetOutputData + And Accept raw data true + When Trigger Function Pipeline With Invalid Data Then Should Return Status Code "422" + [Teardown] Accept raw data false + +*** Keywords *** +Accept raw data + [arguments] ${bool} + ${path}= Set variable /v1/kv/edgex/appservices/1.0/AppService-${edgex_profile}/Writable/Pipeline/UseTargetTypeOfByteArray + Modify consul config ${path} ${bool} + sleep 1 + diff --git a/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-positive.robot b/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-positive.robot index 71b1da887..35e624460 100644 --- a/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-positive.robot +++ b/TAF/testScenarios/functionalTest/V2-API/app-service/trigger/POST-positive.robot @@ -1,44 +1,58 @@ *** Settings *** -Resource TAF/testCaseModules/keywords/common/commonKeywords.robot -Suite Setup Run Keywords Setup Suite AND Deploy App Service -Suite Teardown Run Keywords Suite Teardown AND Remove App Service +Resource TAF/testCaseModules/keywords/common/commonKeywords.robot +Resource TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot +Variables TAF/testData/app-service/trigger_response_content.py +Suite Setup Setup Suite for App Service ${AppServiceUrl_blackbox} +Suite Teardown Suite Teardown for App Service +Default Tags v2-api *** Variables *** ${SUITE} App-Service Trigger POST Positive Testcases ${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/app-service-trigger-positive.log ${edgex_profile} blackbox-tests +${AppServiceUrl_blackbox} http://${BASE_URL}:48095 +${api_version} v2 *** Test Cases *** TriggerPOST001 - Trigger pipeline (no match) + Given Set Functions FilterByDeviceName, TransformToXML, SetOutputData When Trigger Function Pipeline With No Matching DeviceName Then Should Return Status Code "200" - And Body Should Match Empty + And Body Should Match Empty TriggerPOST002 - Trigger pipeline (XML) + Given Set Functions FilterByDeviceName, TransformToXML, SetOutputData When Trigger Function Pipeline With Matching DeviceName Then Should Return Status Code "200" - And Body Should Match XML String + And Body Should Match XML String TriggerPOST003 - Trigger pipeline (JSON) - Given Set TransformToJSON + Given Set Functions FilterByDeviceName, TransformToJSON, SetOutputData When Trigger Function Pipeline With Matching DeviceName Then Should Return Status Code "200" - And Body Should Match JSON String + And Body Should Match JSON String TriggerPOST004 - Trigger pipeline (JSON-GZIP) - Given Set CompressWithGZIP + Given Set Functions FilterByDeviceName, TransformToJSON, CompressWithGZIP, SetOutputData When Trigger Function Pipeline With Matching DeviceName Then Should Return Status Code "200" - And Body Should Match JSON String + And Body Should Match JSON-GZIP String TriggerPOST005 - Trigger pipeline (JSON-ZLIB) - Given Set CompressWithZLIB + Given Set Functions FilterByDeviceName, TransformToJSON, CompressWithZLIB, SetOutputData When Trigger Function Pipeline With Matching DeviceName Then Should Return Status Code "200" - And Body Should Match JSON String + And Body Should Match JSON-ZLIB String TriggerPOST006 - Trigger pipeline (JSON-ZLIB-AES) - Given Set EncryptWithAES + Given Set Functions FilterByDeviceName, TransformToXML, CompressWithZLIB, EncryptWithAES, SetOutputData When Trigger Function Pipeline With Matching DeviceName Then Should Return Status Code "200" - And Body Should Match JSON String \ No newline at end of file + And Body Should Match JSON-ZLIB-AES String + +*** Keywords *** +Body Should Match ${type} + ${length}= Get Length ${content} + Run keyword if '${type}' == 'Empty' Should be true ${length}==0 + ... ELSE Should be true '${content}' == '${trigger_content["${type}"]}' + diff --git a/TAF/testScenarios/functionalTest/core-data/UC_readings/add_reading.robot b/TAF/testScenarios/functionalTest/core-data/UC_readings/add_reading.robot index d5d77a05b..08b5c6006 100644 --- a/TAF/testScenarios/functionalTest/core-data/UC_readings/add_reading.robot +++ b/TAF/testScenarios/functionalTest/core-data/UC_readings/add_reading.robot @@ -2,7 +2,7 @@ Documentation Device Readings - Query readings Library OperatingSystem Library Collections -Library TAF/testCaseModules/keywords/common/consul.py +Library TAF/testCaseModules/keywords/consul/consul.py Resource TAF/testCaseModules/keywords/common/commonKeywords.robot Resource TAF/testCaseModules/keywords/core-data/coreDataAPI.robot Resource TAF/testCaseModules/keywords/core-metadata/coreMetadataAPI.robot diff --git a/TAF/utils/scripts/docker/docker-compose-end-to-end.yaml b/TAF/utils/scripts/docker/docker-compose-end-to-end.yaml index 693b3aa21..3dd1031ab 100644 --- a/TAF/utils/scripts/docker/docker-compose-end-to-end.yaml +++ b/TAF/utils/scripts/docker/docker-compose-end-to-end.yaml @@ -53,3 +53,56 @@ networks: - edgex-network + app-service-blackbox-tests: + image: ${appService} + ports: + - "48095:48095" + container_name: app-service-blackbox-tests + hostname: app-service-blackbox-tests + environment: + edgex_profile: blackbox-tests + Service_Host: app-service-blackbox-tests + Clients_CoreData_Host: edgex-core-data + Clients_Logging_Host: edgex-support-logging + Registry_Host: edgex-core-consul + Service_Port: 48095 + EDGEX_SECURITY_SECRET_STORE: "false" + networks: + - edgex-network + + app-service-http-export-secrets: + image: ${appService} + ports: + - "48098:48098" + container_name: app-service-http-export-secrets + hostname: app-service-http-export-secrets + environment: + edgex_profile: http-export + Service_Host: app-service-http-export-secrets + Clients_CoreData_Host: edgex-core-data + Clients_Logging_Host: edgex-support-logging + Registry_Host: edgex-core-consul + Service_Port: 48098 + MessageBus_SubscribeHost_Host: edgex-core-data + Database_Host: edgex-redis + EDGEX_SECURITY_SECRET_STORE: "true" + SecretStore_Protocol: https + SecretStore_Host: edgex-vault + SecretStore_ServerName: edgex-vault + SecretStore_RootCaCertPath: /tmp/edgex/secrets/ca/ca.pem + SecretStore_TokenFile: /tmp/edgex/secrets/edgex-application-service/secrets-token.json + SecretStoreExclusive_Protocol: https + SecretStoreExclusive_Host: edgex-vault + SecretStoreExclusive_ServerName: edgex-vault + SecretStoreExclusive_Path: /v1/secret/edgex/appservice-http-export-secrets/ + SecretStoreExclusive_RootCaCertPath: /tmp/edgex/secrets/ca/ca.pem + SecretStoreExclusive_TokenFile: /tmp/edgex/secrets/appservice-http-export-secrets/secrets-token.json + Writable_Pipeline_Functions_HTTPPostJSON_Parameters_url: http://${DOCKER_HOST_IP}:7770 + Writable_LogLevel: DEBUG + volumes: + - /tmp/edgex/secrets/ca:/tmp/edgex/secrets/ca:ro,z + - /tmp/edgex/secrets/edgex-application-service:/tmp/edgex/secrets/edgex-application-service:ro,z + - /tmp/edgex/secrets/appservice-http-export-secrets:/tmp/edgex/secrets/appservice-http-export-secrets:ro,z + networks: + - edgex-network + diff --git a/TAF/utils/scripts/docker/get-compose-file.sh b/TAF/utils/scripts/docker/get-compose-file.sh index fe1ad9f0e..3da3724f5 100755 --- a/TAF/utils/scripts/docker/get-compose-file.sh +++ b/TAF/utils/scripts/docker/get-compose-file.sh @@ -28,6 +28,19 @@ if [ "$USE_RELEASE" = "nightly-build" ]; then # Insert required services for end to end tests sed -e '/app-service-rules:/r docker-compose-end-to-end.yaml' -e //N temp/device-service-temp.yaml > docker-compose.yaml + if [ "$USE_SECURITY" = '-security-' ]; then + # sed command of MacOS is in different syntax + if [ "$(uname)" = "Darwin" ]; then + sed -i '' "/hostname: edgex-vault-worker/i \\ + \ ADD_SECRETSTORE_TOKENS: appservice-http-export-secrets + " docker-compose.yaml + else + sed -i "/hostname: edgex-vault-worker/i \\ + \ ADD_SECRETSTORE_TOKENS: appservice-http-export-secrets + " docker-compose.yaml + fi + fi + else COMPOSE_FILE="docker-compose-${USE_RELEASE}${USE_DB}${USE_NO_SECURITY}${USE_ARM64}.yml" curl -o ${COMPOSE_FILE} "https://raw.githubusercontent.com/edgexfoundry/developer-scripts/master/releases/${USE_RELEASE}/compose-files/${COMPOSE_FILE}"