21eb6e63d0bf3ab52b97e0635117c8d22ca039bc
[policy/docker.git] / csit / resources / scripts / setup-apex-pdp-postgres.sh
1 #!/bin/bash
2 # ============LICENSE_START=======================================================
3 #  Copyright (C) 2023 Nordix Foundation.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19
20 export PROJECT="apex-pdp"
21 source "${SCRIPTS}"/node-templates.sh
22
23 source "${WORKSPACE}"/compose/start-postgres-tests.sh
24
25 sleep 10
26 unset http_proxy https_proxy
27
28 # wait for the app to start up
29 bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT}
30 bash "${SCRIPTS}"/wait_for_rest.sh localhost ${APEX_PORT}
31
32 sleep 20
33
34 healthy=false
35
36 while [ $healthy = false ]
37 do
38     msg=`curl -s -k --user 'policyadmin:zb!XztG34' http://localhost:${APEX_PORT}/policy/apex-pdp/v1/healthcheck`
39     echo "${msg}" | grep -q true
40     if [ "${?}" -eq 0 ]
41     then
42         healthy=true
43         break
44     fi
45     sleep 10s
46 done
47
48 export DMAAP_IP="localhost:${DMAAP_PORT}"
49 export SUITES="apex-pdp-test.robot"
50
51 ROBOT_VARIABLES="-v POLICY_PAP_IP:localhost:${PAP_PORT} -v POLICY_API_IP:localhost:${API_PORT}
52 -v PROMETHEUS_IP:localhost:${PROMETHEUS_PORT} -v DATA:${DATA} -v NODETEMPLATES:${NODETEMPLATES}
53 -v APEX_IP:localhost:${APEX_PORT} -v DMAAP_IP:${DMAAP_IP}
54 -v APEX_EVENTS_IP:localhost:${APEX_PORT}"