Skip to content

regression tests#2696

Open
SantanM wants to merge 31 commits into
developfrom
SantanM/internal-2657_regression-tests
Open

regression tests#2696
SantanM wants to merge 31 commits into
developfrom
SantanM/internal-2657_regression-tests

Conversation

@SantanM

@SantanM SantanM commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Adds performance regression testing framework for D2E HTTP API endpoints.

This PR introduces a new performance regression test suite that measures response times against a locked baseline. It includes:

New regression test workflow (.github/workflows/_test-regression.yml) — sets up Docker services and runs performance tests
Performance test runner — TypeScript-based framework that parses HAR/curl files and compares response times against baseline
Initial baseline — pre-recorded p95 times for cohort definition and patient count endpoints
Two test scenarios — home page to cohort definition list flow (18 requests) and patient count/population bar chart endpoints
CI integration — integrated into the main docker-build-push workflow with a gate job (test_regression_gate)
Tests fail if any scenario exceeds 20% above baseline (configurable). Results are reported as tables with per-scenario deltas, and detailed reports are saved on failure.

image

Merge Checklist

Please cross check this list if additions / modifications needs to be done on top of your core changes and tick them off. Reviewer can as well glance through and help the developer if something is missed out.

  • Automated Tests (Jasmine integration tests, Unit tests, and/or Performance tests)
  • Updated Manual tests / Demo Config
  • Documentation (Application guide, Admin guide, Markdown, Readme and/or Wiki)
  • Verified that local development environment is working with latest changes (integrated with latest develop branch)
  • following best practices in code review doc

Copilot AI review requested due to automatic review settings June 12, 2026 08:05
@SantanM SantanM changed the title Santan m/internal 2657 regression tests regression tests Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment thread tests/regression/runner/httpClient.ts

permissions:
contents: read
packages: write

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need write permission?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, write permissions allow pulling of docker images from the ghcr.io. This is the same setting we've in other GH action running HTTP tests.

Comment thread tests/regression/runner/compare.ts Outdated
Comment thread tests/regression/runner/httpClient.ts
Comment thread tests/regression/config.ts
Comment thread tests/regression/runner/compare.ts
Comment thread tests/regression/runner/compare.ts Outdated
SantanM added 4 commits June 18, 2026 11:47
Timing samples from error responses (401/404/500) complete fast with no
real DB work, so they passed the threshold gate as false greens. Now
status codes are collected per run and asserted to be all 2xx before
comparing to baseline. A missing BEARER_TOKEN exits the run immediately
with a clear error message.
A missing baseline previously passed silently — now the test fails with
a message directing the user to run the baseline writer first. The
baseline writer now skips writing an entry when any timed response was
non-2xx, preventing polluted baselines from bad-auth runs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.

Comment on lines +1 to +6
{
"home_page_to_cohort_def_list_0": {
"minMs": 29.9
},
"home_page_to_cohort_def_list_1": {
"minMs": 7.3
Comment on lines +18 to +37
export function compareToBaseline(result: TimingResult, baseline: Baseline): CompareResult {
const entry = baseline[result.scenarioName];

if (!entry) {
return {
scenarioName: result.scenarioName,
status: "no-baseline",
currentP95Ms: result.p95Ms,
baselineP95Ms: null,
deltaFraction: null,
minMs: result.minMs,
maxMs: result.maxMs,
};
}

const delta = (result.p95Ms - entry.p95Ms) / entry.p95Ms;
let status: CompareStatus = "pass";
if (delta > config.failThreshold) status = "fail";
else if (delta > config.warnThreshold) status = "warn";

Comment on lines +38 to +46
return {
scenarioName: result.scenarioName,
status,
currentP95Ms: result.p95Ms,
baselineP95Ms: entry.p95Ms,
deltaFraction: delta,
minMs: result.minMs,
maxMs: result.maxMs,
};
Comment on lines +12 to +17
// Replaces the host+port of every scenario URL.
// Set D2E_BASE_URL=localhost:41100 to point at a local instance.
D2E_BASE_URL: process.env.D2E_BASE_URL ?? "localhost:41100",

// Substituted into any query param or JSON body field named "datasetId".
DATASET_ID: process.env.DATASET_ID ?? "",
Comment on lines +253 to +267
response=$(curl -ik 'https://localhost:41100/d2e/oauth/token' \
--header 'accept: application/json, text/javascript, */*; q=0.01' \
--header 'content-type: application/x-www-form-urlencoded' \
--header "Cookie: _interaction=$interaction_cookie; _interaction.sig=$interaction_sig_cookie; _interaction_resume=$interaction_resume_cookie; _interaction_resume.sig=$interaction_resume_sig_cookie; _session=$session_cookie; _session.sig=$session_sig_cookie; _logto={\"appId\":\"$LOGTO__D2E_APP__CLIENT_ID\"}" \
--header 'origin: https://localhost:41100' \
--header 'referer: https://localhost:41100/d2e/portal/login-callback?code=2sxkx6uCahwOfKo1cwzLaAq5MfdBJrMcqCLNHvOTXFv&state=odSrnZhVyE&iss=https%3A%2F%2Flocalhost%3A41100%2Foidc' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode "client_id=$LOGTO__D2E_APP__CLIENT_ID" \
--data-urlencode 'redirect_uri=https://localhost:41100/d2e/portal/login-callback' \
--data-urlencode "code=$authorization_code" \
--data-urlencode 'code_verifier=kqVLhCyXRJ3Y9mXie6F9d1FW8AUbTUzIuJiqUf1SM9I')
printf "%s\n" "$response"

export BEARER_TOKEN=$(echo "$response" | grep -o '"access_token":"[^"]*"' | sed 's/"access_token":"\([^"]*\)"/\1/')
echo "BEARER_TOKEN=$BEARER_TOKEN" >> $GITHUB_ENV
run: |
echo "LOGTO__D2E_APP__CLIENT_ID: ${LOGTO__D2E_APP__CLIENT_ID}"
response=$(curl -ik "https://localhost:41100/oidc/auth?redirect_uri=https%3A%2F%2Flocalhost%3A41100%2Fd2e%2Fportal%2Flogin-callback&client_id=$LOGTO__D2E_APP__CLIENT_ID&response_type=code&state=lbFDB1hcko&scope=openid%20offline_access%20profile%20email&nonce=Osptnuwqc47w&code_challenge=n6eqz8p8jj1L9Qu7pY2_GrWO7XyaQbWrcs54x9OAnPg&code_challenge_method=S256")
printf "%s\n" "$response"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants