IMPL: MC Xapp tests
[it/test.git] / ric_robot_suite / helm / nanobot / configmap-src / public / testsuites / health-check.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
16 *** Settings ***
17 Documentation      Run basic health checks for all known components which have one
18
19 Resource           /robot/resources/global_properties.robot
20
21 Resource           /robot/resources/ric/ric_utils.robot
22
23 *** Test Cases ***
24 Basic Component Health Checks
25   [Documentation]  For any defined RIC component with a health check keyword,
26   ...              Run that keyword.  "Health check" keywords have names of the
27   ...              form "Run ${component} Health Check".
28   # This could have been entirely implemented in Helm; however, I wanted to
29   # allow for the possibility that it would be used (with some modification)
30   # by the ric-robot, which does not perform template expansion on testsuites.
31   [Tags]  health
32   Set Test Variable    ${finalStatus}  PASS
33   :FOR   ${component}  IN              @{GLOBAL_RICPLT_COMPONENTS}
34   \  Run Keyword And Ignore Error
35   ...   Import Resource                /robot/resources/${component}/${component}_interface.robot
36   \  ${healthCheck} =  Set Variable    Run ${component} Health Check
37   \  ${status} =       Run Keyword If Present                   ${healthCheck}
38   \  ${finalStatus} =  Set Variable If   '${status}' == 'FAIL'  FAIL  ${finalStatus}
39   \  Run Keyword If    '${status}' == 'FAIL'
40   ...                  Log  ${component} is unhealthy
41   Run Keyword If       '${finalStatus}' == 'FAIL'
42   ...                  Fail  One or more Health Checks failed