Add CSIT test for CPS Swagger UI
[cps.git] / csit / tests / actuator / actuator.robot
1 # ============LICENSE_START=======================================================
2 # Copyright (c) 2021 Pantheon.tech.
3 # Modifications Copyright (c) 2021 Bell Canada.
4 # Modifications Copyright (C) 2024 Nordix Foundation
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
20
21 *** Settings ***
22 Documentation         CPS - Actuator and Swagger UI endpoints
23
24 Library               Collections
25 Library               RequestsLibrary
26
27 Suite Setup           Create Session      CPS_URL    http://${CPS_CORE_HOST}:${CPS_CORE_PORT}
28
29 *** Variables ***
30 ${auth}              Basic Y3BzdXNlcjpjcHNyMGNrcyE=
31 ${actuatorPath}      /actuator/health
32 ${swaggerPath}       /swagger-ui/index.html
33
34
35 *** Test Cases ***
36
37 Test CPS Enhanced Healthcheck
38     [Documentation]       Runs CPS Health Check. It will check for overall status update of CPS component like, Database and diskspace status along with liveliness and readiness check
39     ${response}=          GET On Session        CPS_URL             ${actuatorPath}    expected_status=200
40     ${resp_body}=         Convert to string     ${response.text}
41     Should Contain        ${resp_body}          UP
42     Should Not Contain    ${resp_body}          DOWN
43
44 Test CPS Swagger UI
45     [Documentation]       Runs health check for CPS Swagger UI. If the CPS Swagger URL is accessible, status should be 200.
46     ${headers}=           Create Dictionary   Authorization=${auth}
47     GET On Session        CPS_URL             ${swaggerPath}    headers=${headers}    expected_status=200