Skip to content

VED-1260 Mock PDS lambda rate limiting in ref env#1427

Open
amarauzoma wants to merge 48 commits intomasterfrom
VED-1235-Lambda-to-mock-PDS-in-Ref
Open

VED-1260 Mock PDS lambda rate limiting in ref env#1427
amarauzoma wants to merge 48 commits intomasterfrom
VED-1235-Lambda-to-mock-PDS-in-Ref

Conversation

@amarauzoma
Copy link
Copy Markdown
Contributor

@amarauzoma amarauzoma commented Apr 17, 2026

  • Replaced deployed ref mock PDS dependency with local test-only mock tooling.
  • Added local PDS stub + dedicated Locust profile for average/boundary/spike rate-limit validation.
  • Added simple make commands with preset rates (125 average, 130 boundary, spike profile).
  • Updated docs and removed obsolete mock deployment wiring from infra/workflows.
  • Outcome: same rate-limit validation intent, cleaner and faster test execution, no unnecessary ref endpoint dependency.

amarauzoma and others added 2 commits April 17, 2026 12:51
- Added a new Lambda function to simulate PDS responses for patient lookups.
- Implemented rate limiting with configurable average and spike thresholds.
- Updated existing MNS publisher to utilize the new PDS base URL environment variable.
- Enhanced tests to cover scenarios with the mock PDS service, including rate limit handling.
- Created performance testing scripts to validate MNS behavior under load with the mock PDS.
- Updated infrastructure to route PDS calls in the ref environment to the mock endpoint.
- Streamlined the initialization of MockPdsService by consolidating parameters.
- Replaced multiple response methods with a unified error handling approach.
- Enhanced readability by reducing redundant code in the patient lookup logic.
- Updated tests to utilize helper functions for event creation and decision mocking.
@amarauzoma amarauzoma changed the title feat: Introduce Mock PDS Lambda for MNS integration testing VED-1235 Lambda-to-mock-PDS-in-Ref Apr 17, 2026
- Deleted the performance testing plan document for MNS integration with mocked PDS.
- This document outlined objectives, delivery approaches, and existing architecture for implementing a mocked PDS service.
…mock-PDS-in-Ref

Made-with: Cursor

# Conflicts:
#	tests/perf_tests/Makefile
- Removed the global service retrieval function and directly initialized the MockPdsService with a Redis client and rate limiter.
- Updated the lambda_handler to use the initialized service directly, improving performance and readability.
- Adjusted unit tests to accommodate the new service initialization approach, ensuring proper mocking and error handling.
… tests

- Updated sonar-project.properties to include coverage report for mock_pds.
- Added new unit tests for Mock PDS service to improve test coverage and handle edge cases.
- Introduced a new test file for rate limiting functionality in the Mock PDS service.
- Updated the quality-checks workflow to run tests for the new mock_pds service.
- Introduced a new Mock PDS Lambda function to simulate PDS responses.
- Created an ECR repository for the Mock PDS service with appropriate policies.
- Updated deployment workflows to include mock_pds in build flags and image overrides.
- Enhanced infrastructure configuration to support the new Mock PDS service, including image URI handling and environment variable setup.
Comment thread lambdas/mock_pds/Dockerfile Fixed
…ient lookup functionality

- Add pyproject.toml for dependency management using Poetry
- Create lambda_handler.py to handle incoming requests and integrate with MockPdsService
- Implement MockPdsService to manage patient lookup and rate limiting logic
- Introduce FixedWindowRateLimiter for controlling request rates using Redis
- Add unit tests for MockPdsService and rate limiter functionality
- Update performance test setup to target deployed mock PDS Lambda instead of local server
- Remove local mock server implementation and related references from performance tests
Comment thread tests/perf_tests/mock_pds/Dockerfile Fixed
Comment thread tests/perf_tests/mock_pds/Dockerfile Fixed
Comment thread tests/perf_tests/mock_pds/Dockerfile Fixed
amarauzoma added 12 commits May 8, 2026 10:40
- Introduced a new mock PDS service with a rate limiter for handling patient lookup requests.
- Implemented a Lambda function as the entry point for the service.
- Added a rate limiter using Redis to manage request limits.
- Created unit tests for the mock PDS service and rate limiter to ensure functionality.
- Updated Locust load testing configuration to include the new mock PDS service.
- Added a `pyproject.toml` file for dependency management using Poetry.
- Removed `expected_commit_id` and `require_matching_commit_id` inputs from the workflow.
- Updated environment variables to use `github.sha` directly for `SOURCE_COMMIT_ID`.
- Simplified commit hash validation logic in the API availability check.

Update infrastructure variables for development environment

- Changed `mns_environment` from "int" to "dev" in `variables.tfvars`.

Clean up unused variables in infrastructure

- Removed unused `PDS_BASE_URL` variable from `id_sync_lambda.tf` and `mns_publisher.tf`.
- Removed `pds_base_url` variable from `variables.tf` in the `mns_publisher` module.

Refactor PDS service client logic

- Updated `get_pds_service` to use a single environment variable for PDS environment.
- Simplified the initialization of `PdsService` to remove base URL handling.
- Adjusted error handling in `pds_get_patient_details` to return patient details directly.

Update tests to reflect changes in PDS service

- Removed tests related to base URL overrides and unnecessary configurations in `test_pds_details.py` and `test_pds_service.py`.

Update package dependencies

- Upgraded `@redocly/cli`, `@redocly/openapi-core`, and `@redocly/respect-core` to version 2.30.4.
- Updated `styled-components` to version 6.4.1.

Refactor performance tests

- Removed baseline, spike, and ramp profiles from `Makefile` and `README.md`.
- Simplified Locust load testing setup in `locustfile.py` and removed unused profile files.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request infrastructure Pull requests that update terraform code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants