Skip to content

Commit 19a7759

Browse files
correcting audit integration test script file (#4071)
* correcting audit integration test script file Signed-off-by: PrasannaHegde1 <[email protected]> * correcting audit integration test script file Signed-off-by: PrasannaHegde1 <[email protected]> * correcting audit integration test script file Signed-off-by: PrasannaHegde1 <[email protected]> * e2e-audit should fail if tests fail Signed-off-by: Lee Surprenant <[email protected]> * disable TTY for docker-compose exec To fix issue where the script bombs out with 'the input device is not a TTY'. From the man page for docker-compose exec `-T`: Disable pseudo-tty allocation. By default docker-compose exec allocates a TTY. Signed-off-by: Lee Surprenant <[email protected]> * Copy over tenant1 derby datasource definitions Signed-off-by: Lee Surprenant <[email protected]> * adding overrides target to docker compose file Signed-off-by: PrasannaHegde1 <[email protected]> * adding erase operation config to fhir-server-config-audit-cicd.json Signed-off-by: PrasannaHegde1 <[email protected]> * adding X-FHIR-FORWARDED-URL config to fhir-server-config-audit-cicd.json Signed-off-by: PrasannaHegde1 <[email protected]> Signed-off-by: PrasannaHegde1 <[email protected]> Signed-off-by: Lee Surprenant <[email protected]> Co-authored-by: Lee Surprenant <[email protected]>
1 parent 09233ac commit 19a7759

File tree

9 files changed

+49
-18
lines changed

9 files changed

+49
-18
lines changed

.github/workflows/audit.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ jobs:
3434
- name: Server Integration Tests - Audit
3535
env:
3636
WORKSPACE: ${{ github.workspace }}
37-
shell: 'script -q -e -c "bash {0}"'
37+
# fail-fast behavior is set when `shell: bash` is explicitly specified. It is not applied by default.
38+
shell: bash
3839
run: |
3940
bash build/audit/bin/pre-integration-test.sh ${{matrix.audit}}
4041
bash build/audit/bin/integration-test.sh ${{matrix.audit}}

build/audit/bin/gather-logs.sh

+9-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@ package_logs(){
3434
docker cp -L $containerId:/logs ${it_results}/server-logs
3535
fi
3636

37-
echo "Gathering integration test output"
38-
cp -pr ${WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test
39-
40-
echo "Move the ${1} Elements too the output area'"
41-
cp -pr ${WORKSPACE}/build/audit/${1}/workarea/* ${it_results}
37+
if [ -d "${WORKSPACE}/fhir-server-test/target/surefire-reports" ]; then
38+
echo "Gathering integration test output"
39+
cp -r ${WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test
40+
fi
41+
42+
if [ -d "${WORKSPACE}/build/audit/${1}/workarea" ]; then
43+
echo "Move the ${1} files to the output area'"
44+
cp -r ${WORKSPACE}/build/audit/${1}/workarea/* ${it_results}
45+
fi
4246
}
4347

4448
###############################################################################

build/audit/bin/pre-integration-test.sh

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ pushd $(pwd) > /dev/null
3131
# Change to the audit_pre
3232
cd "${WORKSPACE}"
3333

34+
# Source the tenant1 datastore variables
35+
. ${WORKSPACE}/build/common/set-tenant1-datastore-vars.sh
36+
3437
audit_pre "${1}"
3538

3639
# Reset to Original Directory

build/audit/kafka/docker-compose.yml

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ services:
5959
source: ./workarea/volumes/dist/config
6060
target: /opt/ol/wlp/usr/servers/defaultServer/config
6161
read_only: true
62+
- type: bind
63+
source: ./workarea/volumes/dist/overrides
64+
target: /opt/ol/wlp/usr/servers/defaultServer/configDropins/overrides
65+
read_only: true
6266
- type: bind
6367
source: ./workarea/volumes/dist/userlib/
6468
target: /opt/ol/wlp/usr/servers/defaultServer/userlib

build/audit/kafka/integration-test.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
#
66
# SPDX-License-Identifier: Apache-2.0
77
###############################################################################
8-
9-
set -o errexit
8+
set -e
109
set -o nounset
1110
set -o pipefail
1211

@@ -28,7 +27,7 @@ mvn -B -nsu -ntp test -DskipTests=false -f fhir-server-test -DskipWebSocketTest=
2827

2928
# The following test should always Run
3029
echo "TEST_CONFIGURATION: check that there is output and the configuration works"
31-
docker-compose -f build/audit/kafka/docker-compose.yml exec kafka-1 bash /bin/kafka-console-consumer --timeout-ms 60000 --bootstrap-server=kafka-1:19092,kafka-2:29092 \
30+
docker-compose -f build/audit/kafka/docker-compose.yml exec -T kafka-1 bash /bin/kafka-console-consumer --timeout-ms 60000 --bootstrap-server=kafka-1:19092,kafka-2:29092 \
3231
--topic FHIR_AUDIT --max-messages 25 --property print.timestamp=true --offset earliest \
3332
--consumer.config /etc/kafka/secrets/client-ssl.properties \
3433
--partition 1 > ${WORKSPACE}/build/audit/kafka/workarea/output/fhir_audit-messages.log

build/audit/kafka/pre-integration-test.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
###############################################################################
88
set -ex
99

10+
export WORKSPACE=$(pwd)
1011
DIST="${WORKSPACE}/build/audit/kafka/workarea/volumes/dist"
1112

1213
# pre_integration
@@ -21,21 +22,24 @@ config(){
2122
mkdir -p ${DIST}/userlib
2223
mkdir -p ${DIST}/
2324
mkdir -p ${WORKSPACE}/build/audit/kafka/workarea/output
24-
25+
mkdir -p ${DIST}/overrides
2526
touch ${WORKSPACE}/build/audit/kafka/workarea/output/fhir_audit-messages.log
2627
chmod +rwx ${WORKSPACE}/build/audit/kafka/workarea/output/fhir_audit-messages.log
2728
chmod -R 777 ${WORKSPACE}/build/audit/kafka/workarea/output/
2829

2930
echo "Copying fhir configuration files..."
3031
cp -r ${WORKSPACE}/fhir-server-webapp/src/main/liberty/config/config $DIST/
3132
cp -r ${WORKSPACE}/fhir-server-webapp/src/test/liberty/config/config/* $DIST/config/
33+
# Copy over the tenant1 derby datasource definitions
34+
cp ${WORKSPACE}/fhir-server-webapp/src/test/liberty/config/configDropins/overrides/datasource-derby.xml $DIST/overrides/datasource-derby.xml
3235

3336
echo "Copying test artifacts to install location..."
3437
USERLIB="${DIST}/userlib"
3538
mkdir -p $USERLIB
3639
find ${WORKSPACE}/conformance -iname 'fhir-ig*.jar' -not -iname 'fhir*-tests.jar' -not -iname 'fhir*-test-*.jar' -exec cp -f {} ${USERLIB} \;
3740
cp ${WORKSPACE}/operation/fhir-operation-test/target/fhir-operation-*.jar ${USERLIB}
3841
cp ${WORKSPACE}/term/operation/fhir-operation-term-cache/target/fhir-operation-*.jar ${USERLIB}
42+
3943
echo "Finished copying fhir-server dependencies..."
4044

4145
# Move over the test configurations
@@ -117,7 +121,7 @@ bringup(){
117121
echo "The fhir-server appears to be running..."
118122

119123
# Create the FHIR_AUDIT topic
120-
docker-compose -f build/audit/kafka/docker-compose.yml exec kafka-1 bash /bin/kafka-topics \
124+
docker-compose -f build/audit/kafka/docker-compose.yml exec -T kafka-1 bash /bin/kafka-topics \
121125
--bootstrap-server kafka-1:19092,kafka-2:29092 --command-config /etc/kafka/secrets/client-ssl.properties \
122126
--create --topic FHIR_AUDIT --partitions 10 --replication-factor 2
123127
[ $? -eq 0 ] || exit 9

build/notifications/bin/gather-logs.sh

+9-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@ package_logs(){
3434
docker cp -L $containerId:/logs ${it_results}/server-logs
3535
fi
3636

37-
echo "Gathering integration test output"
38-
cp -pr ${WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test
39-
40-
echo "Move the ${1} Elements too the output area'"
41-
cp -pr ${WORKSPACE}/build/notifications/${1}/workarea/* ${it_results}
37+
if [ -d "${WORKSPACE}/fhir-server-test/target/surefire-reports" ]; then
38+
echo "Gathering integration test output"
39+
cp -r ${WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test
40+
fi
41+
42+
if [ -d "${WORKSPACE}/build/notifications/${1}/workarea" ]; then
43+
echo "Move the ${1} files to the output area'"
44+
cp -r ${WORKSPACE}/build/notifications/${1}/workarea/* ${it_results}
45+
fi
4246
}
4347

4448
###############################################################################

build/persistence/bin/gather-logs.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ package_logs(){
3434
docker cp -L $containerId:/logs ${it_results}/server-logs
3535
fi
3636

37-
echo "Gathering integration test output"
38-
cp -pr ${WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test
37+
if [ -d "${WORKSPACE}/fhir-server-test/target/surefire-reports" ]; then
38+
echo "Gathering integration test output"
39+
cp -r ${WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test
40+
fi
3941
}
4042

4143
###############################################################################

fhir-server-webapp/src/test/liberty/config/config/default/fhir-server-config-audit-cicd.json

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"core": {
55
"tenantIdHeaderName": "X-FHIR-TENANT-ID",
66
"datastoreIdHeaderName": "X-FHIR-DSID",
7+
"originalRequestUriHeaderName": "X-FHIR-FORWARDED-URL",
78
"checkReferenceTypes": true,
89
"conditionalDeleteMaxNumber": 10,
910
"__comment": "The CI changes this to true, and the false is intentional as we recommend for performance reasons.",
@@ -142,6 +143,15 @@
142143
},
143144
"bulkdata": {
144145
"enabled": false
146+
},
147+
"operations": {
148+
"erase": {
149+
"enabled": true,
150+
"allowedRoles": [
151+
"FHIROperationAdmin",
152+
"FHIRUsers"
153+
]
154+
}
145155
}
146156
}
147157
}

0 commit comments

Comments
 (0)