blob: 818ca8b679037355d6aef73af7541179c131d552 [file] [log] [blame]
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +01001*** Settings ***
2
3Library RequestsLibrary
4Library Collections
5Library OperatingSystem
Krzysztof Kuzmicki814032f2021-03-16 15:48:07 +01006Resource ../resources/dcaemod_interface.robot
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +01007Suite Setup Configure Nifi Registry And Distribution Target
8Suite Teardown Delete Nifi Registry And Distribution Target
Krzysztof Kuzmicki83837dc2022-03-23 10:29:20 +01009Test Teardown Delete Process Group And Deployment
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010010
11
12*** Variables ***
13
14${CONFIG_MAP_FILE} /tmp/sample-config
15${COMPSPEC_WITH_CONFIG_VOLUME} dcaemod/compspec_with_config_volume.jinja
16${COMPSPEC_WITHOUT_CONFIG_VOLUME} dcaemod/compspec_without_config_volume.jinja
17
18*** Test Cases ***
19
20Deploy DCAE Simple Application Without Config Map In Config Spec Json
21 [tags] dcaemod
22 [Documentation]
23 ... Test case checks if operator is able to deploy DCAE application using DCAE MOD without config map definition.
24 ... This test case:
25 ... - Configures DCAE MOD by adding a registry client and a distribution target in the controller settings via NIFI API.
26 ... - Onboards component spec via onboarding API.
27 ... - Creates Process Group, Processor and saves created flows (by version controlling) via NIFI API.
Krzysztof Kuzmickia2179b62022-03-29 10:24:04 +020028 ... - Distributes the flow for helm charts generation via distributor API and pushes it to the Chart Museum.
29 ... - Deploys such a helm charts.
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010030
Katarzyna Wasiel106bde32021-03-01 15:38:14 +010031 ${timestamp}= Get Time epoch
32 Set Test Variable ${processGroupName} nginx-${timestamp}
33 ${dict_values} = Create Dictionary comp_spec_name=${processGroupName}
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010034 ${compSpecName} = Set Variable ${dict_values['comp_spec_name']}
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010035
36 Deploy DCAE Application ${COMPSPEC_WITHOUT_CONFIG_VOLUME} ${dict_values} ${compSpecName} ${processGroupName}
37
38Deploy DCAE Simple Application With Config Map In Config Spec Json But Not Present In K8s
39 [tags] dcaemod
40 [Documentation]
41 ... Test case checks if operator is able to deploy DCAE application using DCAE MOD with config map definition in config spec json file but not present in k8s.
42 ... This test case:
43 ... Configures DCAE MOD by adding a registry client and a distribution target in the controller settings via NIFI API.
44 ... - Onboards component spec with config map via onboarding API.
45 ... - Creates Process Group, Processor and saves created flows (by version controlling) via NIFI API.
Krzysztof Kuzmickia2179b62022-03-29 10:24:04 +020046 ... - Distributes the flow for helm charts generation via distributor API and pushes it to the Chart Museum.
47 ... - Deploys such a helm charts.
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010048 ... - Verifies if config map is mounted as a volume and if mounted folder is empty
49
Katarzyna Wasiel106bde32021-03-01 15:38:14 +010050 ${timestamp}= Get Time epoch
51 Set Test Variable ${processGroupName} nginx-${timestamp}
52 ${dict_values} = Create Dictionary comp_spec_name=${processGroupName}
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010053 ... volume_mount_path=/opt/app/etc/config
54 ... config_map_name=test-config-volume
55 ${compSpecName} = Set Variable ${dict_values['comp_spec_name']}
56 ${volumeMountPath} = Set Variable ${dict_values['volume_mount_path']}
57 ${configMapName} = Set Variable ${dict_values['config_map_name']}
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010058
59 Deploy DCAE Application ${COMPSPEC_WITH_CONFIG_VOLUME} ${dict_values} ${compSpecName} ${processGroupName}
60 ${podYaml} = Get Pod Yaml ${compSpecName}
61 Verify If Volume Is Mounted ${podYaml} ${volumeMountPath}
62 Verify If Config Map Is Mounted As Volume ${podYaml} ${configMapName}
Krzysztof Kuzmicki83837dc2022-03-23 10:29:20 +010063 ${mountedFolderContent}= Wait Until Keyword Succeeds 1 min 10s Get Content Of Mounted Folder Inside Container ${compSpecName} ${volumeMountPath}
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010064 Verify If Mounted Folder Is Empty ${mountedFolderContent}
65
66Deploy DCAE Simple Application With Config Map In Config Spec Json AND Present In K8s
67 [tags] dcaemod
68 [Documentation]
69 ... Test case checks if operator is able to deploy DCAE application using DCAE MOD with config map definition and config map present in k8s.
70 ... This test case:
71 ... - Configures DCAE MOD by adding a registry client and a distribution target in the controller settings via NIFI API.
72 ... - Onboards component spec with config map via onboarding API.
73 ... - Creates Process Group, Processor and saves created flows (by version controlling) via NIFI API.
74 ... - Creates config map from file
Krzysztof Kuzmickia2179b62022-03-29 10:24:04 +020075 ... - Distributes the flow for helm charts generation via distributor API and pushes it to the Chart Museum.
76 ... - Deploys such a helm charts.
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010077 ... - Verifies if mounted folder contains created file and this file contains user content
78
Katarzyna Wasiel106bde32021-03-01 15:38:14 +010079 ${timestamp}= Get Time epoch
80 Set Test Variable ${processGroupName} nginx-${timestamp}
81 ${dict_values} = Create Dictionary comp_spec_name=${processGroupName}
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010082 ... volume_mount_path=/opt/app/etc/config
83 ... config_map_name=test-config-volume
84 ${compSpecName} = Set Variable ${dict_values['comp_spec_name']}
85 ${volumeMountPath} = Set Variable ${dict_values['volume_mount_path']}
86 ${configMapName} = Set Variable ${dict_values['config_map_name']}
87 Set Test Variable ${CONFIG_MAP_NAME} ${configMapName}
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010088 ${content} = Set Variable Hello, world!
89 ${configMapDir} ${configMapFile} = Split Path ${CONFIG_MAP_FILE}
90
91 Create File ${CONFIG_MAP_FILE} ${content}
92 Create Config Map From File ${configMapName} ${CONFIG_MAP_FILE}
93 Deploy DCAE Application ${COMPSPEC_WITH_CONFIG_VOLUME} ${dict_values} ${compSpecName} ${processGroupName}
Krzysztof Kuzmicki83837dc2022-03-23 10:29:20 +010094 Wait Until Keyword Succeeds 1 min 10s Verify If Mounted Folder Contains File ${compSpecName} ${configMapFile} ${volumeMountPath}
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +010095 Verify File Content ${compSpecName} ${volumeMountPath}/${CONFIG_MAP_FILE} ${content}
96
Krzysztof Kuzmicki83837dc2022-03-23 10:29:20 +010097 [Teardown] Run Keywords Delete Process Group And Deployment AND Delete Config Map With Mounted Config File