Skip to content

Commit

Permalink
correcting audit integration test script file (#4071)
Browse files Browse the repository at this point in the history
* correcting audit integration test script file

Signed-off-by: PrasannaHegde1 <phegde@merative.com>

* correcting audit integration test script file

Signed-off-by: PrasannaHegde1 <phegde@merative.com>

* correcting audit integration test script file

Signed-off-by: PrasannaHegde1 <phegde@merative.com>

* e2e-audit should fail if tests fail

Signed-off-by: Lee Surprenant <lmsurpre@merative.com>

* 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 <lmsurpre@merative.com>

* Copy over tenant1 derby datasource definitions

Signed-off-by: Lee Surprenant <lmsurpre@merative.com>

* adding overrides target to docker compose file

Signed-off-by: PrasannaHegde1 <phegde@merative.com>

* adding erase operation config to fhir-server-config-audit-cicd.json

Signed-off-by: PrasannaHegde1 <phegde@merative.com>

* adding X-FHIR-FORWARDED-URL config to fhir-server-config-audit-cicd.json

Signed-off-by: PrasannaHegde1 <phegde@merative.com>

Signed-off-by: PrasannaHegde1 <phegde@merative.com>
Signed-off-by: Lee Surprenant <lmsurpre@merative.com>
Co-authored-by: Lee Surprenant <lmsurpre@merative.com>
  • Loading branch information
PrasannaHegde1 and lmsurpre authored Nov 11, 2022
1 parent 09233ac commit 19a7759
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ jobs:
- name: Server Integration Tests - Audit
env:
WORKSPACE: ${{ github.workspace }}
shell: 'script -q -e -c "bash {0}"'
# fail-fast behavior is set when `shell: bash` is explicitly specified. It is not applied by default.
shell: bash
run: |
bash build/audit/bin/pre-integration-test.sh ${{matrix.audit}}
bash build/audit/bin/integration-test.sh ${{matrix.audit}}
Expand Down
14 changes: 9 additions & 5 deletions build/audit/bin/gather-logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ package_logs(){
docker cp -L $containerId:/logs ${it_results}/server-logs
fi

echo "Gathering integration test output"
cp -pr ${WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test

echo "Move the ${1} Elements too the output area'"
cp -pr ${WORKSPACE}/build/audit/${1}/workarea/* ${it_results}
if [ -d "${WORKSPACE}/fhir-server-test/target/surefire-reports" ]; then
echo "Gathering integration test output"
cp -r ${WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test
fi

if [ -d "${WORKSPACE}/build/audit/${1}/workarea" ]; then
echo "Move the ${1} files to the output area'"
cp -r ${WORKSPACE}/build/audit/${1}/workarea/* ${it_results}
fi
}

###############################################################################
Expand Down
3 changes: 3 additions & 0 deletions build/audit/bin/pre-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ pushd $(pwd) > /dev/null
# Change to the audit_pre
cd "${WORKSPACE}"

# Source the tenant1 datastore variables
. ${WORKSPACE}/build/common/set-tenant1-datastore-vars.sh

audit_pre "${1}"

# Reset to Original Directory
Expand Down
4 changes: 4 additions & 0 deletions build/audit/kafka/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ services:
source: ./workarea/volumes/dist/config
target: /opt/ol/wlp/usr/servers/defaultServer/config
read_only: true
- type: bind
source: ./workarea/volumes/dist/overrides
target: /opt/ol/wlp/usr/servers/defaultServer/configDropins/overrides
read_only: true
- type: bind
source: ./workarea/volumes/dist/userlib/
target: /opt/ol/wlp/usr/servers/defaultServer/userlib
Expand Down
5 changes: 2 additions & 3 deletions build/audit/kafka/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#
# SPDX-License-Identifier: Apache-2.0
###############################################################################

set -o errexit
set -e
set -o nounset
set -o pipefail

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

# The following test should always Run
echo "TEST_CONFIGURATION: check that there is output and the configuration works"
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 \
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 \
--topic FHIR_AUDIT --max-messages 25 --property print.timestamp=true --offset earliest \
--consumer.config /etc/kafka/secrets/client-ssl.properties \
--partition 1 > ${WORKSPACE}/build/audit/kafka/workarea/output/fhir_audit-messages.log
Expand Down
8 changes: 6 additions & 2 deletions build/audit/kafka/pre-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
###############################################################################
set -ex

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

# pre_integration
Expand All @@ -21,21 +22,24 @@ config(){
mkdir -p ${DIST}/userlib
mkdir -p ${DIST}/
mkdir -p ${WORKSPACE}/build/audit/kafka/workarea/output

mkdir -p ${DIST}/overrides
touch ${WORKSPACE}/build/audit/kafka/workarea/output/fhir_audit-messages.log
chmod +rwx ${WORKSPACE}/build/audit/kafka/workarea/output/fhir_audit-messages.log
chmod -R 777 ${WORKSPACE}/build/audit/kafka/workarea/output/

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

echo "Copying test artifacts to install location..."
USERLIB="${DIST}/userlib"
mkdir -p $USERLIB
find ${WORKSPACE}/conformance -iname 'fhir-ig*.jar' -not -iname 'fhir*-tests.jar' -not -iname 'fhir*-test-*.jar' -exec cp -f {} ${USERLIB} \;
cp ${WORKSPACE}/operation/fhir-operation-test/target/fhir-operation-*.jar ${USERLIB}
cp ${WORKSPACE}/term/operation/fhir-operation-term-cache/target/fhir-operation-*.jar ${USERLIB}

echo "Finished copying fhir-server dependencies..."

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

# Create the FHIR_AUDIT topic
docker-compose -f build/audit/kafka/docker-compose.yml exec kafka-1 bash /bin/kafka-topics \
docker-compose -f build/audit/kafka/docker-compose.yml exec -T kafka-1 bash /bin/kafka-topics \
--bootstrap-server kafka-1:19092,kafka-2:29092 --command-config /etc/kafka/secrets/client-ssl.properties \
--create --topic FHIR_AUDIT --partitions 10 --replication-factor 2
[ $? -eq 0 ] || exit 9
Expand Down
14 changes: 9 additions & 5 deletions build/notifications/bin/gather-logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ package_logs(){
docker cp -L $containerId:/logs ${it_results}/server-logs
fi

echo "Gathering integration test output"
cp -pr ${WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test

echo "Move the ${1} Elements too the output area'"
cp -pr ${WORKSPACE}/build/notifications/${1}/workarea/* ${it_results}
if [ -d "${WORKSPACE}/fhir-server-test/target/surefire-reports" ]; then
echo "Gathering integration test output"
cp -r ${WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test
fi

if [ -d "${WORKSPACE}/build/notifications/${1}/workarea" ]; then
echo "Move the ${1} files to the output area'"
cp -r ${WORKSPACE}/build/notifications/${1}/workarea/* ${it_results}
fi
}

###############################################################################
Expand Down
6 changes: 4 additions & 2 deletions build/persistence/bin/gather-logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ package_logs(){
docker cp -L $containerId:/logs ${it_results}/server-logs
fi

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

###############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"core": {
"tenantIdHeaderName": "X-FHIR-TENANT-ID",
"datastoreIdHeaderName": "X-FHIR-DSID",
"originalRequestUriHeaderName": "X-FHIR-FORWARDED-URL",
"checkReferenceTypes": true,
"conditionalDeleteMaxNumber": 10,
"__comment": "The CI changes this to true, and the false is intentional as we recommend for performance reasons.",
Expand Down Expand Up @@ -142,6 +143,15 @@
},
"bulkdata": {
"enabled": false
},
"operations": {
"erase": {
"enabled": true,
"allowedRoles": [
"FHIROperationAdmin",
"FHIRUsers"
]
}
}
}
}

0 comments on commit 19a7759

Please sign in to comment.