Skip to content

Commit

Permalink
refactor: Change to use new flattened Consul paths
Browse files Browse the repository at this point in the history
closes #743

Signed-off-by: Leonard Goodell <leonard.goodell@intel.com>
  • Loading branch information
Leonard Goodell authored and cherrycl committed Dec 14, 2022
1 parent b52153c commit 09ae719
Show file tree
Hide file tree
Showing 22 changed files with 33 additions and 40 deletions.
4 changes: 2 additions & 2 deletions TAF/config/global_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

LOG_LEVEL = "INFO"

# Version in the Consul path for all services
CONSUL_CONFIG_VERSION = "2.0"
# Base endpoint in the Consul path for all services
CONSUL_CONFIG_BASE_ENDPOINT = "/v1/kv/edgex/v3"

# API Version
API_VERSION = "v2"
Expand Down
8 changes: 4 additions & 4 deletions TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ Suite Teardown for App Service
Run Teardown Keywords

Set ${service} Functions ${functions}
${path}= Set variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/${service}/Writable/Pipeline/ExecutionOrder
${path}= Set variable ${CONSUL_CONFIG_BASE_ENDPOINT}/${service}/Writable/Pipeline/ExecutionOrder
Update Service Configuration On Consul ${path} ${functions}

Set Transform Type ${type}
${path}= Set variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-functional-tests/Writable/Pipeline/Functions/Transform/Parameters/Type
${path}= Set variable ${CONSUL_CONFIG_BASE_ENDPOINT}/app-functional-tests/Writable/Pipeline/Functions/Transform/Parameters/Type
Update Service Configuration On Consul ${path} ${type}

Set Compress Algorithm ${algorithm}
${path}= Set variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-functional-tests/Writable/Pipeline/Functions/Compress/Parameters/Algorithm
${path}= Set variable ${CONSUL_CONFIG_BASE_ENDPOINT}/app-functional-tests/Writable/Pipeline/Functions/Compress/Parameters/Algorithm
Update Service Configuration On Consul ${path} ${algorithm}

Set Encrypt Algorithm ${algorithm}
${path}= Set variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-functional-tests/Writable/Pipeline/Functions/Encrypt/Parameters/Algorithm
${path}= Set variable ${CONSUL_CONFIG_BASE_ENDPOINT}/app-functional-tests/Writable/Pipeline/Functions/Encrypt/Parameters/Algorithm
Update Service Configuration On Consul ${path} ${algorithm}

Trigger Function Pipeline With ${data}
Expand Down
9 changes: 3 additions & 6 deletions TAF/testCaseModules/keywords/common/metrics.robot
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ Resource TAF/testCaseModules/keywords/app-service/AppServiceAPI.robot

*** Keywords ***
Set Telemetry ${config}=${value} For ${service_name} On Consul
${service_layer} Set Variable If 'device' in """${service_name}""" devices
... 'core' in """${service_name}""" core
... 'app' in """${service_name}""" appservices
${telemetry_path} Set Variable /v1/kv/edgex/${service_layer}/${CONSUL_CONFIG_VERSION}/${service_name}/Writable/Telemetry
${telemetry_path} Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/${service_name}/Writable/Telemetry
${path} Set Variable ${telemetry_path}/${config}
Update Service Configuration On Consul ${path} ${value}

Set Topics For app-samle PerTopicPipelines On Consul
${perTopics} Create List float int8-16
${path} Set Variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-sample/Writable/Pipeline/PerTopicPipelines
${path} Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/app-sample/Writable/Pipeline/PerTopicPipelines
FOR ${ITEM} IN @{perTopics}
${topics_path} Set Variable ${path}/${ITEM}/Topics
Update Service Configuration On Consul ${topics_path} edgex/events/device/#/${device_name}/#
Expand Down Expand Up @@ -104,5 +101,5 @@ Get First Lines
[Return] ${list}

