Katarzyna Wasiel | d1bc6cb | 2021-02-10 08:50:57 +0100 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Library RequestsLibrary |
| 4 | Library Collections |
| 5 | Library OperatingSystem |
Krzysztof Kuzmicki | 814032f | 2021-03-16 15:48:07 +0100 | [diff] [blame] | 6 | Resource ../resources/dcaemod_interface.robot |
Katarzyna Wasiel | d1bc6cb | 2021-02-10 08:50:57 +0100 | [diff] [blame] | 7 | Suite Setup Configure Nifi Registry And Distribution Target |
| 8 | Suite Teardown Delete Nifi Registry And Distribution Target |
| 9 | Test 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 | |
| 20 | Deploy 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 Wasiel | 106bde3 | 2021-03-01 15:38:14 +0100 | [diff] [blame] | 31 | ${timestamp}= Get Time epoch |
| 32 | Set Test Variable ${processGroupName} nginx-${timestamp} |
| 33 | ${dict_values} = Create Dictionary comp_spec_name=${processGroupName} |
Katarzyna Wasiel | d1bc6cb | 2021-02-10 08:50:57 +0100 | [diff] [blame] | 34 | ${compSpecName} = Set Variable ${dict_values['comp_spec_name']} |
Katarzyna Wasiel | d1bc6cb | 2021-02-10 08:50:57 +0100 | [diff] [blame] | 35 | |
| 36 | Deploy DCAE Application ${COMPSPEC_WITHOUT_CONFIG_VOLUME} ${dict_values} ${compSpecName} ${processGroupName} |
| 37 | |
| 38 | Deploy 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 Wasiel | 106bde3 | 2021-03-01 15:38:14 +0100 | [diff] [blame] | 50 | ${timestamp}= Get Time epoch |
| 51 | Set Test Variable ${processGroupName} nginx-${timestamp} |
| 52 | ${dict_values} = Create Dictionary comp_spec_name=${processGroupName} |
Katarzyna Wasiel | d1bc6cb | 2021-02-10 08:50:57 +0100 | [diff] [blame] | 53 | ... 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 Wasiel | d1bc6cb | 2021-02-10 08:50:57 +0100 | [diff] [blame] | 58 | |
| 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 | |
| 66 | Deploy 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 Wasiel | 106bde3 | 2021-03-01 15:38:14 +0100 | [diff] [blame] | 79 | ${timestamp}= Get Time epoch |
| 80 | Set Test Variable ${processGroupName} nginx-${timestamp} |
| 81 | ${dict_values} = Create Dictionary comp_spec_name=${processGroupName} |
Katarzyna Wasiel | d1bc6cb | 2021-02-10 08:50:57 +0100 | [diff] [blame] | 82 | ... 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 Wasiel | d1bc6cb | 2021-02-10 08:50:57 +0100 | [diff] [blame] | 88 | ${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 |