Add ACM regression test suite
[policy/docker.git] / csit / run-acm-regression.sh
1 #!/bin/bash
2 #
3 # Copyright 2024 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
18 # Script to run the ACM regression test suite in cucumber.
19 # Deploys ACM-R and participants in two different release versions for testing backward compatibility.
20
21 if [ $# -eq 0 ]
22 then
23     echo "No release versions provided. Testing ACM-R and participants with the default version"
24     echo "Usage: $0 <acm_release> <compatibility_test_release>"
25     ACM_RELEASE=$(awk -F= '$1 == "defaultbranch" { print $2 }' \
26                             "${WORKSPACE}"/.gitreview)
27     PPNT_RELEASE=$ACM_RELEASE
28 fi
29
30 if [ $1 ]; then
31     ACM_RELEASE=$1
32 fi
33
34 if [ $2 ]; then
35     PPNT_RELEASE=$2
36 fi
37
38 if [ -z "${WORKSPACE}" ]; then
39     WORKSPACE=$(git rev-parse --show-toplevel)
40     export WORKSPACE
41 fi
42
43
44 export SCRIPTS="${WORKSPACE}/csit/resources/scripts"
45
46 COMPOSE_FOLDER="${WORKSPACE}"/compose
47 REGRESSION_FOLDER="${WORKSPACE}"/policy-regression-tests/policy-clamp-regression/
48 export PROJECT='clamp'
49
50 # Sign in to nexus3 docker repo
51 docker login -u docker -p docker nexus3.onap.org:10001
52
53 cd ${COMPOSE_FOLDER}
54
55 echo "Configuring docker compose..."
56
57 source export-ports.sh > /dev/null 2>&1
58 source get-versions-regression.sh $ACM_RELEASE $PPNT_RELEASE > /dev/null 2>&1
59
60 docker-compose -f docker-compose.yml up -d "policy-clamp-runtime-acm"
61
62 # wait for the app to start up
63 "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}"
64
65 cd ${REGRESSION_FOLDER}
66
67 # Invoke the regression test cases
68 mvn clean test