Skip to content

Commit 00cad81

Browse files
committed
CCM-12613: update integration test with check for event bus log entry
1 parent a067f72 commit 00cad81

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

tests/playwright/constants/backend-constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const SQS_URL_PREFIX = `https://sqs.${REGION}.amazonaws.com/${AWS_ACCOUNT
2222
// Event Bus
2323
export const EVENT_BUS_ARN = `arn:aws:events:${REGION}:${AWS_ACCOUNT_ID}:event-bus/${CSI}`;
2424
export const EVENT_BUS_DLQ_URL = `${SQS_URL_PREFIX}${CSI}-event-publisher-errors-queue`;
25+
export const EVENT_BUS_LOG_GROUP_NAME = `/aws/vendedlogs/events/event-bus/${CSI}`;
2526

2627
// DynamoDB
2728
export const TTL_TABLE_NAME = `${CSI}-ttl`;

tests/playwright/digital-letters-component-tests/pdm-uploader.component.spec.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { expect, test } from '@playwright/test';
22
import {
3+
EVENT_BUS_LOG_GROUP_NAME,
34
LETTERS_S3_BUCKET_NAME,
45
PDM_UPLOADER_LAMBDA_LOG_GROUP_NAME,
56
} from 'constants/backend-constants';
@@ -82,7 +83,20 @@ test.describe('Digital Letters - Upload to PDM', () => {
8283
],
8384
);
8485

85-
expect(filteredLogs.length).toBeGreaterThan(0);
86+
expect(filteredLogs.length).toEqual(1);
8687
}, 120);
88+
89+
await expectToPassEventually(async () => {
90+
const eventLogEntry = await getLogsFromCloudwatch(
91+
EVENT_BUS_LOG_GROUP_NAME,
92+
[
93+
'$.message_type = "EVENT_RECEIPT"',
94+
'$.details.detail_type = "uk.nhs.notify.digital.letters.pdm.resource.submitted.v1"',
95+
`$.details.event_detail = "*\\"messageReference\\":\\"${messageReference}\\"*"`,
96+
],
97+
);
98+
99+
expect(eventLogEntry.length).toEqual(1);
100+
});
87101
});
88102
});

0 commit comments

Comments
 (0)