generated from NHSDigital/nhs-notify-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
CCM-14201 - Client Subscription Management #32
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
Open
rhyscoxnhs
wants to merge
7
commits into
main
Choose a base branch
from
feature/CCM-14201
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8852492
CCM-14201 - Client Subscription Management
rhyscoxnhs fc5991e
CCM-14637 - Set up integration tests (#43)
rhyscoxnhs b936966
CCM-14201 - PR feedback
rhyscoxnhs 6139500
CCM-14201 - PR feedback
rhyscoxnhs 0d48543
Merge branch 'main' into feature/CCM-14201
rhyscoxnhs 610c8c2
CCM-14201 - Fixed linting
rhyscoxnhs 589b2b4
CCM-14201 - Fixed test
rhyscoxnhs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Acceptance tests | ||
| description: "Run acceptance tests for this repo" | ||
|
|
||
| inputs: | ||
| testType: | ||
| description: Type of test to run | ||
| required: true | ||
|
|
||
| targetEnvironment: | ||
| description: Name of the environment under test | ||
| required: true | ||
|
|
||
| targetAccountGroup: | ||
| description: Name of the account group under test | ||
| default: nhs-notify-client-callbacks-dev | ||
| required: true | ||
|
|
||
| targetComponent: | ||
| description: Name of the component under test | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
|
|
||
| steps: | ||
| - name: Fetch terraform output | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: terraform-output-${{ inputs.targetComponent }} | ||
|
|
||
| - name: Get Node version | ||
| id: nodejs_version | ||
| shell: bash | ||
| run: | | ||
| echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: "Repo setup" | ||
| uses: ./.github/actions/node-install | ||
| with: | ||
| GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
|
|
||
| - name: "Set PR NUMBER environment variable" | ||
| shell: bash | ||
| run: | | ||
| echo "PR_NUMBER=${{ inputs.targetEnvironment }}" >> $GITHUB_ENV | ||
|
|
||
| - name: Run test - ${{ inputs.testType }} | ||
| shell: bash | ||
| env: | ||
| PROJECT: nhs | ||
| COMPONENT: ${{ inputs.targetComponent }} | ||
| run: | | ||
| make test-${{ inputs.testType }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: 'npm install and setup' | ||
| description: 'Setup node, authenticate github package repository and perform clean npm install' | ||
|
|
||
| inputs: | ||
| GITHUB_TOKEN: | ||
| description: "Token for access to github package registry" | ||
| required: true | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: 'Use Node.js' | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: '.tool-versions' | ||
| registry-url: 'https://npm.pkg.github.com' | ||
| scope: '@nhsdigital' | ||
|
|
||
| - name: 'Install dependencies' | ||
| shell: bash | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ inputs.GITHUB_TOKEN }} | ||
| run: | | ||
| npm ci |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [ | ||
| "integration" | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| ## | ||
| # Deployment details | ||
| ## | ||
|
|
||
| output "deployment" { | ||
| description = "Deployment details used for post-deployment scripts" | ||
| value = { | ||
| aws_region = var.region | ||
| aws_account_id = var.aws_account_id | ||
| project = var.project | ||
| environment = var.environment | ||
| group = var.group | ||
| component = var.component | ||
| } | ||
| } | ||
|
|
||
| ## | ||
| # Mock Webhook Lambda Outputs (test/dev environments only) | ||
| ## | ||
|
|
||
| output "mock_webhook_lambda_log_group_name" { | ||
| description = "CloudWatch log group name for mock webhook lambda (for integration test queries)" | ||
| value = var.deploy_mock_webhook ? module.mock_webhook_lambda[0].cloudwatch_log_group_name : null | ||
| } | ||
|
|
||
| output "mock_webhook_url" { | ||
| description = "URL endpoint for mock webhook (for TEST_WEBHOOK_URL environment variable)" | ||
| value = var.deploy_mock_webhook ? aws_lambda_function_url.mock_webhook[0].function_url : null | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ export const baseJestConfig: Config = { | |
| clearMocks: true, | ||
| collectCoverage: true, | ||
| coverageDirectory: "./.reports/unit/coverage", | ||
| coverageProvider: "v8", | ||
| coverageProvider: "babel", | ||
|
Contributor
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. It would be nice to understand a bit more why we need to go back to babel as I think v8 is the preferred provider for newer stuff. |
||
| coveragePathIgnorePatterns: ["/__tests__/", "/node_modules/"], | ||
| transform: { "^.+\\.ts$": "ts-jest" }, | ||
| testPathIgnorePatterns: [".build"], | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
lambdas/client-transform-filter-lambda/src/__tests__/index.cache-ttl-invalid.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { resolveCacheTtlMs } from "services/config-loader-service"; | ||
|
|
||
| describe("cache ttl configuration", () => { | ||
| it("falls back to default TTL when invalid", () => { | ||
| const ttlMs = resolveCacheTtlMs({ | ||
| CLIENT_SUBSCRIPTION_CACHE_TTL_SECONDS: "not-a-number", | ||
| } as NodeJS.ProcessEnv); | ||
|
|
||
| expect(ttlMs).toBe(60_000); | ||
| }); | ||
| }); |
11 changes: 11 additions & 0 deletions
11
lambdas/client-transform-filter-lambda/src/__tests__/index.cache-ttl-valid.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { resolveCacheTtlMs } from "services/config-loader-service"; | ||
|
|
||
| describe("cache ttl configuration", () => { | ||
| it("uses the configured TTL when valid", () => { | ||
| const ttlMs = resolveCacheTtlMs({ | ||
| CLIENT_SUBSCRIPTION_CACHE_TTL_SECONDS: "120", | ||
| } as NodeJS.ProcessEnv); | ||
|
|
||
| expect(ttlMs).toBe(120_000); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.