summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/csit/plans/policy/health/setup.sh4
-rwxr-xr-xtest/csit/plans/policy/health/teardown.sh1
-rwxr-xr-xtest/csit/scripts/policy/script1.sh49
-rwxr-xr-xtest/csit/scripts/policy/wait_for_port.sh18
-rw-r--r--test/csit/tests/policy/suite1/test1.robot30
5 files changed, 51 insertions, 51 deletions
diff --git a/test/csit/plans/policy/health/setup.sh b/test/csit/plans/policy/health/setup.sh
index bfea1ac1c..21f58eb66 100755
--- a/test/csit/plans/policy/health/setup.sh
+++ b/test/csit/plans/policy/health/setup.sh
@@ -34,8 +34,6 @@ ${WORKSPACE}/test/csit/scripts/policy/mock-hello.sh ${MOCK_IP}
source ${WORKSPACE}/test/csit/scripts/policy/script1.sh
-sleep 3m
-
# Pass any variables required by Robot test suites in ROBOT_VARIABLES
ROBOT_VARIABLES="-v MOCK_IP:${MOCK_IP} -v IP:${IP} -v POLICY_IP:${POLICY_IP} -v PDP_IP:${PDP_IP} -v DOCKER_IP:${DOCKER_IP}"
export PDP_IP=${PDP_IP}
@@ -44,4 +42,4 @@ export DOCKER_IP=${DOCKER_IP}
#Get current IP of VM
HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
-export HOST_IP=${HOST_IP} \ No newline at end of file
+export HOST_IP=${HOST_IP}
diff --git a/test/csit/plans/policy/health/teardown.sh b/test/csit/plans/policy/health/teardown.sh
index f79e75d89..f1f0b21ce 100755
--- a/test/csit/plans/policy/health/teardown.sh
+++ b/test/csit/plans/policy/health/teardown.sh
@@ -34,4 +34,3 @@ kill_instance mariadb
rm -fr "${WORK_DIR}"
-
diff --git a/test/csit/scripts/policy/script1.sh b/test/csit/scripts/policy/script1.sh
index 473ef0dd8..30fb39586 100755
--- a/test/csit/scripts/policy/script1.sh
+++ b/test/csit/scripts/policy/script1.sh
@@ -94,47 +94,58 @@ export MTU=9126
docker-compose -f docker-compose-integration.yml up -d
+if [ ! $? -eq 0 ]; then
+ echo "Docker compose failed"
+ exit 1
+fi
+
docker ps
-docker inspect drools
+#sleep 4m
POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools`
echo ${POLICY_IP}
-sleep 3m
-
-docker inspect pdp
-
PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp`
echo ${PDP_IP}
-sleep 3m
+PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap`
+echo ${PAP_IP}
+
+BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw`
+echo ${BRMS_IP}
+
+NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus`
+echo ${NEXUS_IP}
-#for i in {1..60}; do
-TIME_OUT=6000
+MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb`
+echo ${MARIADB_IP}
+
+${DIR}/wait_for_port.sh ${MARIADB_IP} 3306
+${DIR}/wait_for_port.sh ${PAP_IP} 9091
+${DIR}/wait_for_port.sh ${PDP_IP} 8081
+${DIR}/wait_for_port.sh ${BRMS_IP} 9989
+${DIR}/wait_for_port.sh ${NEXUS_IP} 8081
+${DIR}/wait_for_port.sh ${POLICY_IP} 6969
+
+TIME_OUT=600
INTERVAL=20
TIME=0
while [ "$TIME" -lt "$TIME_OUT" ]; do
curl -i --user healthcheck:zb!XztG34 -H "ContentType: application/json" -H "Accept: application/json" ${POLICY_IP}:6969/healthcheck && break
- echo sleep $i
- sleep $i
-echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
+ echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
sleep $INTERVAL
TIME=$(($TIME+$INTERVAL))
done
-#curl -v --silent -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": "*.*"}'
-
-TIME_OUT=6000
+TIME_OUT=600
INTERVAL=20
TIME=0
while [ "$TIME" -lt "$TIME_OUT" ]; do
- curl -v --silent -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": "*.*"}' http://${PDP_IP}:8081/pdp/api/getConfig && break
- echo sleep $i
- sleep $i
+ curl -i -v -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": ".*"}' http://${PDP_IP}:8081/pdp/api/getConfig && break
echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
sleep $INTERVAL
@@ -142,3 +153,7 @@ echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up
done
+#
+# Add more sleep for everything to settle
+#
+sleep 3m
diff --git a/test/csit/scripts/policy/wait_for_port.sh b/test/csit/scripts/policy/wait_for_port.sh
new file mode 100755
index 000000000..10f08ded1
--- /dev/null
+++ b/test/csit/scripts/policy/wait_for_port.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+if [[ $# -ne 2 ]]; then
+ echo "Usage: wait-for-port hostname port" >&2
+ exit 1
+fi
+
+host=$1
+port=$2
+
+echo "Waiting for $host port $port open"
+until telnet $host $port </dev/null 2>/dev/null | grep -q '^Connected'; do
+ sleep 1
+done
+
+echo "$host port $port is open"
+
+exit 0
diff --git a/test/csit/tests/policy/suite1/test1.robot b/test/csit/tests/policy/suite1/test1.robot
deleted file mode 100644
index 10e685213..000000000
--- a/test/csit/tests/policy/suite1/test1.robot
+++ /dev/null
@@ -1,30 +0,0 @@
-*** Settings ***
-Library OperatingSystem
-Library RequestsLibrary
-
-*** Variables ***
-${MESSAGE} Hello, world!
-
-*** Test Cases ***
-String Equality Test
- Should Be Equal ${MESSAGE} Hello, world!
-
-Dir Test
- [Documentation] Check if /tmp exists
- Log ${MESSAGE}
- CheckDir /tmp
-
-Url Test
- [Documentation] Check if google.com can be reached
- CheckUrl http://www.google.com
-
-*** Keywords ***
-CheckDir
- [Arguments] ${path}
- Directory Should Exist ${path}
-
-CheckUrl
- [Arguments] ${url}
- Create Session session ${url}
- ${resp}= Get Request session /
- Should Be Equal As Integers ${resp.status_code} 200