3cba7546f868f95da869f36ca2afd40fd3bd4b4c
[it/test.git] / ric_robot_suite / helm / nanobot / configmap-src / public / testsuites / mcxapp.robot
1 #   Copyright (c) 2019 AT&T Intellectual Property.
2 #
3 #   Licensed under the Apache License, Version 2.0 (the "License");
4 #   you may not use this file except in compliance with the License.
5 #   You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #   Unless required by applicable law or agreed to in writing, software
10 #   distributed under the License is distributed on an "AS IS" BASIS,
11 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #   See the License for the specific language governing permissions and
13 #   limitations under the License.
14
15 *** Settings ***
16 Documentation  Tests for the Measurement Campaign XApp
17
18
19 Resource       /robot/resources/global_properties.robot
20 Resource       /robot/resources/mcxapp_properties.robot
21
22 Resource       /robot/resources/ric/ric_utils.robot
23
24 Library        Collections
25 Library        KubernetesEntity          ${GLOBAL_XAPP_NAMESPACE}
26
27 *** Variables ***
28 ${writerVesSuccesses}       .*successful\\s+ves\\s+posts\\s*-\\s*([1-9][0-9]*)
29 ${writerVesErrors}          .*failed\\s+ves\\s+posts\\s*-\\s*([1-9][0-9]*)
30
31 *** Test Cases ***
32 XApp Should Be Available
33   [Tags]  etetests  xapptests  mcxapptests
34   ${deploymentName} =  Get From Dictionary  ${GLOBAL_RICPLT_XAPPS}  mcxapp
35   Set Suite Variable   ${deploymentName}
36   ${deploy} =          Deployment           ${deploymentName}
37   ${status} =          Most Recent Availability Condition           @{deploy.status.conditions}
38   Should Be Equal As Strings   ${status}  True  ignore_case=True
39
40 Writer Should Be Successfully Sending Statistics
41   [Tags]  etetests  xapptests  mcxapptests
42   Set Test Variable  ${finalStatus}  PASS
43   FOR  ${stat}  IN  @{GLOBAL_MCXAPP_WRITER_STATISTICS}
44      ${statRE} =        Regexp Escape  ${stat}
45      ${log} =           Most Recent Container Logs    ${deploymentName}
46      ...                ${GLOBAL_MCXAPP_WRITER_NAME}
47      ...                ^${statRE}:\\s+successful\\s+ves\\s+posts\\.*
48      ${status}  ${u} =  Run Keyword And Ignore Error
49      ...                Should Contain Match  ${log}  regexp=${writerVesSuccesses}
50      ${finalStatus} =   Set Variable If  "${status}" == "FAIL"
51      ...                FAIL
52      ...                ${finalStatus}
53      Run Keyword If     "${status}" == "FAIL"
54      ...                Log  No messages have been sent to VES for ${stat}
55      ${status}  ${u} =  Run Keyword And Ignore Error
56      ...                Should Not Contain Match  ${log}  regexp=${writerVesErrors}
57      ${finalStatus} =   Set Variable If  "${status}" == "FAIL"
58      ...                FAIL
59      ...                ${finalStatus}
60      Run Keyword If     "${status}" == "FAIL"
61      ...                Log  ${stat} is producing errors logging to VES
62   END
63   Run Keyword If        "${finalStatus}" == "FAIL"
64   ...                   Fail  One or more statistics is not being succesfully logged
65