blob: 03de1cc374cd6e92b4f7ea734a6234f00a86a25e [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
9Test Teardown Delete Process Group And Blueprint And Deployment
10
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.
28 ... - Distributes the flow for blueprint generation via distributor API and pushes it to the DCAE Inventory and the DCAE Dashboard.
29 ... - Deploys such a blueprint from Inventory.
30
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.
46 ... - Distributes the flow for blueprint generation via distributor API and pushes it to the DCAE Inventory and the DCAE Dashboard.
47 ... - Deploys such a blueprint from Inventory.
48 ... - 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}
63 ${mountedFolderContent} = Get Content Of Mounted Folder Inside Container ${compSpecName} ${volumeMountPath}
64 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
75 ... - Distributes the flow for blueprint generation via distributor API and pushes it to the DCAE Inventory and the DCAE Dashboard.
76 ... - Deploys such a blueprint from Inventory.
77 ... - 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}
94 Verify If Mounted Folder Contains File ${compSpecName} ${configMapFile} ${volumeMountPath}
95 Verify File Content ${compSpecName} ${volumeMountPath}/${CONFIG_MAP_FILE} ${content}
96
97 [Teardown] Run Keywords Delete Process Group And Blueprint And Deployment AND Delete Config Map With Mounted Config File