Skip to content

Commit ae528d3

Browse files
authored
fix: evaluate profile_default (#1767)
2 parents 9472c65 + e63588e commit ae528d3

20 files changed

Lines changed: 219 additions & 100 deletions

.github/utils/yml_config_to_ors_config_conversion.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ echo "- Uncomment ors, engine and source_file"
3737
sed -i -e '/^#ors:/s/^#//' -e '/^#.*engine:/s/^#//' -e '/^#.*source_file:/s/^#//' "$output_file"
3838

3939
echo "- Uncomment subsequent lines for profiles.car.enabled in ors.engine"
40-
sed -i -e '/^# profiles:/,/^# enabled:/ s/^#//' "$output_file"
40+
sed -i -e '/^# profiles:/s/^#//' "$output_file"
41+
sed -i -e '/^# car:.*/s/^#//' "$output_file"
42+
sed -i -e '/^# enabled: true/s/^#//' "$output_file"
4143

4244
echo "Parsing complete. Result saved to $output_file"

.github/utils/yml_config_validation.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ yq 'true' $input_file /dev/null || exit 1
1717
echo "- checking if ors.engine.source_file exists and has 'source_file' property"
1818
yq --exit-status '.ors.engine | has("source_file")' $input_file > /dev/null || exit 1
1919
# For profiles section for car with enabled using yq and contains
20-
echo "- checking if ors.engine.profiles.car exists and has 'enabled' property"
21-
yq --exit-status '.ors.engine.profiles.car | has("enabled")' $input_file > /dev/null || exit 1
20+
#echo "- checking if ors.engine.profiles.car exists and has 'enabled' property"
21+
#yq --exit-status '.ors.engine.profiles.car | has("enabled")' $input_file > /dev/null || exit 1

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
strategy:
6363
matrix:
6464
runtype: [ '-m' , '-j' ]
65-
testgroup: [ build-all-graphs*, arg-overrides*, check*, config*, lookup*, missing*, specify* ]
65+
testgroup: [ build-all-graphs*, arg-overrides*, check*, config-json*, config-yml*, lookup*, missing*, ors-config*, specify-json*, specify-yml*, profile-default* ]
6666
steps:
6767
- uses: actions/checkout@v4
6868
with:

.integration-scenarios/debian-12-jar-mvn/files/testfunctions.sh

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
8896
function 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+
102128
function 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

184210
function deleteTempFiles() {
185211
script=$1
186-
rm "${TESTROOT}/tmp/${script}".*
212+
rm "${TESTROOT}/tmp/${script}"*
187213
}

.integration-scenarios/debian-12-jar-mvn/run.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mvn=0
1111
verbose=0
1212
pattern=""
1313

14-
function printCliHelp() { # TODO adapt
14+
function printCliHelp() {
1515
echo -e "\
1616
${B}$SCRIPT${N} - run ors tests in containers
1717
@@ -69,12 +69,15 @@ function runTest() {
6969
else
7070
$testscript "${runType}" "${imageName}" 1>/dev/null 2>&1
7171
fi
72-
73-
if (($?)); then
72+
testStatus=$?
73+
if [ $testStatus -eq 1 ]; then
7474
hasErrors=1
7575
((failed++))
7676
echo -e "${FG_RED}${B}failed${N}"
7777
(($failFast)) && exit 1
78+
elif [ $testStatus -eq 2 ]; then
79+
((skipped++))
80+
echo -e "${FG_ORA}${B}skipped${N}"
7881
else
7982
((passed++))
8083
echo -e "${FG_GRN}passed${N}"
@@ -142,6 +145,7 @@ mkdir -p "${TESTROOT}/graphs_volume"
142145

143146
hasErrors=0
144147
passed=0
148+
skipped=0
145149
failed=0
146150

147151
for word in $pattern; do
@@ -152,8 +156,9 @@ for word in $pattern; do
152156
done
153157

154158
(($passed)) && passedText=", ${FG_GRN}${B}${passed} passed${N}"
159+
(($skipped)) && skippedText=", ${FG_ORA}${B}${skipped} skipped${N}"
155160
(($failed)) && failedText=", ${FG_RED}${B}${failed} failed${N}"
156161

157-
total=$(($passed + $failed))
158-
echo -e "${FG_BLU}$(date +%Y-%m-%dT%H:%M:%S)${N} ${B}done, ${total} test$( (($total-1)) && echo "s") executed${passedText}${failedText}"
162+
total=$(($passed + $skipped + $failed))
163+
echo -e "${FG_BLU}$(date +%Y-%m-%dT%H:%M:%S)${N} ${B}done, ${total} test$( (($total-1)) && echo "s") executed${passedText}${skippedText}${failedText}"
159164
exit $hasErrors

.integration-scenarios/debian-12-jar-mvn/tests/arg-overrides-default-prop.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ awaitOrsReady 60 "${HOST_PORT}"
2727
profiles=$(requestEnabledProfiles ${HOST_PORT})
2828
cleanupTest
2929

30-
assertEquals 'driving-hgv driving-car' "${profiles}"
30+
assertSortedWordsEquals 'driving-hgv driving-car' "${profiles}"

.integration-scenarios/debian-12-jar-mvn/tests/build-all-graphs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ awaitOrsReady 300 "${HOST_PORT}"
4343
profiles=$(requestEnabledProfiles ${HOST_PORT})
4444
cleanupTest
4545

46-
assertEquals "foot-walking wheelchair foot-hiking public-transport cycling-electric cycling-mountain driving-car driving-hgv cycling-regular cycling-road" "${profiles}"
46+
assertSortedWordsEquals "foot-walking wheelchair foot-hiking public-transport cycling-electric cycling-mountain driving-car driving-hgv cycling-regular cycling-road" "${profiles}"

.integration-scenarios/debian-12-jar-mvn/tests/_only-jar-missing-config-but-profile-enabled-as-env-dot.sh renamed to .integration-scenarios/debian-12-jar-mvn/tests/missing-config-but-profile-enabled-as-env-dot-jar-only.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ source $TESTROOT/files/testfunctions.sh
55
source $TESTROOT/files/test.conf
66
prepareTest $(basename $0) $*
77

8+
if [ "$runType" = "mvn" ]; then
9+
echo "skipping - mvn does not support env variables with dot notation"
10+
exit 2;
11+
fi
12+
813
# Even if no yml config file is present, the ors is runnable
914
# if at least one routing profile is enabled with a environment variable.
1015
podman run --replace --name "${CONTAINER}" -p "${HOST_PORT}":8082 \

.integration-scenarios/debian-12-jar-mvn/tests/missing-config-but-pbf-and-profile-enabled-as-arg.sh renamed to .integration-scenarios/debian-12-jar-mvn/tests/missing-config-but-required-params-as-arg.sh

File renamed without changes.

.integration-scenarios/debian-12-jar-mvn/tests/missing-config-but-pbf-and-profile-enabled-as-env-upper.sh renamed to .integration-scenarios/debian-12-jar-mvn/tests/missing-config-but-required-params-as-env-upper.sh

File renamed without changes.

0 commit comments

Comments
 (0)