@@ -85,20 +85,46 @@ function expectOrsStartupFails() {
8585 fi
8686}
8787
88+ function assertSortedWordsEquals() {
89+ expected=$1
90+ received=$2
91+ sorted_expected=$( echo " $expected " | tr ' ' ' \n' | sort | tr ' \n' ' ' )
92+ sorted_received=$( echo " $received " | tr ' ' ' \n' | sort | tr ' \n' ' ' )
93+ assertEquals " $sorted_expected " " $sorted_received "
94+ }
95+
8896function assertEquals() {
8997 expected=$1
9098 received=$2
99+ check=$3
100+ if [ -n " $check " ]; then checkMsg=" Checking '$check ': " ; fi
91101 if [ " $expected " != " $received " ]; then
92- echo -e " ${FG_RED} ASSERTION ERROR:${N} "
102+ echo -e " ${FG_RED} ASSERTION ERROR:${N} ${checkMsg} "
93103 echo -e " expected: '${FG_GRN}${expected}${N} '"
94104 echo -e " received: '${FG_RED}${received}${N} '"
95105 exit 1
96106 else
97- echo -e " ${FG_GRN} received '$received ' as expected${N} "
98- exit 0
107+ echo -e " ${FG_GRN}${checkMsg} Received '${received} ' as expected${N} "
108+ fi
109+ }
110+
111+ function assertContains() {
112+ expected=$1
113+ received=$2
114+ num=$( echo " ${received} " | grep -c " ${expected} " )
115+ if [[ $num -eq 0 ]]; then
116+ echo -e " ${FG_RED} ASSERTION ERROR:${N} : '${expected} ' not contained as expected${N} $num "
117+ exit 1
118+ else
119+ echo -e " ${FG_GRN} '${expected} ' is contained as expected${N} "
99120 fi
100121}
101122
123+ function requestStatusString() {
124+ port=$1
125+ echo $( curl --silent $( getOrsUrl $port ) /status | jq . )
126+ }
127+
102128function requestEnabledProfiles() {
103129 port=$1
104130 echo $( curl --silent $( getOrsUrl $port ) /status | jq -r ' .profiles[].profiles' )
@@ -153,7 +179,7 @@ function prepareTest() {
153179 if [ -z " $IMAGE " ]; then printError " missing param 2: docker image" ; exit 1; fi
154180
155181 CONTAINER=${runType} -$( removeExtension " $( basename $script ) " )
156- HOST_PORT=$( findFreePort 8082 )
182+ HOST_PORT=$( findFreePort 8083 )
157183
158184 mkdir -p ~ /.m2
159185 M2_FOLDER=" $( realpath ~ /.m2) "
@@ -183,5 +209,5 @@ function makeTempFile() {
183209
184210function deleteTempFiles() {
185211 script=$1
186- rm " ${TESTROOT} /tmp/${script} " . *
212+ rm " ${TESTROOT} /tmp/${script} " *
187213}
0 commit comments