Skip to content

Commit

Permalink
issue #3676 - first pass at replacing db2 with postgres in the contai…
Browse files Browse the repository at this point in the history
…nerized e2e tests

Signed-off-by: Lee Surprenant <lmsurpre@merative.com>
  • Loading branch information
lmsurpre committed Jul 22, 2022
1 parent 28af8d6 commit dd943dc
Show file tree
Hide file tree
Showing 20 changed files with 418 additions and 457 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- '.github/workflows/site.yml'

jobs:
e2e-db2-with-bulkdata:
e2e-postgres:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'ci-skip')"
strategy:
Expand Down Expand Up @@ -55,7 +55,6 @@ jobs:
containerId=$(docker ps -a | grep fhir | cut -d ' ' -f 1)
if [[ -z "${containerId}" ]]; then
echo "Warning: Could not find fhir container!!!"
bash build/docker/docker-cleanup.sh
else
echo "fhir container id: $containerId"
Expand All @@ -66,12 +65,12 @@ jobs:
docker cp -L $containerId:/logs ${it_results}/server-logs
fi
echo "Gathering integration test output"
cp -pr ${GITHUB_WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test || true
cp -r ${GITHUB_WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test || true
- name: Upload logs
if: always()
uses: actions/upload-artifact@v2.2.0
with:
name: integration-test-results-db2-${{ matrix.java }}
name: integration-test-results-${{ matrix.java }}
path: integration-test-results

concurrency:
Expand Down
2 changes: 1 addition & 1 deletion build/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
logs/
docker/fhir-server/volumes/
docker/fhir-server/
deploy.sh
*.jar
*.zip
Expand Down
38 changes: 38 additions & 0 deletions build/docker/bulkdata-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env sh
###############################################################################
# (C) Copyright IBM Corp. 2016, 2022
#
# SPDX-License-Identifier: Apache-2.0
###############################################################################
set -ex

if [[ -z "${WORKSPACE}" ]]; then
echo "ERROR: WORKSPACE environment variable not set!"
exit 1
fi

TEST_RESOURCES="${WORKSPACE}/fhir-server-test/src/test/resources"

BULKDATA="${WORKSPACE}/build/docker/fhir-server/bulkdata/"
mkdir -p ${BULKDATA}
cp ${TEST_RESOURCES}/testdata/import-operation/test-import.ndjson ${BULKDATA}
cp ${TEST_RESOURCES}/testdata/import-operation/test-import-skip.ndjson ${BULKDATA}
cp ${TEST_RESOURCES}/testdata/import-operation/test-import-neg.ndjson ${BULKDATA}
cp ${TEST_RESOURCES}/testdata/import-operation/test-import-mismatch.ndjson ${BULKDATA}

S3_BULKDATA="${WORKSPACE}/build/docker/minio/miniodata/fhirbulkdata/"
mkdir -p ${S3_BULKDATA}
cp ${TEST_RESOURCES}/testdata/import-operation/test-import.ndjson ${S3_BULKDATA}
cp ${TEST_RESOURCES}/testdata/import-operation/test-import-skip.ndjson ${S3_BULKDATA}
cp ${TEST_RESOURCES}/testdata/import-operation/test-import-neg.ndjson ${S3_BULKDATA}
cp ${TEST_RESOURCES}/testdata/import-operation/test-import-mismatch.ndjson ${S3_BULKDATA}

# Appending the path
echo "test.bulkdata.path = ${BULKDATA}" >> ${TEST_RESOURCES}/test.properties

# Enable bulkdata export/import tests
sed -i -e 's/test.bulkdata.export.enabled = false/test.bulkdata.export.enabled = true/g' ${TEST_RESOURCES}/test.properties
sed -i -e 's/test.bulkdata.import.enabled = false/test.bulkdata.import.enabled = true/g' ${TEST_RESOURCES}/test.properties

#sed -i -e 's/test.bulkdata.useminio = false/test.bulkdata.useminio = true/g' ${WORKSPACE}/fhir-server-test/src/test/resources/test.properties
#sed -i -e 's/test.bulkdata.useminio.inbuildpipeline = false/test.bulkdata.useminio.inbuildpipeline = true/g' ${WORKSPACE}/fhir-server-test/src/test/resources/test.properties
22 changes: 0 additions & 22 deletions build/docker/copy-schema-jar.sh

This file was deleted.

39 changes: 10 additions & 29 deletions build/docker/copy-server-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,24 @@ if [[ -z "${WORKSPACE}" ]]; then
fi

echo "Removing the old server config..."
CONFIG="${WORKSPACE}/build/docker/fhir-server/volumes/config"
rm -rf $CONFIG/* 2> /dev/null
mkdir -p $CONFIG

BULKDATA="${WORKSPACE}/build/docker/fhir-server/volumes/bulkdata/"
mkdir -p ${BULKDATA}
cp ${WORKSPACE}/fhir-server-test/src/test/resources/testdata/import-operation/test-import.ndjson ${BULKDATA}
cp ${WORKSPACE}/fhir-server-test/src/test/resources/testdata/import-operation/test-import-skip.ndjson ${BULKDATA}
cp ${WORKSPACE}/fhir-server-test/src/test/resources/testdata/import-operation/test-import-neg.ndjson ${BULKDATA}
cp ${WORKSPACE}/fhir-server-test/src/test/resources/testdata/import-operation/test-import-mismatch.ndjson ${BULKDATA}

S3_BULKDATA="${WORKSPACE}/build/docker/minio/miniodata/fhirbulkdata/"
mkdir -p ${S3_BULKDATA}
cp ${WORKSPACE}/fhir-server-test/src/test/resources/testdata/import-operation/test-import.ndjson ${S3_BULKDATA}
cp ${WORKSPACE}/fhir-server-test/src/test/resources/testdata/import-operation/test-import-skip.ndjson ${S3_BULKDATA}
cp ${WORKSPACE}/fhir-server-test/src/test/resources/testdata/import-operation/test-import-neg.ndjson ${S3_BULKDATA}
cp ${WORKSPACE}/fhir-server-test/src/test/resources/testdata/import-operation/test-import-mismatch.ndjson ${S3_BULKDATA}

# Appending the path
echo "test.bulkdata.path = ${BULKDATA}" >> ${WORKSPACE}/fhir-server-test/src/test/resources/test.properties
CONFIG="${WORKSPACE}/build/docker/fhir-server/config"
rm -rf ${CONFIG}/* 2> /dev/null
mkdir -p ${CONFIG}

echo "Copying the server config files..."
cp -r ${WORKSPACE}/fhir-server-webapp/src/main/liberty/config/config/* ${CONFIG}
cp -r ${WORKSPACE}/fhir-server-webapp/src/test/liberty/config/config/* ${CONFIG}
bash ${WORKSPACE}/build/update-server-registry-resource.sh ${WORKSPACE}/fhir-server-webapp/src/main/liberty/config/config/default/fhir-server-config-db2.json
cp -r ${WORKSPACE}/fhir-server-webapp/src/main/liberty/config/config/default/fhir-server-config-db2.json ${CONFIG}/default/fhir-server-config.json
bash ${WORKSPACE}/build/update-server-registry-resource.sh ${WORKSPACE}/fhir-server-webapp/src/main/liberty/config/config/default/fhir-server-config-postgresql.json
cp -r ${WORKSPACE}/fhir-server-webapp/src/main/liberty/config/config/default/fhir-server-config-postgresql.json ${CONFIG}/default/fhir-server-config.json

echo "Replacing datasource content in server configDropins..."
OVERRIDES="${WORKSPACE}/build/docker/fhir-server/volumes/overrides"
OVERRIDES="${WORKSPACE}/build/docker/fhir-server/configDropins/overrides"
rm -rf ${OVERRIDES}/* 2> /dev/null
mkdir -p ${OVERRIDES}

# Just in case it already exists, let's wipe the datsource*.xml files
rm -f ${OVERRIDES}/datasource*.xml

# Copy over both the db2 (default_default) and derby (tenant1_*) datasource definitions
cp ${WORKSPACE}/fhir-server-webapp/src/main/liberty/config/configDropins/disabled/datasource-db2.xml ${OVERRIDES}/
cp ${WORKSPACE}/fhir-server-webapp/src/main/liberty/config/configDropins/disabled/db2/bulkdata.xml ${OVERRIDES}/
# Copy over both the postgres (default_default) and derby (tenant1_*) datasource definitions
cp ${WORKSPACE}/fhir-server-webapp/src/main/liberty/config/configDropins/disabled/datasource-postgresql.xml ${OVERRIDES}/
cp ${WORKSPACE}/fhir-server-webapp/src/main/liberty/config/configDropins/disabled/postgres/bulkdata.xml ${OVERRIDES}/
cp ${WORKSPACE}/fhir-server-webapp/src/test/liberty/config/configDropins/overrides/datasource-derby.xml ${OVERRIDES}/

echo "Finished copying the server config."
6 changes: 3 additions & 3 deletions build/docker/copy-test-operations.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash
###############################################################################
# (C) Copyright IBM Corp. 2016, 2020
# (C) Copyright IBM Corp. 2016, 2022
#
# SPDX-License-Identifier: Apache-2.0
###############################################################################
set -e
set -ex

if [[ -z "${WORKSPACE}" ]]; then
echo "ERROR: WORKSPACE environment variable not set!"
exit 1
fi

echo "Removing old test operations..."
USERLIB="${WORKSPACE}/build/docker/fhir-server/volumes/userlib"
USERLIB="${WORKSPACE}/build/docker/fhir-server/userlib"
rm -rf $USERLIB/* 2> /dev/null
mkdir -p $USERLIB

Expand Down
5 changes: 0 additions & 5 deletions build/docker/db2.properties

This file was deleted.

21 changes: 0 additions & 21 deletions build/docker/db2/Dockerfile

This file was deleted.

36 changes: 0 additions & 36 deletions build/docker/db2/create-database.sh

This file was deleted.

73 changes: 0 additions & 73 deletions build/docker/deploySchemaAndTenant.sh

This file was deleted.

Loading

0 comments on commit dd943dc

Please sign in to comment.