Set PerTopicPipelines ${perTopicPipeline} ExecutionOrder ${functions}
${path}= Set variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-sample/Writable/Pipeline/PerTopicPipelines/${perTopicPipeline}/ExecutionOrder
${path}= Set variable ${CONSUL_CONFIG_BASE_ENDPOINT}/app-sample/Writable/Pipeline/PerTopicPipelines/${perTopicPipeline}/ExecutionOrder
Update Service Configuration On Consul ${path} ${functions}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ${deviceResourceUri} /api/${API_VERSION}/deviceresource
${deviceUri} /api/${API_VERSION}/device
${provisionWatcherUri} /api/${API_VERSION}/provisionwatcher
${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/coreMetadataAPI.log
${uomValidationPath} /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/core-metadata/Writable/UoM/Validation
${uomValidationPath} ${CONSUL_CONFIG_BASE_ENDPOINT}/core-metadata/Writable/UoM/Validation
@{device_service_list} device-virtual device-modbus device-rest

*** Keywords ***
Expand Down Expand Up @@ -749,7 +749,7 @@ Create A Provision Watcher Sample With Associated Test-Device-Service And ${devi
Create provision watcher ${provisionwatcher}

Set ProfileChange.${config}=${value} For Core-Metadata On Consul
${path}= Set Variable /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/core-metadata/Writable/ProfileChange/${config}
${path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/core-metadata/Writable/ProfileChange/${config}
Update Service Configuration On Consul ${path} ${value}

## UoM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ System Agent Controls Services
Set Response to Test Variables ${resp}

Update MetricsMechanism To ${value} On Consul
${mechanism_path}= Set Variable /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/sys-mgmt-agent/MetricsMechanism
${mechanism_path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/sys-mgmt-agent/MetricsMechanism
Update Service Configuration On Consul ${mechanism_path} ${value}
Restart Services system
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ ErrTriggerPOST002 - Trigger pipeline fails (Unprocessable Entity)
*** Keywords ***
Accept raw data
[Arguments] ${bool}
${path}= Set variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-functional-tests/Writable/Pipeline/UseTargetTypeOfByteArray
${path}= Set variable ${CONSUL_CONFIG_BASE_ENDPOINT}/app-functional-tests/Writable/Pipeline/UseTargetTypeOfByteArray
Update Service Configuration On Consul ${path} ${bool}

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ErrEventGET005 - Query events by start/end time fails (Start>End)
And Response Time Should Be Less Than "${default_response_time_threshold}"ms

ErrEventGET006 - Query event fails when persistData is false
${path}= Set Variable /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/core-data/Writable/PersistData
${path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/core-data/Writable/PersistData
Given Update Service Configuration On Consul ${path} false
And Generate Event Sample Event Device-Test-001 Profile-Test-001 Command-Test-001 Simple Reading
And Create Event With Device-Test-001 And Profile-Test-001 And Command-Test-001
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ Events Should Be Created Between ${start} And ${end}
END

Set MaxResultCount=${number} For Core-Data On Consul
${path}= Set Variable /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/core-data/Service/MaxResultCount
${path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/core-data/Service/MaxResultCount
Update Service Configuration On Consul ${path} ${number}
Restart Services data
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Create A Subscriptions And Notifications
sleep 3s # Waiting for the resend process to finish

Set Writable configs: resendInterval=${resendInterval} and resendLimit=${resendLimit}
${path}= Set variable /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/support-notifications/Writable
${path}= Set variable ${CONSUL_CONFIG_BASE_ENDPOINT}/support-notifications/Writable
Update Service Configuration On Consul ${path}/ResendInterval ${resendInterval}
Update Service Configuration On Consul ${path}/ResendLimit ${resendLimit}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ IntervalactionPOST002 - Create pre-created intervalaction with pre-created inter

*** Keywords ***
Set support-scheduler configs ScheduleIntervalTime=${millisecond} And LogLevel=${logLevel}
Set Test Variable ${consul_path} /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/support-scheduler
Set Test Variable ${consul_path} ${CONSUL_CONFIG_BASE_ENDPOINT}/support-scheduler
Update Service Configuration On Consul ${consul_path}/Writable/LogLevel ${logLevel}
Update Service Configuration On Consul ${consul_path}/ScheduleIntervalTime ${millisecond}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Force Tags v2-api
*** Variables ***
${SUITE} System Management Agent POST Negative Test Cases
${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/system-agent-post-negative.log
${metadata_path} /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/core-metadata/Service/StartupMsg
${metadata_path} ${CONSUL_CONFIG_BASE_ENDPOINT}/core-metadata/Service/StartupMsg
${keyword} service has been restart

*** Test Cases ***
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ SysMgmtPOST002 - Stop services by system management agent
SysMgmtPOST003 - Restart services by system management agent
${service_name_list}= Create List app-service-rules device-rest
${container_name_list}= Create List app-rules-engine device-rest
${app_path}= Set Variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-rules-engine/Service/StartupMsg
${device_path}= Set Variable /v1/kv/edgex/devices/${CONSUL_CONFIG_VERSION}/device-rest/Service/StartupMsg
${app_path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/app-rules-engine/Service/StartupMsg
${device_path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/device-rest/Service/StartupMsg
${keyword}= Set Variable service has been restart
Given Update Service Configuration On Consul ${app_path} ${keyword}
And Update Service Configuration On Consul ${device_path} ${keyword}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ Config006 - Verfiy reading contains units when ReadingUnits is false

*** Keywords ***
Set Device ${config} to ${value} For ${service_name} On Consul
${path}= Set Variable /v1/kv/edgex/devices/${CONSUL_CONFIG_VERSION}/${service_name}/Device/${config}
${path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/${service_name}/Device/${config}
Update Service Configuration On Consul ${path} ${value}
Restart Services device-virtual

Set Writable.Reading.ReadingUnits to ${value} For ${service_name} On Consul
${path}= Set Variable /v1/kv/edgex/devices/${CONSUL_CONFIG_VERSION}/${service_name}/Writable/Reading/ReadingUnits
${path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/${service_name}/Writable/Reading/ReadingUnits
Update Service Configuration On Consul ${path} ${value}

Retrive device data by device ${device_name} and command ${command}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ DeviceService010-Create Events by REST API when messagebus is disabled

*** Keywords ***
Set UseMessageBus=${value} For device-virtual On Consul
${path}= Set Variable /v1/kv/edgex/devices/${CONSUL_CONFIG_VERSION}/device-virtual/Device/UseMessageBus
${path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/device-virtual/Device/UseMessageBus
Update Service Configuration On Consul ${path} ${value}
Restart Services device-virtual
Set Suite Variable ${url} ${deviceServiceUrl}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ DeviceService005-Customize PublishTopicPrefix works correctly when using Redis m

*** Keywords ***
Set ${config}=${value} For ${service_name} On Consul
${service_layer} Set Variable If 'device' in """${service_name}""" devices
... 'core' in """${service_name}""" core
${path}= Set Variable /v1/kv/edgex/${service_layer}/${CONSUL_CONFIG_VERSION}/${service_name}/MessageQueue/${config}
${path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/${service_name}/MessageQueue/${config}
Update Service Configuration On Consul ${path} ${value}
${service} Run Keyword If 'core' in """${service_name}""" Fetch From Right ${service_name} -
... ELSE Set Variable ${service_name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Set ${configurations} For ${service_name} On Consul
${config_key} Get Dictionary Keys ${configurations} sort_keys=false
${config_value} Get Dictionary Values ${configurations} sort_keys=false
FOR ${key} ${value} IN ZIP ${config_key} ${config_value}
${path}= Set Variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/${service_name}/Writable/StoreAndForward/${key}
${path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/${service_name}/Writable/StoreAndForward/${key}
Update Service Configuration On Consul ${path} ${value}
END

Expand Down Expand Up @@ -113,7 +113,7 @@ Found Remove Log In ${service_name} Logs From ${timestamp}
Should Be Equal As Integers ${retry_times} 1

Modify PersistOnError to ${value} On Consul
${path} Set Variable /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-http-export/Writable/Pipeline/Functions/HTTPExport/Parameters/PersistOnError
${path} Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/app-http-export/Writable/Pipeline/Functions/HTTPExport/Parameters/PersistOnError
Update Service Configuration On Consul ${path} ${value}
Restart Services app-service-http-export
Sleep 4s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Update Device
Update devices ${Device}

Set Core-Metadata PostDeviceChanges=${bool}
${path}= Set Variable v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/core-metadata/Notifications/PostDeviceChanges
${path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/core-metadata/Notifications/PostDeviceChanges
Update Service Configuration On Consul ${path} ${bool}
Restart Services metadata

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Resource TAF/testCaseModules/keywords/common/metrics.robot
Suite Setup Run keywords Setup Suite
... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Get Token
... AND Set Telemetry Interval=${interval}s For app-sample On Consul
... AND Update Service Configuration On Consul /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-sample/Writable/LogLevel DEBUG
... AND Update Service Configuration On Consul ${CONSUL_CONFIG_BASE_ENDPOINT}/app-sample/Writable/LogLevel DEBUG
Suite Teardown Run keywords Terminate All Processes
... AND Delete all events by age
... AND Set Telemetry Interval=30s For app-sample On Consul
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Resource TAF/testCaseModules/keywords/common/metrics.robot
Suite Setup Run keywords Setup Suite
... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Get Token
... AND Set Telemetry Interval=${interval}s For app-sample On Consul
... AND Update Service Configuration On Consul /v1/kv/edgex/appservices/${CONSUL_CONFIG_VERSION}/app-sample/Writable/LogLevel DEBUG
... AND Update Service Configuration On Consul ${CONSUL_CONFIG_BASE_ENDPOINT}/app-sample/Writable/LogLevel DEBUG
Suite Teardown Run keywords Terminate All Processes
... AND Delete all events by age
... AND Set Telemetry Interval=30s For app-sample On Consul
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Force Tags MessageQueue=MQTT

*** Variables ***
${SUITE} Core-Data-Configrations
${DATA_CONSOL_PATH} /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/core-data
${DATA_CONSOL_PATH} ${CONSUL_CONFIG_BASE_ENDPOINT}/core-data

*** Test Cases ***
CoreConfig001 - Set core-data MessageQueue.SubscribeEnabled to false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,14 @@ Config003 - Set device-virtual MessageQueue.Optional.Qos (PUBLISH)

*** Keywords ***
Set MessageQueue ${key}=${value} For ${service_name} On Consul
${service_layer} Run Keyword If "core" in "${service_name}" Set Variable core
... ELSE IF "device" in "${service_name}" Set Variable devices
${path}= Set Variable /v1/kv/edgex/${service_layer}/${CONSUL_CONFIG_VERSION}/${service_name}/MessageQueue/${key}
${path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/${service_name}/MessageQueue/${key}
Update Service Configuration On Consul ${path} ${value}
${service} Run Keyword If "data" in "${service_name}" Set Variable data
... ELSE Set Variable ${service_name}
Restart Services ${service}

Set Writable LogLevel To Debug For ${service_name} On Consul
${path}= Set Variable /v1/kv/edgex/devices/${CONSUL_CONFIG_VERSION}/${service_name}/Writable/LogLevel
${path}= Set Variable ${CONSUL_CONFIG_BASE_ENDPOINT}/${service_name}/Writable/LogLevel
Update Service Configuration On Consul ${path} DEBUG

Retrive device data by device ${device_name} and command ${command}
Expand Down
2 changes: 1 addition & 1 deletion TAF/testScenarios/scalabilityTest/modbus/modbus.robot
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/modbus_scalability_test

*** Test Cases ***
Test Modbus scalability
Given Update Service Configuration On Consul /v1/kv/edgex/core/${CONSUL_CONFIG_VERSION}/core-data/Writable/PersistData false
Given Update Service Configuration On Consul ${CONSUL_CONFIG_BASE_ENDPOINT}/core-data/Writable/PersistData false
And Deploy services edgex-scalability-test-mqtt-export
sleep 30
${report_info} ${records} = When run scalability testing
Expand Down

0 comments on commit 09ae719

Please sign in to comment.