summaryrefslogtreecommitdiffstats
path: root/robot/testsuites/dcaemod.robot
blob: 72d753d261c546eebf80b54fd4254fba65c4bb73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
*** Settings ***

Library           RequestsLibrary
Library           Collections
Library           OperatingSystem
Resource          ../../resources/dcaemod_interface.robot
Suite Setup       Configure Nifi Registry And Distribution Target
Suite Teardown    Delete Nifi Registry And Distribution Target
Test Teardown     Delete Process Group And Blueprint And Deployment


*** Variables ***

${CONFIG_MAP_FILE}                            /tmp/sample-config
${COMPSPEC_WITH_CONFIG_VOLUME}                dcaemod/compspec_with_config_volume.jinja
${COMPSPEC_WITHOUT_CONFIG_VOLUME}             dcaemod/compspec_without_config_volume.jinja

*** Test Cases ***

Deploy DCAE Simple Application Without Config Map In Config Spec Json
    [tags]              dcaemod
    [Documentation]
    ...  Test case checks if operator is able to deploy DCAE application using DCAE MOD without config map definition.
    ...  This test case:
    ...  - Configures DCAE MOD by adding a registry client and a distribution target in the controller settings via NIFI API.
    ...  - Onboards component spec via onboarding API.
    ...  - Creates Process Group, Processor and saves created flows (by version controlling) via NIFI API.
    ...  - Distributes the flow for blueprint generation via distributor API and pushes it to the DCAE Inventory and the DCAE Dashboard.
    ...  - Deploys such a blueprint from Inventory.

    ${timestamp}=  Get Time  epoch
    Set Test Variable  ${processGroupName}  nginx-${timestamp}
    ${dict_values} =  Create Dictionary  comp_spec_name=${processGroupName}
    ${compSpecName} =  Set Variable  ${dict_values['comp_spec_name']}

    Deploy DCAE Application  ${COMPSPEC_WITHOUT_CONFIG_VOLUME}  ${dict_values}  ${compSpecName}  ${processGroupName}

Deploy DCAE Simple Application With Config Map In Config Spec Json But Not Present In K8s
    [tags]              dcaemod
    [Documentation]
    ...  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.
    ...  This test case:
    ...  Configures DCAE MOD by adding a registry client and a distribution target in the controller settings via NIFI API.
    ...  - Onboards component spec with config map via onboarding API.
    ...  - Creates Process Group, Processor and saves created flows (by version controlling) via NIFI API.
    ...  - Distributes the flow for blueprint generation via distributor API and pushes it to the DCAE Inventory and the DCAE Dashboard.
    ...  - Deploys such a blueprint from Inventory.
    ...  - Verifies if config map is mounted as a volume and if mounted folder is empty

     ${timestamp}=  Get Time  epoch
     Set Test Variable  ${processGroupName}  nginx-${timestamp}
     ${dict_values} =  Create Dictionary  comp_spec_name=${processGroupName}
     ...                                  volume_mount_path=/opt/app/etc/config
     ...                                  config_map_name=test-config-volume
     ${compSpecName} =  Set Variable  ${dict_values['comp_spec_name']}
     ${volumeMountPath} =  Set Variable  ${dict_values['volume_mount_path']}
     ${configMapName} =  Set Variable  ${dict_values['config_map_name']}

     Deploy DCAE Application  ${COMPSPEC_WITH_CONFIG_VOLUME}  ${dict_values}  ${compSpecName}  ${processGroupName}
     ${podYaml} =  Get Pod Yaml  ${compSpecName}
     Verify If Volume Is Mounted  ${podYaml}  ${volumeMountPath}
     Verify If Config Map Is Mounted As Volume  ${podYaml}  ${configMapName}
     ${mountedFolderContent} =  Get Content Of Mounted Folder Inside Container  ${compSpecName}  ${volumeMountPath}
     Verify If Mounted Folder Is Empty  ${mountedFolderContent}

Deploy DCAE Simple Application With Config Map In Config Spec Json AND Present In K8s
    [tags]              dcaemod
    [Documentation]
    ...  Test case checks if operator is able to deploy DCAE application using DCAE MOD with config map definition and config map present in k8s.
    ...  This test case:
    ...  - Configures DCAE MOD by adding a registry client and a distribution target in the controller settings via NIFI API.
    ...  - Onboards component spec with config map via onboarding API.
    ...  - Creates Process Group, Processor and saves created flows (by version controlling) via NIFI API.
    ...  - Creates config map from file
    ...  - Distributes the flow for blueprint generation via distributor API and pushes it to the DCAE Inventory and the DCAE Dashboard.
    ...  - Deploys such a blueprint from Inventory.
    ...  - Verifies if mounted folder contains created file and this file contains user content

     ${timestamp}=  Get Time  epoch
     Set Test Variable  ${processGroupName}  nginx-${timestamp}
     ${dict_values} =  Create Dictionary  comp_spec_name=${processGroupName}
     ...                                  volume_mount_path=/opt/app/etc/config
     ...                                  config_map_name=test-config-volume
     ${compSpecName} =  Set Variable  ${dict_values['comp_spec_name']}
     ${volumeMountPath} =  Set Variable  ${dict_values['volume_mount_path']}
     ${configMapName} =  Set Variable  ${dict_values['config_map_name']}
     Set Test Variable  ${CONFIG_MAP_NAME}  ${configMapName}
     ${content} =  Set Variable  Hello, world!
     ${configMapDir}  ${configMapFile} =  Split Path  ${CONFIG_MAP_FILE}

     Create File  ${CONFIG_MAP_FILE}  ${content}
     Create Config Map From File  ${configMapName}  ${CONFIG_MAP_FILE}
     Deploy DCAE Application  ${COMPSPEC_WITH_CONFIG_VOLUME}  ${dict_values}  ${compSpecName}  ${processGroupName}
     Verify If Mounted Folder Contains File  ${compSpecName}  ${configMapFile}  ${volumeMountPath}
     Verify File Content  ${compSpecName}  ${volumeMountPath}/${CONFIG_MAP_FILE}  ${content}

    [Teardown]  Run Keywords  Delete Process Group And Blueprint And Deployment  AND  Delete Config Map With Mounted Config File