Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2e tests for recipes #278

Merged
merged 59 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
7f8af2a
Add end to end tests for the cdr recipe
bradsawadye Apr 4, 2024
eca611d
Use version that exists
bradsawadye Apr 4, 2024
7640bc0
Add axios dependency
bradsawadye Apr 4, 2024
fb8641e
Run the cdr recipe tests
bradsawadye Apr 4, 2024
8693124
Fix the superset keycloak integration config
bradsawadye Apr 10, 2024
0ab08dd
Use latest version of mpi-mediator
bradsawadye Apr 10, 2024
601d674
Add tests for the dataware house
bradsawadye Apr 10, 2024
d7858ac
rename variable to be more descriptive
bradsawadye Apr 10, 2024
268e10d
Merge branch 'main' of github.com:jembi/platform into e2e-tests-for-r…
bradsawadye Apr 10, 2024
7df4c84
Fix broken logic for running recipe tests
bradsawadye Apr 11, 2024
18b682d
Add missing end of if statement
bradsawadye Apr 11, 2024
b83327f
Ensure that recipe cdr tests are run on every pr created
bradsawadye Apr 11, 2024
6bb3584
Run in prod mode
bradsawadye Apr 12, 2024
7d0f997
Increase the time-out for the test action
bradsawadye Apr 12, 2024
435e1d9
Run one feature to test changes in the utils, steps and infrastructur…
bradsawadye Apr 12, 2024
9708329
Fix typo
bradsawadye Apr 12, 2024
ba00297
Superset now consists of two services
bradsawadye Apr 12, 2024
e23eae2
Fix typo
bradsawadye Apr 12, 2024
30028c0
Use 0.0.0.0 instead of localhost
bradsawadye Apr 14, 2024
d94f678
Access the services via the reverse proxy in the recipe tests
bradsawadye Apr 14, 2024
e180c1d
Use the ip of the aws instance for requests
bradsawadye Apr 14, 2024
cf93d01
Run tests in dev mode so all the services are exposed
bradsawadye Apr 14, 2024
913346d
Specify the port
bradsawadye Apr 14, 2024
9e698e6
Use locahost as the services are being run in dev mode
bradsawadye Apr 15, 2024
d67af88
Use 0.0.0.0 instead of localhost
bradsawadye Apr 15, 2024
678de01
Open ports for the tests (temporary)
bradsawadye Apr 15, 2024
93b9094
Use host ip
bradsawadye Apr 15, 2024
c59b0a7
Add channel for retrieving patient using the interaction id
bradsawadye Apr 16, 2024
688cc21
Open the clickhouse port for testing
bradsawadye Apr 16, 2024
b1b6ac3
Use the correct port
bradsawadye Apr 16, 2024
c76cca1
Increase channel priority so that is can be accessed
bradsawadye Apr 16, 2024
f69cc7a
Cater for socket hang up error
bradsawadye Apr 16, 2024
c96c2b1
Debug
bradsawadye Apr 16, 2024
f199cc6
Set the correct kafka host value for clustered mode
bradsawadye Apr 17, 2024
8b65d2d
Wait for the data to be in clickhouse before quering
bradsawadye Apr 18, 2024
5e013c6
Correct the brokers for openhim in cluster mode
bradsawadye Apr 18, 2024
d6120a9
Merge branch 'main' into e2e-tests-for-recipes
bradsawadye Apr 18, 2024
24a1ee1
Increase waiting period before clickhouse query
bradsawadye Apr 18, 2024
6464a70
wait for the services to be started up before tests
bradsawadye Apr 18, 2024
cbe245d
Reduce timeout fro debugging purposes
bradsawadye Apr 18, 2024
891783e
Wait for services to up and running
bradsawadye Apr 18, 2024
dce7720
add step for waiting for the services to be up
bradsawadye Apr 18, 2024
1b6a2ab
Add the topics used so they are created before the services try to co…
bradsawadye Apr 19, 2024
c6e0202
Log response for debugging purposes
bradsawadye Apr 19, 2024
7da9e98
Change order of starting up packages
bradsawadye Apr 19, 2024
304ffff
Cater for a timeout response when the services are down
bradsawadye Apr 19, 2024
f7bc012
Open port for testing
bradsawadye Apr 19, 2024
65a85e0
Open port for testing
bradsawadye Apr 19, 2024
98dd506
Increase waiting period before requests to tes are sent
bradsawadye Apr 19, 2024
8ef1633
Clean up
bradsawadye Apr 22, 2024
ededfb3
Temporarily remove the scenarios that check the system can be restore…
bradsawadye Apr 22, 2024
04664f3
Run step for opening up the ports for testing
bradsawadye Apr 22, 2024
0379fcc
Add security group for use in tests where ports are exposed
bradsawadye Apr 22, 2024
14fa480
Merge branch 'main' into e2e-tests-for-recipes
bradsawadye Apr 22, 2024
fc46bd2
Move tests security to tests folder
bradsawadye Apr 22, 2024
f9d3cf5
Merge branch 'e2e-tests-for-recipes' of github.com:jembi/platform int…
bradsawadye Apr 22, 2024
c4ee1d7
Fix typo
bradsawadye Apr 22, 2024
ef2fea0
Merge branch 'main' into e2e-tests-for-recipes
bradsawadye Apr 23, 2024
8fa0298
Merge branch 'main' into e2e-tests-for-recipes
drizzentic Apr 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .env.cluster
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ OPENHIM_MEDIATOR_API_PORT=443
MONGO_SET_COUNT=3
OPENHIM_MONGO_URL=mongodb://mongo-1:27017,mongo-2:27017,mongo-3:27017/openhim?replicaSet=mongo-set
OPENHIM_MONGO_ATNAURL=mongodb://mongo-1:27017,mongo-2:27017,mongo-3:27017/openhim?replicaSet=mongo-set
KAFKA_BROKERS=kafka-01,kafka-02,kafka-03

