blob: ef5b0e76fa4d34e7aab5313e3433a6a772513a7a [file] [log] [blame]
Katarzyna Wasield1bc6cb2021-02-10 08:50:57 +01001*** Settings ***
2
3Library RequestsLibrary
4Library Collections
5Library OperatingSystem
6Resource ../../resources/dcaemod_interface.robot
7Suite 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
31 ${dict_values} = Create Dictionary comp_spec_name=nginx1
32 ${compSpecName} = Set Variable ${dict_values['comp_spec_name']}
33 Set Test Variable ${processGroupName} nginx1
34
35 Deploy DCAE Application ${COMPSPEC_WITHOUT_CONFIG_VOLUME} ${dict_values} ${compSpecName} ${processGroupName}
36
37Deploy DCAE Simple Application With Config Map In Config Spec Json But Not Present In K8s
38 [tags] dcaemod
39 [Documentation]
40 ... 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.
41 ... This test case:
42 ... Configures DCAE MOD by adding a registry client and a distribution target in the controller settings via NIFI API.
43 ... - Onboards component spec with config map via onboarding API.
44 ... - Creates Process Group, Processor and saves created flows (by version controlling) via NIFI API.
45 ... - Distributes the flow for blueprint generation via distributor API and pushes it to the DCAE Inventory and the DCAE Dashboard.
46 ... - Deploys such a blueprint from Inventory.
47 ... - Verifies if config map is mounted as a volume and if mounted folder is empty
48
49 ${dict_values} = Create Dictionary comp_spec_name=nginx2
50 ... volume_mount_path=/opt/app/etc/config
51 ... config_map_name=test-config-volume
52 ${compSpecName} = Set Variable ${dict_values['comp_spec_name']}
53 ${volumeMountPath} = Set Variable ${dict_values['volume_mount_path']}
54 ${configMapName} = Set Variable ${dict_values['config_map_name']}
55 Set Test Variable ${processGroupName} nginx2
56
57 Deploy DCAE Application ${COMPSPEC_WITH_CONFIG_VOLUME} ${dict_values} ${compSpecName} ${processGroupName}
58 ${podYaml} = Get Pod Yaml ${compSpecName}
59 Verify If Volume Is Mounted ${podYaml} ${volumeMountPath}
60 Verify If Config Map Is Mounted As Volume ${podYaml} ${configMapName}
61 ${mountedFolderContent} = Get Content Of Mounted Folder Inside Container ${compSpecName} ${volumeMountPath}
62 Verify If Mounted Folder Is Empty ${mountedFolderContent}
63
64Deploy DCAE Simple Application With Config Map In Config Spec Json AND Present In K8s
65 [tags] dcaemod
66 [Documentation]
67 ... Test case checks if operator is able to deploy DCAE application using DCAE MOD with config map definition and config map present in k8s.
68 ... This test case:
69 ... - Configures DCAE MOD by adding a registry client and a distribution target in the controller settings via NIFI API.
70 ... - Onboards component spec with config map via onboarding API.
71 ... - Creates Process Group, Processor and saves created flows (by version controlling) via NIFI API.
72 ... - Creates config map from file
73 ... - Distributes the flow for blueprint generation via distributor API and pushes it to the DCAE Inventory and the DCAE Dashboard.
74 ... - Deploys such a blueprint from Inventory.
75 ... - Verifies if mounted folder contains created file and this file contains user content
76
77 ${dict_values} = Create Dictionary comp_spec_name=nginx3
78 ... volume_mount_path=/opt/app/etc/config
79 ... config_map_name=test-config-volume
80 ${compSpecName} = Set Variable ${dict_values['comp_spec_name']}
81 ${volumeMountPath} = Set Variable ${dict_values['volume_mount_path']}
82 ${configMapName} = Set Variable ${dict_values['config_map_name']}
83 Set Test Variable ${CONFIG_MAP_NAME} ${configMapName}
84 Set Test Variable ${processGroupName} nginx3
85 ${content} = Set Variable Hello, world!
86 ${configMapDir} ${configMapFile} = Split Path ${CONFIG_MAP_FILE}
87
88 Create File ${CONFIG_MAP_FILE} ${content}
89 Create Config Map From File ${configMapName} ${CONFIG_MAP_FILE}
90 Deploy DCAE Application ${COMPSPEC_WITH_CONFIG_VOLUME} ${dict_values} ${compSpecName} ${processGroupName}
91 Verify If Mounted Folder Contains File ${compSpecName} ${configMapFile} ${volumeMountPath}
92 Verify File Content ${compSpecName} ${volumeMountPath}/${CONFIG_MAP_FILE} ${content}
93
94 [Teardown] Run Keywords Delete Process Group And Blueprint And Deployment AND Delete Config Map With Mounted Config File