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

test: added validation to stress test and mocks for entici and gpas #115

Merged
merged 1 commit into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.25.0",
"version": "0.26.3",
"commands": ["dotnet-csharpier"]
},
"dotnet-outdated-tool": {
"version": "4.5.3",
"version": "4.6.0",
"commands": ["dotnet-outdated"]
}
}
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,17 @@ jobs:
- name: List images in cluster
run: docker exec kind-control-plane crictl images

- name: Install the latest version of vfps as a pseudonymization service
run: |
helm repo add chgl https://chgl.github.io/charts
helm install \
--wait \
--timeout=10m \
vfps chgl/vfps

- name: Install "fhir-pseudonymizer"
env:
IMAGE_TAG: ${{ needs.build.outputs.image-version }}
run: |
helm repo add miracum https://miracum.github.io/charts
helm install \
--set="image.tag=${IMAGE_TAG}" \
-f tests/iter8/values.yaml \
--wait \
--timeout=10m \
fhir-pseudonymizer miracum/fhir-pseudonymizer
fhir-pseudonymizer \
oci://ghcr.io/miracum/charts/fhir-pseudonymizer

- name: Launch iter8 experiment
run: kubectl apply -f tests/iter8/experiment.yaml
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,5 @@ tests/chaos/argo
*-iid.txt

*.received.*

.task/
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ pre-commit install --hook-type commit-msg
### Run iter8 SLO experiments locally