# FHIR Datastore - HAPI FHIR
HAPI_FHIR_INSTANCES=3
Expand Down Expand Up @@ -63,9 +64,13 @@ JS_REPORT_PACKAGE_PATH=
# Message Bus Kafka
# Topics should comma seperated, optional include partion and repliction values
# e.g. <topic>:<partions>:<replicationFactor> -> test:3:2 (defaults to <topics>:3:1)
KAFKA_TOPICS=2xx,reprocess,3xx,metrics:3:3
KAFKA_TOPICS=2xx,2xx-async,reprocess,3xx,metrics:3:3,patient,observation
KAFKA_HOSTS=kafka-01:9092,kafka-02:9092,kafka-03:9092

# Kafka consumer mapper
KAFKA_HOST=kafka-01,kafka-02,kafka-03
KAFKA_PORT=9092

# MPI MEDIATOR
MPI_MEDIATOR_INSTANCES=3

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
shell: bash
env:
SSH_KEY: ${{ secrets.DEPLOY_KEY_PUB }}
- run: cp ../../test/cucumber/features/resources/testsSecurity.tf ./security.tf
- run: terraform init
- run: terraform apply -auto-approve
- name: Upload terraform state
Expand Down Expand Up @@ -72,7 +73,7 @@ jobs:
run-e2e-tests:
runs-on: ubuntu-20.04
needs: configure-e2e-server
timeout-minutes: 120
timeout-minutes: 160
steps:
- uses: actions/checkout@v3
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
shell: bash
env:
SSH_KEY: ${{ secrets.DEPLOY_KEY_PUB }}
- run: cp ../../test/cucumber/features/resources/testsSecurity.tf ./security.tf
- run: terraform init
- run: terraform apply -auto-approve
- name: Upload terraform state
Expand Down Expand Up @@ -71,7 +72,7 @@ jobs:
run-e2e-tests:
runs-on: ubuntu-20.04
needs: configure-e2e-server
timeout-minutes: 80
timeout-minutes: 120
steps:
- uses: actions/checkout@v3
with:
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@ for package in "${CHANGED_FILES[@]}"; do
fi
done

