Skip to content
Open
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
9 changes: 8 additions & 1 deletion .github/actions/acceptance-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,16 @@ runs:
TEST_TYPE: ${{ inputs.testType }}
ENVIRONMENT: ${{ inputs.targetEnvironment }}
PLAYWRIGHT_SHARD: ${{ inputs.shard }}
- name: Sanitise shard for artifact name
id: shard_label
if: ${{ inputs.testType == 'integration' && inputs.shard != '' }}
shell: bash
run: echo "value=${SHARD//\// of }" >> $GITHUB_OUTPUT
env:
SHARD: ${{ inputs.shard }}
- name: Archive integration test results
if: ${{ inputs.testType == 'integration' }}
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: Integration test report
name: Integration test report${{ inputs.shard != '' && format(' ({0})', steps.shard_label.outputs.value) || '' }}
path: "tests/playwright/playwright-report"
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ describe('createHandler', () => {
description: 'Failed processing message',
messageId: sqsEvent.Records[0].messageId,
senderId: validSender.senderId,
messageReference,
}),
);
});
Expand Down Expand Up @@ -227,6 +228,7 @@ describe('createHandler', () => {
description: 'Failed processing message',
messageId,
senderId: undefined,
messageReference: undefined,
});
expect(mockLogger.info).toHaveBeenCalledWith({
description: '0 of 1 records processed successfully',
Expand Down Expand Up @@ -257,6 +259,7 @@ describe('createHandler', () => {
description: 'Failed processing message',
messageId,
senderId: validSender.senderId,
messageReference,
});
expect(
mockEventPublisher.sendEvents<MessageRequestRejected>,
Expand Down Expand Up @@ -301,6 +304,7 @@ describe('createHandler', () => {
description: 'Failed processing message',
messageId,
senderId: validSender.senderId,
messageReference,
});
expect(mockEventPublisher.sendEvents).toHaveBeenCalledTimes(1);
expect(mockEventPublisher.sendEvents).toHaveBeenCalledWith(
Expand Down
1 change: 1 addition & 0 deletions lambdas/core-notifier-lambda/src/apis/sqs-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ async function processSqsRecord(
description: 'Failed processing message',
messageId: sqsRecord.messageId,
senderId: incoming?.data.senderId,
messageReference: incoming?.data.messageReference,
});

if (error instanceof RequestNotifyError && incoming && sender) {
Expand Down
3 changes: 2 additions & 1 deletion tests/playwright/config/component/senders.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { test as setup } from '@playwright/test';
import senderRepository from 'helpers/sender-helpers';
import { Sender } from 'utils';
import {
ROUTING_CONFIG_ID,
SENDER_ID_SKIPS_NOTIFY,
SENDER_ID_THAT_TRIGGERS_ERROR_IN_NOTIFY_SANDBOX,
SENDER_ID_VALID_FOR_NOTIFY_SANDBOX,
Expand All @@ -20,7 +21,7 @@ const testSenders: Sender[] = [
senderName: 'componentTestSender_RoutingConfig',
meshMailboxSenderId: 'meshMailboxSender1',
meshMailboxReportsId: 'meshMailboxReports1',
routingConfigId: 'b838b13c-f98c-4def-93f0-515d4e4f4ee1',
routingConfigId: ROUTING_CONFIG_ID,
fallbackWaitTimeSeconds: 100,
},
{
Expand Down
10 changes: 8 additions & 2 deletions tests/playwright/constants/tests-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,21 @@ export const ENVIRONMENT_SPECIFIC_CONSTANTS = {
// Suppliers Dev Account
'820178564574': {
nhsAppBaseUrl: 'https://example.com',
routingConfigId: 'b838b13c-f98c-4def-93f0-515d4e4f4ee1',
},

// Suppliers Non Prod Account
'885964308133': {
nhsAppBaseUrl: 'https://www-onboardingaos.nhsapp.service.nhs.uk',
routingConfigId: 'c940a9ce-e70d-4986-8046-afd168b39738',
},
};

export const NHS_APP_BASE_URL =
const ENVIRONMENT_CONFIG =
ENVIRONMENT_SPECIFIC_CONSTANTS[
AWS_ACCOUNT_ID_SAFE as keyof typeof ENVIRONMENT_SPECIFIC_CONSTANTS
].nhsAppBaseUrl;
];

export const NHS_APP_BASE_URL = ENVIRONMENT_CONFIG.nhsAppBaseUrl;

export const ROUTING_CONFIG_ID = ENVIRONMENT_CONFIG.routingConfigId;
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ test.describe('Digital Letters - Core Notify', () => {
});

test('given PDMResourceAvailable event, when client does NOT exist then it goes to DLQ', async () => {
test.setTimeout(250_000);
test.setTimeout(360_000);
const eventId = uuidv4();
const messageReference = uuidv4();

Expand All @@ -213,18 +213,21 @@ test.describe('Digital Letters - Core Notify', () => {
validatePDMResourceAvailable,
);

await Promise.all([
// Verify the event is processed and a message appears in the Lambda logs
expectToPassEventually(async () => {
const filteredLogs = await getLogsFromCloudwatch(
CORE_NOTIFIER_LAMBDA_LOG_GROUP_NAME,
['$.message.description = "0 of 1 records processed successfully"'],
);

expect(filteredLogs.length).toBeGreaterThanOrEqual(1);
}, 240),
// Verify there is a message in the DLQ
expectMessageContainingString(CORE_NOTIFIER_DLQ_NAME, eventId, 240),
]);
// Verify the event is processed and a message appears in the Lambda logs
await expectToPassEventually(async () => {
const filteredLogs = await getLogsFromCloudwatch(
CORE_NOTIFIER_LAMBDA_LOG_GROUP_NAME,
[
'$.message.description = "Failed processing message"',
'$.message.error = "Sender not found for senderId: senderId_that_does_not_exist"',
Comment thread
gareth-allan marked this conversation as resolved.
`$.message.messageReference = "${messageReference}"`,
],
);

expect(filteredLogs.length).toBeGreaterThanOrEqual(1);
}, 240);

// Verify there is a message in the DLQ
await expectMessageContainingString(CORE_NOTIFIER_DLQ_NAME, eventId, 300);
});
});
Loading