```sh
ITER8_CLI_URL="https://github.com/iter8-tools/iter8/releases/download/v0.13.18/iter8-linux-amd64.tar.gz"
curl -LSs "${ITER8_CLI_URL}" | tar xz
mv linux-amd64/iter8 /usr/local/bin/iter8
chmod +x /usr/local/bin/iter8
iter8 version

kind create cluster

export IMAGE_TAG="iter8-test"
Expand All @@ -325,11 +331,6 @@ docker build -t ghcr.io/miracum/fhir-pseudonymizer:${IMAGE_TAG} .

kind load docker-image ghcr.io/miracum/fhir-pseudonymizer:${IMAGE_TAG}

helm install \
--wait \
--timeout=10m \
vfps oci://ghcr.io/miracum/charts/vfps

helm upgrade --install \
--set="image.tag=${IMAGE_TAG}" \
-f tests/iter8/values.yaml \
Expand Down
24 changes: 24 additions & 0 deletions compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,30 @@ services:
# Http2-only for plaintext gRPC
- "127.0.0.1:8081:8081"

gpas-entici-mock:
image: docker.io/mockserver/mockserver:5.15.0@sha256:0f9ef78c94894ac3e70135d156193b25e23872575d58e2228344964273b4af6b
ipc: none
security_opt:
- "no-new-privileges:true"
cap_drop:
- ALL
privileged: false
deploy:
resources:
limits:
memory: 512m
cpus: "1"
reservations:
memory: 512m
cpus: "1"
environment:
MOCKSERVER_INITIALIZATION_JSON_PATH: /config/initializer.json
MOCKSERVER_WATCH_INITIALIZATION_JSON: "true"
ports:
- 127.0.0.1:1080:1080
volumes:
- ./hack/mocks:/config:ro

keycloak:
image: quay.io/keycloak/keycloak:22.0.5@sha256:bfa8852e52c279f0857fe8da239c0ad6bbd2cc07793a28a6770f7e24c1e25444
restart: unless-stopped
Expand Down
12 changes: 12 additions & 0 deletions hack/mocks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Generating MockServer's initialization config

Because it's easier to read, the initializers are managed as YAML and converted to JSON
for MockServer.

Run:

```sh
yq -o json hack/mocks/initializer.yaml > hack/mocks/initializer.json
```

to convert.
24 changes: 24 additions & 0 deletions hack/mocks/initializer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"id": "gpas-pseudonymize",
"httpRequest": {
"method": "POST",
"path": "/ttp-fhir/fhir/gpas/$pseudonymizeAllowCreate"
},
"httpResponseTemplate": {
"templateType": "VELOCITY",
"template": "{\n \"body\": {\n \"resourceType\": \"Parameters\",\n \"parameter\": [\n {\n \"name\": \"pseudonym\",\n \"part\": [\n {\n \"name\": \"original\",\n \"valueIdentifier\": {\n \"system\": \"https://ths-greifswald.de/gpas\",\n \"value\": \"test\"\n }\n },\n {\n \"name\": \"target\",\n \"valueIdentifier\": {\n \"system\": \"https://ths-greifswald.de/gpas\",\n \"value\": \"benchmark\"\n }\n },\n {\n \"name\": \"pseudonym\",\n \"valueIdentifier\": {\n \"system\": \"https://ths-greifswald.de/gpas\",\n #set($jsonBody = $json.parse($!request.body))\n #set($originalValue = \"\")\n #foreach($parameter in $jsonBody.parameter)\n #if($parameter.name == 'original')\n #set($originalValue = $parameter.valueString)\n #end\n #end\n \"value\": \"pseuded-$originalValue\"\n }\n }\n ]\n }\n ]\n }\n}\n"
}
},
{
"id": "entici-pseudonymize",
"httpRequest": {
"method": "POST",
"path": "/entici/$pseudonymize"
},
"httpResponseTemplate": {
"templateType": "VELOCITY",
"template": "{\n \"body\": {\n \"resourceType\": \"Parameters\",\n \"parameter\": [\n {\n \"name\": \"pseudonym\",\n \"valueIdentifier\": {\n \"use\": \"secondary\",\n \"system\": \"urn:fdc:difuture.de:trustcenter.plain\",\n #set($jsonBody = $json.parse($!request.body))\n #set($originalValue = \"\")\n #foreach($parameter in $jsonBody.parameter)\n #if($parameter.name == 'identifier')\n #set($originalValue = $parameter.valueIdentifier.value)\n #end\n #end\n \"value\": \"pseuded-$originalValue\"\n }\n }\n ]\n }\n}\n"
}
}
]
76 changes: 76 additions & 0 deletions hack/mocks/initializer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
- id: gpas-pseudonymize
httpRequest:
method: POST
path: /ttp-fhir/fhir/gpas/$pseudonymizeAllowCreate
httpResponseTemplate:
templateType: VELOCITY
template: |
{
"body": {
"resourceType": "Parameters",
"parameter": [
{
"name": "pseudonym",
"part": [
{
"name": "original",
"valueIdentifier": {
"system": "https://ths-greifswald.de/gpas",
"value": "test"
}
},
{
"name": "target",
"valueIdentifier": {
"system": "https://ths-greifswald.de/gpas",
"value": "benchmark"
}
},
{
"name": "pseudonym",
"valueIdentifier": {
"system": "https://ths-greifswald.de/gpas",
#set($jsonBody = $json.parse($!request.body))
#set($originalValue = "")
#foreach($parameter in $jsonBody.parameter)
#if($parameter.name == 'original')
#set($originalValue = $parameter.valueString)
#end
#end
"value": "pseuded-$originalValue"
}
}
]
}
]
}
}
- id: entici-pseudonymize
httpRequest:
method: POST
path: /entici/$pseudonymize
httpResponseTemplate:
templateType: VELOCITY
template: |
{
"body": {
"resourceType": "Parameters",
"parameter": [
{
"name": "pseudonym",
"valueIdentifier": {
"use": "secondary",
"system": "urn:fdc:difuture.de:trustcenter.plain",
#set($jsonBody = $json.parse($!request.body))
#set($originalValue = "")
#foreach($parameter in $jsonBody.parameter)
#if($parameter.name == 'identifier')
#set($originalValue = $parameter.valueIdentifier.value)
#end
#end
"value": "pseuded-$originalValue"
}
}
]
}
}
Loading