diff options
author | Krzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com> | 2022-03-23 10:29:20 +0100 |
---|---|---|
committer | Krzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com> | 2022-03-25 12:06:49 +0000 |
commit | 83837dc5af3df7d89541fee2f6c933369c419c6d (patch) | |
tree | 9849faf4ad42eee751f122306e2f64a1e9080b9d /robot | |
parent | 86c25a966bcaae4beb57c54d3b54e37dca230b7c (diff) |
[ROBOT] Adopt DCAEMOD test cases to helm based deployment
Adopt DCAEMOD test cases to helm based deployment
Signed-off-by: Krzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>
Issue-ID: INT-1895
Change-Id: Id09932899f11ab37b391709c580d681674705432
Diffstat (limited to 'robot')
-rw-r--r-- | robot/assets/templates/dcaemod/compspec_with_config_volume.jinja | 23 | ||||
-rw-r--r-- | robot/assets/templates/dcaemod/compspec_without_config_volume.jinja | 23 | ||||
-rw-r--r-- | robot/resources/dcaemod_interface.robot | 70 | ||||
-rw-r--r-- | robot/resources/test_templates/cmpv2.robot | 1 | ||||
-rw-r--r-- | robot/resources/usecases/5gbulkpm_helm_interface.robot | 4 | ||||
-rw-r--r-- | robot/testsuites/dcaemod.robot | 8 |
6 files changed, 93 insertions, 36 deletions
diff --git a/robot/assets/templates/dcaemod/compspec_with_config_volume.jinja b/robot/assets/templates/dcaemod/compspec_with_config_volume.jinja index 80feec55..958decd9 100644 --- a/robot/assets/templates/dcaemod/compspec_with_config_volume.jinja +++ b/robot/assets/templates/dcaemod/compspec_with_config_volume.jinja @@ -16,12 +16,23 @@ }, "parameters": [], "auxilary": { - "healthcheck": { - "type": "docker", - "interval": "45s", - "timeout": "15s", - "script": "service nginx status" - }, + "helm": { + "service": { + "type": "ClusterIP", + "name": "{{comp_spec_name}}", + "ports": [{ + "name": "http", + "port": 80 + }] + } + }, + "healthcheck": { + "type": "HTTP", + "interval": "45s", + "timeout": "15s", + "port": 80, + "endpoint": "/" + }, "volumes": [{ "config_volume": { "name": "{{config_map_name}}" diff --git a/robot/assets/templates/dcaemod/compspec_without_config_volume.jinja b/robot/assets/templates/dcaemod/compspec_without_config_volume.jinja index 45ac97fb..361a9934 100644 --- a/robot/assets/templates/dcaemod/compspec_without_config_volume.jinja +++ b/robot/assets/templates/dcaemod/compspec_without_config_volume.jinja @@ -16,16 +16,31 @@ }, "parameters": [], "auxilary": { + "helm": { + "service": { + "type": "ClusterIP", + "name": "{{comp_spec_name}}", + "ports": [{ + "name": "http", + "port": 80 + }] + } + }, "healthcheck": { - "type": "docker", - "interval": "300s", - "timeout": "120s", - "script": "service nginx status" + "type": "HTTP", + "interval": "45s", + "timeout": "15s", + "port": 80, + "endpoint": "/" }, "ports": [ "80:0", "99:0" ], + "log_info": { + "log_directory": "/opt/logs/test" + }, + "tls_info":{ "cert_directory":"/opt/app/dcae-certificate/", "use_tls": false, diff --git a/robot/resources/dcaemod_interface.robot b/robot/resources/dcaemod_interface.robot index 435de23d..d6d6e369 100644 --- a/robot/resources/dcaemod_interface.robot +++ b/robot/resources/dcaemod_interface.robot @@ -6,8 +6,7 @@ Library Collections Library String Library OperatingSystem Resource ../resources/global_properties.robot -Resource ../resources/dcae/inventory.robot -Resource ../resources/dcae/deployment.robot +Resource chart_museum.robot *** Variables *** @@ -26,6 +25,8 @@ ${REGISTRY_CLIENT_ID} ${EMPTY} ${DCAEMOD_ONBOARDING_API_SERVER} ${GLOBAL_DCAEMOD_ONBOARDING_API_SERVER_PROTOCOL}://${GLOBAL_DCAEMOD_ONBOARDING_API_SERVER_NAME}:${GLOBAL_DCAEMOD_ONBOARDING_API_SERVER_PORT} ${DCAEMOD_DESIGNTOOL_SERVER} ${GLOBAL_DCAEMOD_DESIGNTOOL_SERVER_PROTOCOL}://${GLOBAL_DCAEMOD_DESIGNTOOL_SERVER_NAME}:${GLOBAL_DCAEMOD_DESIGNTOOL_SERVER_PORT} ${DCAEMOD_DISTRIBUTOR_API_SERVER} ${GLOBAL_DCAEMOD_DISTRIBUTOR_API_SERVER_PROTOCOL}://${GLOBAL_DCAEMOD_DISTRIBUTOR_API_SERVER_NAME}:${GLOBAL_DCAEMOD_DISTRIBUTOR_API_SERVER_PORT} +${HELM_RELEASE} kubectl --namespace onap get pods | sed 's/ .*//' | grep robot | sed 's/-.*//' + *** Keywords *** @@ -42,10 +43,9 @@ Deploy DCAE Application Distribute The Flow ${PROCESS_GROUP_ID} Set Test Variable ${IS_FLOW_DISTRIBUTED} True - ${typeId} ${blueprintName} = Deploy Blueprint From Inventory ${processGroupName} ${compSpecName} - Set Test Variable ${IS_SERVICE_DEPLOYED} True - Set Test Variable ${TYPE_ID} ${typeId} - Set Test Variable ${BLUEPRINT_NAME} ${blueprintName} + Deploy Applictaion ${processGroupName} ${compSpecName} + Set Test Variable ${CHART_NAME} ${compSpecName} + Delete Config Map With Mounted Config File @@ -223,15 +223,31 @@ Distribute The Flow ${resp} = Post Request distributor /distributor/distribution-targets/${DISTRIBUTION_TARGET_ID}/process-groups data=${data} headers=${headers} Should Be True ${resp.status_code} < 300 -Deploy Blueprint From Inventory - [Arguments] ${processGroupName} ${compSpecName} - ${blueprintName} = Set Variable ${processGroupName}_${compSpecName} - ${resp} = Wait Until Keyword Succeeds 7 min 20s Get Blueprint From Inventory ${blueprintName} - ${typeId} = Set Variable ${resp.json().get('items')[0].get('typeId')} - ${data} = Set Variable {"serviceTypeId": "${typeId}"} - Deploy Service ${data} ${blueprintName} 10 minute - - [Return] ${typeId} ${blueprintName} +Deploy Applictaion + [Arguments] ${processGroupName} ${compSpecName} + ${command_output} = Run And Return Rc And Output helm repo update + Should Be Equal As Integers ${command_output[0]} 0 + ${helm_install}= Set Variable helm install ${ONAP_HELM_RELEASE}-${compSpecName} chart-museum/${compSpecName} --set global.repository=${registry_ovveride} + ${helm_install_command_output} = Run And Return Rc And Output ${helm_install} + Log ${helm_install_command_output[1]} + Should Be Equal As Integers ${helm_install_command_output[0]} 0 + Set Test Variable ${IS_SERVICE_DEPLOYED} True + ${kubectl_patch}= Set Variable kubectl patch deployment ${ONAP_HELM_RELEASE}-${compSpecName} -p '{"spec":{"template":{"spec":{"containers":[{"name": "${compSpecName}","image":"docker.io/nginx:latest"}]}}}}' + ${kubectl_patch_command_output}= Run And Return Rc And Output ${kubectl_patch} + Log ${kubectl_patch_command_output[1]} + Should Be Equal As Integers ${kubectl_patch_command_output[0]} 0 + Wait Until Keyword Succeeds 4 min 15s Check NGINX Applictaion ${compSpecName} + +Check NGINX Applictaion + [Arguments] ${compSpecName} + ${check_command}= Set Variable kubectl get pods -n onap | grep ${compSpecName} | grep Running | grep 1/1 + ${check_command_command_output}= Run And Return Rc And Output ${check_command} + Log ${check_command_command_output[1]} + Should Be Equal As Integers ${check_command_command_output[0]} 0 + +Undeploy Application + [Arguments] ${CHART_NAME} + Uninstall helm charts ${ONAP_HELM_RELEASE}-${CHART_NAME} Get Process Group Revision [Arguments] ${processGroupId} @@ -262,17 +278,33 @@ Delete Registry Client Should Be True ${resp.status_code} < 300 Configure Nifi Registry And Distribution Target + Restart Runtime API Add Registry Client Add Distribution Target + Add chart repository chart-museum http://chart-museum:80 onapinitializer demo123456! + ${command_output} = Run And Return Rc And Output ${HELM_RELEASE} + Should Be Equal As Integers ${command_output[0]} 0 + Set Global Variable ${ONAP_HELM_RELEASE} ${command_output[1]} + +Restart Runtime API + ${restart_command}= Set Variable kubectl delete pod $(kubectl get pods -n onap | grep dcaemod-runtime-api | awk '{print $1}') -n onap + ${restart_command_command_output}= Run And Return Rc And Output ${restart_command} + Log ${restart_command_command_output[1]} + Should Be Equal As Integers ${restart_command_command_output[0]} 0 + Wait Until Keyword Succeeds 2 min 5s Check Runtime API + +Check Runtime API + ${check_command}= Set Variable kubectl get pods -n onap | grep dcaemod-runtime-api | grep Running | grep 1/1 + ${check_command_command_output}= Run And Return Rc And Output ${check_command} + Log ${check_command_command_output[1]} + Should Be Equal As Integers ${check_command_command_output[0]} 0 Delete Nifi Registry And Distribution Target Run Keyword If '${DISTRIBUTION_TARGET_ID}' != '${EMPTY}' Wait Until Keyword Succeeds 2 min 5s Delete Distribution Target Run Keyword If '${REGISTRY_CLIENT_ID}' != '${EMPTY}' Wait Until Keyword Succeeds 2 min 5s Delete Registry Client -Delete Process Group And Blueprint And Deployment +Delete Process Group And Deployment Run Keyword If ${IS_PROCESS_GROUP_SET} Run Keywords Delete Process Group ${PROCESS_GROUP_ID} ... AND Set Suite Variable ${IS_PROCESS_GROUP_SET} False - Run Keyword If ${IS_FLOW_DISTRIBUTED} Run Keywords Delete Blueprint From Inventory ${TYPE_ID} - ... AND Set Suite Variable ${IS_FLOW_DISTRIBUTED} False - Run Keyword If ${IS_SERVICE_DEPLOYED} Run Keywords Undeploy Service ${BLUEPRINT_NAME} + Run Keyword If ${IS_SERVICE_DEPLOYED} Run Keywords Undeploy Application ${CHART_NAME} ... AND Set Suite Variable ${IS_SERVICE_DEPLOYED} False
\ No newline at end of file diff --git a/robot/resources/test_templates/cmpv2.robot b/robot/resources/test_templates/cmpv2.robot index 6c50a368..0b317e9e 100644 --- a/robot/resources/test_templates/cmpv2.robot +++ b/robot/resources/test_templates/cmpv2.robot @@ -8,7 +8,6 @@ Library ONAPLibrary.Utilities Library ONAPLibrary.Templating WITH NAME Templating Resource pnf_registration_without_SO_template.robot Resource ../global_properties.robot -Resource ../resources/test_templates/pnf_registration_without_SO_template.robot Resource ../chart_museum.robot diff --git a/robot/resources/usecases/5gbulkpm_helm_interface.robot b/robot/resources/usecases/5gbulkpm_helm_interface.robot index 218f89b2..3408c8c2 100644 --- a/robot/resources/usecases/5gbulkpm_helm_interface.robot +++ b/robot/resources/usecases/5gbulkpm_helm_interface.robot @@ -176,10 +176,10 @@ Check Known Hosts In Env [Return] ${output} Deploying Data File Collector - Install helm charts chart-museum dcae-datafile-collector ${ONAP_HELM_RELEASE}-dcae-datafile-collector 6m --set useCmpv2Certificates=true --set global.cmpv2Enabled=true --set masterPasswordOverride=test --debug + Install helm charts chart-museum dcae-datafile-collector ${ONAP_HELM_RELEASE}-dcae-datafile-collector 6m --set useCmpv2Certificates=true --set global.cmpv2Enabled=true --set masterPasswordOverride=test --set global.centralizedLoggingEnabled=false --debug Deploying 3GPP PM Mapper - Install helm charts chart-museum dcae-pm-mapper ${ONAP_HELM_RELEASE}-dcae-pm-mapper 6m --debug + Install helm charts chart-museum dcae-pm-mapper ${ONAP_HELM_RELEASE}-dcae-pm-mapper 6m --set global.centralizedLoggingEnabled=false --debug Deploying SFTP Server As xNF ${override} = Set Variable --set fullnameOverride=${ONAP_HELM_RELEASE}-sftp --debug diff --git a/robot/testsuites/dcaemod.robot b/robot/testsuites/dcaemod.robot index 03de1cc3..681a0536 100644 --- a/robot/testsuites/dcaemod.robot +++ b/robot/testsuites/dcaemod.robot @@ -6,7 +6,7 @@ Library OperatingSystem Resource ../resources/dcaemod_interface.robot Suite Setup Configure Nifi Registry And Distribution Target Suite Teardown Delete Nifi Registry And Distribution Target -Test Teardown Delete Process Group And Blueprint And Deployment +Test Teardown Delete Process Group And Deployment *** Variables *** @@ -60,7 +60,7 @@ Deploy DCAE Simple Application With Config Map In Config Spec Json But Not Prese ${podYaml} = Get Pod Yaml ${compSpecName} Verify If Volume Is Mounted ${podYaml} ${volumeMountPath} Verify If Config Map Is Mounted As Volume ${podYaml} ${configMapName} - ${mountedFolderContent} = Get Content Of Mounted Folder Inside Container ${compSpecName} ${volumeMountPath} + ${mountedFolderContent}= Wait Until Keyword Succeeds 1 min 10s Get Content Of Mounted Folder Inside Container ${compSpecName} ${volumeMountPath} Verify If Mounted Folder Is Empty ${mountedFolderContent} Deploy DCAE Simple Application With Config Map In Config Spec Json AND Present In K8s @@ -91,7 +91,7 @@ Deploy DCAE Simple Application With Config Map In Config Spec Json AND Present I Create File ${CONFIG_MAP_FILE} ${content} Create Config Map From File ${configMapName} ${CONFIG_MAP_FILE} Deploy DCAE Application ${COMPSPEC_WITH_CONFIG_VOLUME} ${dict_values} ${compSpecName} ${processGroupName} - Verify If Mounted Folder Contains File ${compSpecName} ${configMapFile} ${volumeMountPath} + Wait Until Keyword Succeeds 1 min 10s Verify If Mounted Folder Contains File ${compSpecName} ${configMapFile} ${volumeMountPath} Verify File Content ${compSpecName} ${volumeMountPath}/${CONFIG_MAP_FILE} ${content} - [Teardown] Run Keywords Delete Process Group And Blueprint And Deployment AND Delete Config Map With Mounted Config File + [Teardown] Run Keywords Delete Process Group And Deployment AND Delete Config Map With Mounted Config File |