Skip to content
Draft
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
19 changes: 19 additions & 0 deletions .github/actions/acceptance-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ inputs:
description: Name of the component under test
default: dl

shard:
description: "Playwright shard in format index/total (e.g. 1/4). If empty, runs all tests."
required: false
default: ""

runs:
using: "composite"

Expand All @@ -38,7 +43,20 @@ runs:
shell: bash
run: |
npm ci
- name: Cache generated dependencies
id: cache-generated
uses: actions/cache@v4
with:
path: |
schemas/digital-letters/
output/digital-letters/
src/digital-letters-events/types/
src/digital-letters-events/validators/
src/digital-letters-events/guard-functions/
src/digital-letters-events/digital_letters_events/models/
key: generated-deps-${{ hashFiles('src/cloudevents/**') }}
- name: "Generate dependencies"
if: steps.cache-generated.outputs.cache-hit != 'true'
shell: bash
run: |
npm run generate-dependencies
Expand All @@ -58,6 +76,7 @@ runs:
env:
TEST_TYPE: ${{ inputs.testType }}
ENVIRONMENT: ${{ inputs.targetEnvironment }}
PLAYWRIGHT_SHARD: ${{ inputs.shard }}
- name: Archive integration test results
if: ${{ inputs.testType == 'integration' }}
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
Expand Down
9 changes: 8 additions & 1 deletion .github/scripts/dispatch_internal_repo_workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ while [[ $# -gt 0 ]]; do
overrideRoleName="$2"
shift 2
;;
--enableSharding) # Enable test sharding across 4 parallel jobs (optional)
enableSharding="$2"
shift 2
;;
*)
echo "[ERROR] Unknown argument: $1"
exit 1
Expand Down Expand Up @@ -167,6 +171,7 @@ echo " overrides: $overrides"
echo " overrideProjectName: $overrideProjectName"
echo " overrideRoleName: $overrideRoleName"
echo " targetProject: $targetProject"
echo " enableSharding: ${enableSharding:-}"