if [[ ${#changed_packages[@]} -eq 0 ]] || [[ "${!changed_packages[*]}" == *"utils"* ]]; then
DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:"$NODE_MODE"
elif [[ "${!changed_packages[*]}" == *"features/single-mode"* ]] && [[ $NODE_MODE == "single" ]]; then
DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:single
elif [[ "${!changed_packages[*]}" == *"features/cluster-mode"* ]] && [[ $NODE_MODE == "cluster" ]]; then
DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:cluster
elif [[ "${!changed_packages[*]}" == *"infrastructure"* ]] && [[ $openhimRan == "false" ]]; then
openhimRan="true"
if [[ ${#changed_packages[@]} -eq 0 ]] || [[ "${!changed_packages[*]}" == *"utils"* ]] || [[ "${!changed_packages[*]}" == *"features/steps"* ]] || [[ "${!changed_packages[*]}" == *"infrastructure"* ]] ; then
openhim_ran="true"
DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:"$NODE_MODE":openhim
else
for folder_name in "${!changed_packages[@]}"; do
Expand Down Expand Up @@ -68,3 +62,6 @@ else
fi
done
fi

# Run the basic funtional end to end tests for the CDR recipe
DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud HOST=$GITHUB_RUN_ID.jembi.cloud yarn test:"$NODE_MODE":recipe
2 changes: 2 additions & 0 deletions cdr-dw.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ KC_JEMPI_SSO_ENABLED=true
REACT_APP_JEMPI_BASE_API_PORT=50001
KC_SUPERSET_SSO_ENABLED=true
KC_GRAFANA_SSO_ENABLED=true

INSECURE_PORTS=5001:5001-80:80-8080:8080-3003:3003-8124:8123-5601:5601-5488:5488-3000:3000-9200:9200-8089:8089-9001:9001-3033:3033-50000:50000
6 changes: 3 additions & 3 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ packages:
profiles:
- name: cdr-dw
packages:
- message-bus-kafka
- interoperability-layer-openhim
- reverse-proxy-nginx
- fhir-datastore-hapi-fhir
- message-bus-kafka
- job-scheduler-ofelia
- kafka-mapper-consumer
- kafka-unbundler-consumer
- analytics-datastore-clickhouse
- dashboard-visualiser-superset
- monitoring
- mpi-mediator
- client-registry-jempi
- identity-access-manager-keycloak
- openhim-mapping-mediator
- kafka-mapper-consumer
- kafka-unbundler-consumer
envFiles:
- cdr-dw.env

Expand Down
6 changes: 3 additions & 3 deletions dashboard-visualiser-superset/config/requirements-local.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
psycopg2>=2.9.9
clickhouse-connect>=0.7.0
flask-oidc>=1.3.0
itsdangerous>=2.0.1
flask_openid>=1.3.0
flask-oidc==1.3.0
itsdangerous==2.0.1
flask_openid==1.3.0
7 changes: 0 additions & 7 deletions infrastructure/terraform/security.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ resource "aws_security_group" "docker_swarm_sg" {
cidr_blocks = [
"0.0.0.0/0"]
}
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = [
"0.0.0.0/0"]
}
ingress {
from_port = 443
to_port = 443
Expand Down
2 changes: 1 addition & 1 deletion mpi-mediator/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.9'

services:
mpi-mediator:
image: jembi/mpi-mediator:v2.1.0
image: jembi/mpi-mediator:v2.1.1
networks:
openhim:
kafka:
Expand Down
67 changes: 67 additions & 0 deletions mpi-mediator/importer/volume/openhim-import.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,73 @@
"id": "65d47e98223a0672c3c9808b",
"name": "Super User"
}
},
{
"name": "JeMPI Patient links endpoint in fhir",
"description": "JeMPI Patient endpoint for retrieving using the patient interaction id",
"urlPattern": "^/fhir/links/Patient/?[^/]*$",
"isAsynchronousProcess": false,
"methods": [
"GET",
"POST",
"DELETE",
"PUT",
"OPTIONS",
"HEAD",
"TRACE",
"CONNECT",
"PATCH"
],
"type": "http",
"tcpPort": null,
"tcpHost": null,
"pollingSchedule": null,
"requestBody": true,
"responseBody": true,
"allow": [
"instant"
],
"whitelist": [],
"authType": "private",
"routes": [
{
"name": "Generic Mapping Mediator",
"type": "http",
"status": "enabled",
"secured": false,
"host": "openhim-mapping-mediator",
"port": 3003,
"path": "",
"pathTransform": "",
"primary": true,
"username": "",
"password": "",
"forwardAuthHeader": true,
"waitPrimaryResponse": false,
"statusCodesCheck": "2**"
}
],
"matchContentTypes": [],
"matchContentRegex": null,
"matchContentXpath": null,
"matchContentJson": null,
"matchContentValue": null,
"properties": [],
"txViewAcl": [],
"txViewFullAcl": [],
"txRerunAcl": [],
"alerts": [],
"status": "enabled",
"rewriteUrls": false,
"addAutoRewriteRules": true,
"rewriteUrlsConfig": [],
"autoRetryEnabled": false,
"autoRetryPeriodMinutes": 60,
"updatedBy": {
"id": "661e3c1206d33f9dfbcb3094",
"name": "test test"
},
"priority": 1
}
],
"Mediators": [
Expand Down
34 changes: 34 additions & 0 deletions test/cucumber/features/cluster-mode/recipe.cluster.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Feature: CDR recipe?
Does the recipe work as expected

Scenario: Init the CDR recipe
Given I use parameters "package init -p cdr-dw --dev --env-file=.env.cluster"
When I launch the platform with params
Then The service "mongo-1" should be started with 1 replica
And The service "openhim-core" should be started with 3 replica
And The service "openhim-console" should be started with 3 replica
And The service "kafka-unbundler-consumer" should be started with 1 replica
And The service "kafka-mapper-consumer" should be started with 1 replica

Scenario: Send Fhir bundle and store the clinical data in the Fhir datastore, and the patient info in the CR
Given I have configured the cdr
When I send a fhir patient bundle
Then the clinical data should be stored in hapi fhir
And the patient data in the Jempi client registry
And the data should be stored in clickhouse

Scenario: Fetch International Patient summary (IPS)
When I send a fhir patient bundle
And I then send a fhir patient summary request
Then I should get a successful summary response

Scenario: Fetch everything for a patient (all the clinical data)
When I send a fhir patient bundle
And I then send a request for all the patient's clinical data
Then I should get a successful everything response

Scenario: Destroy the services
Given I use parameters "package remove -p cdr-dw --env-file=.env.cluster"
When I launch the platform with params
Then There should be 0 service
And There should be 0 volume
Loading