-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add jmeter load test and account-opening instance lookup #15
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -271,4 +271,8 @@ auth.json | |
| secrets.json | ||
|
|
||
| # AI folders | ||
| ai-docs/ | ||
| ai-docs/ | ||
|
|
||
| # JMeter | ||
| jmeter/results/ | ||
| !jmeter/results/.gitkeep | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,7 @@ | |
| ] | ||
| } | ||
| }, | ||
| "additionalProperties": false | ||
| "additionalProperties": true | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| { | ||
| "key": "initiate-account-opening", | ||
| "version": "1.0.0", | ||
| "domain": "core", | ||
| "flow": "sys-schemas", | ||
| "flowVersion": "1.0.0", | ||
| "tags": [ | ||
| "banking", | ||
| "account-opening", | ||
| "start-transition", | ||
| "input-schema" | ||
| ], | ||
| "attributes": { | ||
| "type": "workflow", | ||
| "schema": { | ||
| "$id": "https://schemas.vnext.com/banking/initiate-account-opening.json", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "title": "Initiate Account Opening Schema", | ||
| "description": "Schema for the start transition payload of the account-opening workflow", | ||
| "type": "object", | ||
| "required": [ | ||
| "session" | ||
| ], | ||
| "properties": { | ||
| "session": { | ||
| "type": "string", | ||
| "title": "Session", | ||
| "description": "Unique session identifier for the account opening request", | ||
| "minLength": 1 | ||
| }, | ||
| "customer": { | ||
| "type": "object", | ||
| "title": "Customer", | ||
| "description": "Customer information for the account opening request", | ||
| "properties": { | ||
| "ownerUserId": { | ||
| "type": "string", | ||
| "title": "Owner User ID", | ||
| "description": "Identifier of the user who owns the account opening request", | ||
| "minLength": 1 | ||
| } | ||
| }, | ||
| "additionalProperties": false | ||
| } | ||
| }, | ||
| "additionalProperties": false | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "key": "get-instance", | ||
| "version": "1.0.0", | ||
| "domain": "core", | ||
| "flow": "sys-tasks", | ||
| "flowVersion": "1.0.0", | ||
| "tags": [ | ||
| "account-opening", | ||
| "get-instance" | ||
| ], | ||
| "attributes": { | ||
| "type": "13", | ||
| "config": { | ||
| "domain": "core", | ||
| "flow": "account-opening" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "key": "get-instances", | ||
| "version": "1.0.0", | ||
| "domain": "core", | ||
| "flow": "sys-tasks", | ||
| "flowVersion": "1.0.0", | ||
| "tags": [ | ||
| "account-opening", | ||
| "get-instances", | ||
| "filter" | ||
| ], | ||
| "attributes": { | ||
| "type": "15", | ||
| "config": { | ||
| "domain": "core", | ||
| "flow": "account-opening" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| using System.Threading.Tasks; | ||
| using BBT.Workflow.Scripting; | ||
| using BBT.Workflow.Definitions; | ||
|
|
||
| /// <summary> | ||
| /// Retrieves a single workflow instance by the "oldKey" value sent in the transition body. | ||
| /// </summary> | ||
| public class GetInstanceByOldKeyMapping : IMapping | ||
| { | ||
| public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context) | ||
| { | ||
| var instanceTask = (task as GetInstanceDataTask)!; | ||
|
|
||
| string? oldKey = context.Body?.oldKey?.ToString(); | ||
|
|
||
| instanceTask.SetInstance(oldKey); | ||
|
|
||
| return Task.FromResult(new ScriptResponse()); | ||
| } | ||
|
|
||
| public Task<ScriptResponse> OutputHandler(ScriptContext context) | ||
| { | ||
| return Task.FromResult(new ScriptResponse | ||
| { | ||
| Key = "get-instance-by-old-key-result", | ||
| Data = new | ||
| { | ||
| instance = context.Body, | ||
| fetchedAt = System.DateTime.UtcNow | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| using System.Threading.Tasks; | ||
| using BBT.Workflow.Scripting; | ||
| using BBT.Workflow.Definitions; | ||
|
|
||
| /// <summary> | ||
| /// Filters workflow instances by the "oldKey" value sent in the transition body. | ||
| /// </summary> | ||
| public class GetInstancesByOldKeyMapping : IMapping | ||
| { | ||
| public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context) | ||
| { | ||
| var instancesTask = (task as GetInstancesTask)!; | ||
|
|
||
| string? oldKey = context.Body?.oldKey?.ToString(); | ||
|
|
||
| instancesTask.SetFilter(new | ||
| { | ||
| key = new { eq = oldKey } | ||
| }); | ||
|
|
||
| return Task.FromResult(new ScriptResponse()); | ||
| } | ||
|
|
||
| public Task<ScriptResponse> OutputHandler(ScriptContext context) | ||
| { | ||
| return Task.FromResult(new ScriptResponse | ||
| { | ||
| Key = "get-instances-by-old-key-result", | ||
| Data = new | ||
| { | ||
| instances = context.Body, | ||
| fetchedAt = System.DateTime.UtcNow | ||
| } | ||
| }); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||||||||||||||||
| networks: | ||||||||||||||||||||
| bbt-development: | ||||||||||||||||||||
| external: true | ||||||||||||||||||||
|
|
||||||||||||||||||||
| services: | ||||||||||||||||||||
| jmeter: | ||||||||||||||||||||
| image: alpine/jmeter:latest | ||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||
| container_name: jmeter | ||||||||||||||||||||
| networks: | ||||||||||||||||||||
|
Comment on lines
+6
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (bug_risk): Using Please pin this to a specific JMeter version (for example
Suggested change
|
||||||||||||||||||||
| - bbt-development | ||||||||||||||||||||
| environment: | ||||||||||||||||||||
| - VNEXT_BASE_URL=${VNEXT_BASE_URL:-http://host.docker.internal:4201} | ||||||||||||||||||||
| - JMETER_USERS=${JMETER_USERS:-10} | ||||||||||||||||||||
| - JMETER_RAMPUP=${JMETER_RAMPUP:-10} | ||||||||||||||||||||
| - JMETER_LOOPS=${JMETER_LOOPS:-5} | ||||||||||||||||||||
| volumes: | ||||||||||||||||||||
| - ./jmeter/tests:/tests | ||||||||||||||||||||
| - ./jmeter/results:/results | ||||||||||||||||||||
| working_dir: /tests | ||||||||||||||||||||
| extra_hosts: | ||||||||||||||||||||
| - "host.docker.internal:host-gateway" | ||||||||||||||||||||
| entrypoint: ["jmeter"] | ||||||||||||||||||||
| command: > | ||||||||||||||||||||
| -n -t /tests/workflow-test.jmx | ||||||||||||||||||||
| -Jbase.url=${VNEXT_BASE_URL:-http://host.docker.internal:4201} | ||||||||||||||||||||
| -Jusers=${JMETER_USERS:-10} | ||||||||||||||||||||
| -Jrampup=${JMETER_RAMPUP:-10} | ||||||||||||||||||||
| -Jloops=${JMETER_LOOPS:-5} | ||||||||||||||||||||
| -l /results/result.jtl | ||||||||||||||||||||
| -e -o /results/html-report | ||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mapping lacks proper validation for the input task and the
oldKeyvalue. If the task cast fails oroldKeyis missing from the body, the script will either throw aNullReferenceExceptionor perform an invalid lookup. It is recommended to add defensive checks.