-
Notifications
You must be signed in to change notification settings - Fork 7
/
test-galasactl-ecosystem.sh
executable file
·124 lines (100 loc) · 4.55 KB
/
test-galasactl-ecosystem.sh
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#! /usr/bin/env bash
#
# Copyright contributors to the Galasa project
#
# SPDX-License-Identifier: EPL-2.0
#
echo "Running script test-galasactl-ecosystem.sh"
# This script can be ran locally or executed in a pipeline to test the various built binaries of galasactl
# This script can also be ran in a pipeline to test a published binary of galasactl in GHCR built by the GitHub workflow
# This script tests the 'galasactl' commands against the ecosystem
# Where is this script executing from ?
BASEDIR=$(dirname "$0");pushd $BASEDIR 2>&1 >> /dev/null ;BASEDIR=$(pwd);popd 2>&1 >> /dev/null
export ORIGINAL_DIR=$(pwd)
cd "${BASEDIR}"
#--------------------------------------------------------------------------
#
# Set Colors
#
#--------------------------------------------------------------------------
bold=$(tput bold)
underline=$(tput sgr 0 1)
reset=$(tput sgr0)
red=$(tput setaf 1)
green=$(tput setaf 76)
white=$(tput setaf 7)
tan=$(tput setaf 202)
blue=$(tput setaf 25)
#--------------------------------------------------------------------------
#
# Headers and Logging
#
#--------------------------------------------------------------------------
underline() { printf "${underline}${bold}%s${reset}\n" "$@" ;}
h1() { printf "\n${underline}${bold}${blue}%s${reset}\n" "$@" ;}
h2() { printf "\n${underline}${bold}${white}%s${reset}\n" "$@" ;}
debug() { printf "${white}%s${reset}\n" "$@" ;}
info() { printf "${white}➜ %s${reset}\n" "$@" ;}
success() { printf "${green}✔ %s${reset}\n" "$@" ;}
error() { printf "${red}✖ %s${reset}\n" "$@" ;}
warn() { printf "${tan}➜ %s${reset}\n" "$@" ;}
bold() { printf "${bold}%s${reset}\n" "$@" ;}
note() { printf "\n${underline}${bold}${blue}Note:${reset} ${blue}%s${reset}\n" "$@" ;}
#-----------------------------------------------------------------------------------------
# Functions
#-----------------------------------------------------------------------------------------
function usage {
info "Syntax: test-galasactl-ecosystem.sh --bootstrap [BOOTSTRAP]"
cat << EOF
Bootstrap must refer to a remote ecosystem.
EOF
}
#-----------------------------------------------------------------------------------------
# Process parameters
#-----------------------------------------------------------------------------------------
bootstrap=""
while [ "$1" != "" ]; do
case $1 in
--bootstrap ) shift
bootstrap="$1"
;;
-h | --help ) usage
exit
;;
* ) error "Unexpected argument $1"
usage
exit 1
esac
shift
done
# Can't really verify that the bootstrap provided is a valid one, but galasactl will pick this up later if not
if [[ "${bootstrap}" == "" ]]; then
export bootstrap="https://prod1-galasa-dev.cicsk8s.hursley.ibm.com/api/bootstrap"
info "No bootstrap supplied. Defaulting the --bootstrap to be ${bootstrap}"
fi
info "Running tests against ecosystem bootstrap ${bootstrap}"
#-----------------------------------------------------------------------------------------
# Constants
#-----------------------------------------------------------------------------------------
export GALASA_TEST_NAME_SHORT="local.CoreLocalJava11Ubuntu"
export GALASA_TEST_NAME_LONG="dev.galasa.inttests.core.${GALASA_TEST_NAME_SHORT}"
export GALASA_TEST_RUN_GET_EXPECTED_SUMMARY_LINE_COUNT="4"
export GALASA_TEST_RUN_GET_EXPECTED_DETAILS_LINE_COUNT="13"
export GALASA_TEST_RUN_GET_EXPECTED_RAW_PIPE_COUNT="10"
export GALASA_TEST_RUN_GET_EXPECTED_NUMBER_ARTIFACT_RUNNING_COUNT="10"
CALLED_BY_MAIN="true"
# Bootstrap is in the $bootstrap variable.
source ${BASEDIR}/test-scripts/calculate-galasactl-executables.sh
calculate_galasactl_executable
source ${BASEDIR}/test-scripts/runs-tests.sh --bootstrap "${bootstrap}"
test_runs_commands
source ${BASEDIR}/test-scripts/properties-tests.sh --bootstrap "${bootstrap}"
properties_tests
source ${BASEDIR}/test-scripts/resources-tests.sh --bootstrap "${bootstrap}"
resources_tests
source ${BASEDIR}/test-scripts/auth-tests.sh --bootstrap "${bootstrap}"
auth_tests
# Test the hybrid configuration where the local test runs locally, but
# draws it's CPS properties from a remote ecosystem via a REST extension.
source ${BASEDIR}/test-scripts/test-local-run-remote-cps.sh
test_local_run_remote_cps