run-tests.sh 2.43 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright © 2020 Amazon Web Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This script prepares the dist directory for the integration tests.
# Must be run from the root of the repostiory

# This script executes the test and copies reports to the provided output directory
# To call this script from the service working directory
# ./dist/testing/integration/build-aws/run-tests.sh "./reports/"


echo "### Running Register-Service Integration Tests... ###"
SCRIPT_SOURCE_DIR=$(dirname "$0")
echo "Script source location"
echo "$SCRIPT_SOURCE_DIR"
(cd "$SCRIPT_SOURCE_DIR"/../bin && ./install-deps.sh)

#### ADD REQUIRED ENVIRONMENT VARIABLES HERE ###############################################
# The following variables are automatically populated from the environment during integration testing
# see os-deploy-aws/build-aws/integration-test-env-variables.py for an updated list


export AWS_COGNITO_AUTH_FLOW=USER_PASSWORD_AUTH
export AWS_COGNITO_AUTH_PARAMS_PASSWORD=$ADMIN_PASSWORD
export AWS_COGNITO_AUTH_PARAMS_USER=$ADMIN_USER
export AWS_COGNITO_AUTH_PARAMS_USER_NO_ACCESS=$USER_NO_ACCESS
export ENVIRONMENT=DEV
export REGISTER_BASE_URL=$REGISTER_BASE_URL
export SUBSCRIBER_SECRET=02030405060708090A0B0C0D0E0F
export REGISTER_CUSTOM_PUSH_PATH=api/register/v1/awstest/aws/challenge
export REGISTER_CUSTOM_PUSH_PATH1=api/register/v1/awstest/aws/challenge/1
export REGISTER_CUSTOM_PUSH_URL=$REGISTER_BASE_URL$REGISTER_CUSTOM_PUSH_PATH
export REGISTER_CUSTOM_PUSH_URL1=$REGISTER_BASE_URL$REGISTER_CUSTOM_PUSH_PATH1




#### RUN INTEGRATION TEST #########################################################################

51
mvn -ntp test -f "$SCRIPT_SOURCE_DIR"/../pom.xml
52
53
54
55
56
57
58
59
60
61
TEST_EXIT_CODE=$?

#### COPY TEST REPORTS #########################################################################

if [ -n "$1" ]
  then
    mkdir -p "$1"
    cp -R "$SCRIPT_SOURCE_DIR"/../target/surefire-reports "$1"
fi
echo "### Register-Service Integration Tests Finished ###"
62
exit $TEST_EXIT_CODE