8969336e1af0b83f6d75ffdaff90ef5fb8ec1251
[testsuite.git] / robot / resources / chart_museum.robot
1 *** Settings ***
2 Documentation     The main interface for interacting with CDS. It handles low level stuff like managing the http request library and CDS required fields
3 Library           RequestsLibrary
4 Resource          global_properties.robot
5 Library           SSHLibrary
6 Library           OperatingSystem
7 Library           String
8
9 *** Variables ***
10 ${registry_ovveride}                                            ${GLOBAL_INJECTED_NEXUS_DOCKER_REPO}
11
12 *** Keywords ***
13 Add chart repository
14     [Documentation]  Add chart repository to helm in robot/xtesting pod
15     [Arguments]                         ${chart_repo_name}                  ${chart_repo_fqdn}      ${chart_repo_username}      ${chart_repo_password}
16     ${helm_repo_add}=                   Set Variable                        helm repo add ${chart_repo_name} ${chart_repo_fqdn} --password ${chart_repo_password} --username ${chart_repo_username}
17     ${command_output} =                 Run And Return Rc And Output        ${helm_repo_add}
18     Should Be Equal As Integers         ${command_output[0]}                0
19     ${command_output} =                 Run And Return Rc And Output        helm repo update
20     Should Be Equal As Integers         ${command_output[0]}                0
21
22 Remove chart repository
23     [Documentation]  Remove chart repository from helm in robot/xtesting pod
24     [Arguments]                         ${chart_repo_name}
25     ${helm_repo_remove}=                Set Variable                            helm repo remove ${chart_repo_name}
26     ${command_output} =                 Run And Return Rc And Output            ${helm_repo_remove}
27     Should Be Equal As Integers         ${command_output[0]}                    0
28
29 Package and add charts to repository
30     [Documentation]  Package and add charts to k8s chart repository in robot/xtesting pod
31     [Arguments]                         ${chart_repo_name}                  ${chart_directory}      ${destination_directory}    ${chart_version}
32     ${helm_package}=                    Set Variable                        helm package --dependency-update --destination ${destination_directory} ${chart_directory} --version ${chart_version}
33     ${command_output} =                 Run And Return Rc And Output        ${helm_package}
34     Should Be Equal As Integers         ${command_output[0]}                0
35     ${helm_chart_name}=                 Fetch From Right                    ${chart_directory}      /
36     ${helm_push}=                       Set Variable                        helm push  ${destination_directory}/${helm_chart_name}-${chart_version}.tgz ${chart_repo_name}
37     ${command_output} =                 Run And Return Rc And Output        ${helm_push}
38     Should Be Equal As Integers         ${command_output[0]}                0
39
40
41 Install helm charts
42     [Documentation]  Install DCAE Servcie using helm charts
43     [Arguments]                             ${chart_repo_name}                      ${dcae_servcie_helm_charts}         ${dcae_service_helm_name}       ${wait_time}=6m0s   ${set_values_override}=${EMPTY}
44     ${helm_install}=                        Set Variable                            helm install ${dcae_service_helm_name} ${chart_repo_name}/${dcae_servcie_helm_charts} --set global.repository=${registry_ovveride} ${set_values_override} --wait --timeout ${wait_time}
45     ${helm_install_command_output} =        Run And Return Rc And Output            ${helm_install}
46     Log                                     ${helm_install_command_output[1]}
47     Should Be Equal As Integers             ${helm_install_command_output[0]}       0
48
49 Install helm charts from folder
50     [Documentation]  Install DCAE Servcie using helm charts not in repo
51     [Arguments]                             ${chart_folder}                         ${dcae_service_helm_name}       ${wait_time}=2m0s  ${set_values_override}=${EMPTY}
52     ${helm_dependency_update}=              Set Variable                            helm dependency update ${chart_folder}
53     ${helm_dependency_update_output} =      Run And Return Rc And Output            ${helm_dependency_update}
54     Log                                     ${helm_dependency_update_output[1]}
55     Should Be Equal As Integers             ${helm_dependency_update_output[0]}     0
56     ${rest}  ${dcae_servcie_helm_charts} =      Split String From Right                     ${chart_folder}                 /           1
57     ${helm_install}=                        Set Variable                            helm install ${dcae_service_helm_name} ${chart_folder} --set global.repository=${registry_ovveride} ${set_values_override} --wait --timeout ${wait_time}
58     ${helm_install_command_output} =        Run And Return Rc And Output            ${helm_install}
59     Log                                     ${helm_install_command_output[1]}
60     Should Be Equal As Integers             ${helm_install_command_output[0]}       0
61
62 Uninstall helm charts
63     [Documentation]  Uninstall DCAE Servcie using helm charts
64     [Arguments]                             ${dcae_service_helm_name}
65     ${helm_uninstall}=                      Set Variable                                    helm uninstall ${dcae_service_helm_name} --timeout 5m0s
66     ${helm_uninstall_command_output}=       Run And Return Rc And Output                    ${helm_uninstall}
67     Should Be Equal As Integers             ${helm_uninstall_command_output[0]}             0
68     ${helm_check}=                          Set Variable                                    kubectl get pods -n onap | grep ${dcae_service_helm_name}
69     Wait Until Keyword Succeeds             5 minute                                        5 sec                            Helm charts uninstallation check       ${helm_check}
70
71 Helm charts uninstallation check
72     [Arguments]                             ${helm_check}
73     ${helm_uninstall_check_output}=         Run And Return Rc And Output                    ${helm_check}
74     Should Be Equal As Integers             ${helm_uninstall_check_output[0]}               1
75     Log                                     ${helm_uninstall_check_output[1]}
76
77
78
79
80
81
82
83