DISPATCH_EVENT=$(jq -ncM \
--arg infraRepoName "$infraRepoName" \
Expand All @@ -180,6 +185,7 @@ DISPATCH_EVENT=$(jq -ncM \
--arg overrideProjectName "$overrideProjectName" \
--arg overrideRoleName "$overrideRoleName" \
--arg targetProject "$targetProject" \
--argjson enableSharding "${enableSharding:-false}" \
'{
"ref": "'"$internalRef"'",
"inputs": (
Expand All @@ -188,12 +194,13 @@ DISPATCH_EVENT=$(jq -ncM \
(if $overrideProjectName != "" then { "overrideProjectName": $overrideProjectName } else {} end) +
(if $overrideRoleName != "" then { "overrideRoleName": $overrideRoleName } else {} end) +
(if $targetProject != "" then { "targetProject": $targetProject } else {} end) +
(if $enableSharding then { "enableSharding": $enableSharding } else {} end) +
{
"releaseVersion": $releaseVersion,
"targetEnvironment": $targetEnvironment,
"targetAccountGroup": $targetAccountGroup,
"targetComponent": $targetComponent,
"overrides": $overrides,
"overrides": $overrides
}
)
}')
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/cicd-1-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ jobs:
--terraformAction "apply" \
--overrideProjectName "nhs" \
--overrideRoleName "nhs-main-acct-digital-letters-github-deploy" \
--internalRef "feature/enable-component-test-sharding" \
--overrides "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
acceptance-stage: # Recommended maximum execution time is 10 minutes
name: "Acceptance stage"
Expand All @@ -189,6 +190,7 @@ jobs:
with:
target_environment: "pr${{ needs.metadata.outputs.pr_number }}"
target_account_group: nhs-notify-digital-letters-dev
internal_ref: "feature/enable-component-test-sharding"
secrets:
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/stage-4-acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
description: "Account for the environment being tested"
required: true
type: string
internal_ref:
description: "Branch or ref to use in nhs-notify-internal (defaults to main)"
required: false
type: string

jobs:
test-security:
Expand Down Expand Up @@ -84,7 +88,9 @@ jobs:
--targetWorkflow "dispatch-contextual-tests-dynamic-env.yaml" \
--targetEnvironment "$TARGET_ENVIRONMENT" \
--targetAccountGroup "$TARGET_ACCOUNT_GROUP" \
--targetComponent "dl"
--targetComponent "dl" \
--internalRef "${{ inputs.internal_ref || 'main' }}" \
--enableSharding "true"
test-accessibility:
name: "Accessibility test"
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions infrastructure/terraform/components/dl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ No requirements.
| <a name="input_event_anomaly_period"></a> [event\_anomaly\_period](#input\_event\_anomaly\_period) | The period in seconds over which the specified statistic is applied for anomaly detection. Minimum 300 seconds (5 minutes). Recommended: 300-600. | `number` | `300` | no |
| <a name="input_eventpub_control_plane_bus_arn"></a> [eventpub\_control\_plane\_bus\_arn](#input\_eventpub\_control\_plane\_bus\_arn) | Event publisher control plane | `string` | n/a | yes |
| <a name="input_eventpub_data_plane_bus_arn"></a> [eventpub\_data\_plane\_bus\_arn](#input\_eventpub\_data\_plane\_bus\_arn) | Event publisher data plane | `string` | n/a | yes |
| <a name="input_firehose_destination_buffer_interval"></a> [firehose\_destination\_buffer\_interval](#input\_firehose\_destination\_buffer\_interval) | The Firehose destination buffer interval in seconds. Lower values reduce latency for tests but increase costs. Minimum is 60, default (Terraform) is 300. | `number` | `300` | no |
| <a name="input_firehose_processor_buffer_interval"></a> [firehose\_processor\_buffer\_interval](#input\_firehose\_processor\_buffer\_interval) | The Firehose Lambda processor buffer interval in seconds. Should be greater than firehose\_destination\_buffer\_interval. Minimum is 61, default is 301. | `number` | `301` | no |
| <a name="input_force_destroy"></a> [force\_destroy](#input\_force\_destroy) | Flag to force deletion of S3 buckets | `bool` | `false` | no |
| <a name="input_force_lambda_code_deploy"></a> [force\_lambda\_code\_deploy](#input\_force\_lambda\_code\_deploy) | If the lambda package in s3 has the same commit id tag as the terraform build branch, the lambda will not update automatically. Set to True if making changes to Lambda code from on the same commit for example during development | `bool` | `false` | no |
| <a name="input_group"></a> [group](#input\_group) | The group variables are being inherited from (often synonmous with account short-name) | `string` | n/a | yes |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ resource "aws_kinesis_firehose_delivery_stream" "to_s3_reporting" {
error_output_prefix = "${local.firehose_output_path_prefix}/errors/!{timestamp:yyyy}-!{timestamp:MM}-!{timestamp:dd}-!{timestamp:HH}/!{firehose:error-output-type}/"

buffering_size = 128
buffering_interval = 300
buffering_interval = var.firehose_destination_buffer_interval

dynamic_partitioning_configuration {
enabled = true
Expand All @@ -37,7 +37,7 @@ resource "aws_kinesis_firehose_delivery_stream" "to_s3_reporting" {
}
parameters {
parameter_name = "BufferIntervalInSeconds"
parameter_value = 301
parameter_value = var.firehose_processor_buffer_interval
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions infrastructure/terraform/components/dl/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,15 @@ variable "event_anomaly_band_width" {
error_message = "Band width must be between 2 and 10"
}
}

variable "firehose_destination_buffer_interval" {
type = number
description = "The Firehose destination buffer interval in seconds. Lower values reduce latency for tests but increase costs. Minimum is 60, default (Terraform) is 300."
default = 300
}

variable "firehose_processor_buffer_interval" {
type = number
description = "The Firehose Lambda processor buffer interval in seconds. Should be greater than firehose_destination_buffer_interval. Minimum is 61, default is 301."
default = 301
}
2 changes: 1 addition & 1 deletion scripts/tests/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ npx playwright install --with-deps > /dev/null

cd tests/playwright

npm run test:component
npm run test:component -- --shard="$PLAYWRIGHT_SHARD"
11 changes: 1 addition & 10 deletions tests/playwright/config/component/component.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,10 @@ export default defineConfig({
name: 'senders:setup',
testMatch: 'senders.setup.ts',
},
{
name: 'firehose:setup',
testMatch: 'firehose.setup.ts',
teardown: 'firehose:teardown',
},
{
name: 'firehose:teardown',
testMatch: 'firehose.teardown.ts',
},
{
name: 'component',
testMatch: '*.component.spec.ts',
dependencies: ['senders:setup', 'firehose:setup'],
dependencies: ['senders:setup'],
teardown: 'component:teardown',
},
{
Expand Down
21 changes: 0 additions & 21 deletions tests/playwright/config/component/firehose.setup.ts

This file was deleted.

21 changes: 0 additions & 21 deletions tests/playwright/config/component/firehose.teardown.ts

This file was deleted.

Loading