Skip to content

Commit 8907183

Browse files
committed
Merge branch 'main' into feature/CCM-12185-addGetMiEndpoint
2 parents d883564 + 72c1a69 commit 8907183

11 files changed

Lines changed: 142 additions & 13 deletions

File tree

.github/actions/build-docs/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
using: "composite"
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
14+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1515
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1616
with:
1717
node-version: 22

.github/actions/build-libraries/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
using: "composite"
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
14+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1515
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1616
with:
1717
node-version: 22

.github/actions/build-oas-spec/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runs:
2424

2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2828
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
2929
with:
3030
node-version: ${{ inputs.nodejs_version }}

.github/actions/build-sandbox/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ runs:
1313

1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
16+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1717
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1818
with:
1919
node-version: 22

.github/actions/build-sdk/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
using: "composite"
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
14+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1515
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1616
with:
1717
node-version: 22

.github/actions/build-server/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
using: "composite"
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
14+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1515
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1616
with:
1717
node-version: 22

.github/workflows/manual-proxy-environment-deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
name: Deploy to Environment
3030
steps:
3131
- name: Checkout
32-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
32+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3333
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
3434
with:
3535
node-version: 22

.github/workflows/stage-1-commit.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ jobs:
169169
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170170
# steps:
171171
# - name: "Checkout code"
172-
# uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
172+
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
173173
# - name: "Setup ASDF"
174174
# uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47
175175
# - name: "Trivy IaC Scan"
@@ -184,7 +184,7 @@ jobs:
184184
# timeout-minutes: 10
185185
# steps:
186186
# - name: "Checkout code"
187-
# uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
187+
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
188188
# - name: "Setup ASDF"
189189
# uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47
190190
# - name: "Trivy Package Scan"
@@ -239,7 +239,7 @@ jobs:
239239

240240
steps:
241241
- name: "Checkout code"
242-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
242+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
243243
with:
244244
fetch-depth: 0
245245

@@ -274,7 +274,7 @@ jobs:
274274
contents: read
275275
steps:
276276
- name: Checkout code
277-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
277+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
278278
- name: Check schema versions
279279
run: |
280280
source scripts/is_valid_increment.sh

tests/component-tests/integration-tests/urgent-letter-priority.spec.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test } from "@playwright/test";
1+
import { expect, test } from "@playwright/test";
22
import getRestApiGatewayBaseUrl from "tests/helpers/aws-gateway-helper";
33
import { pollForLetterStatus } from "tests/helpers/poll-for-letters-helper";
44
import { getLettersFromQueueViaIndex } from "tests/helpers/generate-fetch-test-data";
@@ -9,6 +9,12 @@ import {
99
verifyAllocationLogsContainPriority,
1010
verifyIndexPositionOfLetterVariants,
1111
} from "tests/helpers/urgent-letter-priority-helper";
12+
import { createValidRequestHeaders } from "tests/constants/request-headers";
13+
import { SUPPLIER_LETTERS } from "tests/constants/api-constants";
14+
import {
15+
GetLettersResponse,
16+
GetLettersResponseSchema,
17+
} from "../../../lambdas/api-handler/src/contracts/letters";
1218

1319
let baseUrl: string;
1420

@@ -41,6 +47,21 @@ test.describe("Urgent Letter Priority Tests", () => {
4147
(letter) => letter.letterId,
4248
);
4349

50+
const header = createValidRequestHeaders(supplier);
51+
const response = await request.get(`${baseUrl}/${SUPPLIER_LETTERS}`, {
52+
headers: header,
53+
});
54+
55+
expect(response.status()).toBe(200);
56+
const responseBody = await response.json();
57+
expect(responseBody.data.length).toBeGreaterThanOrEqual(1);
58+
59+
const getLettersResponse: GetLettersResponse =
60+
GetLettersResponseSchema.parse(responseBody);
61+
62+
const letterIds = getLettersResponse.data.map((letter) => letter.id);
63+
expect(letterIds).toEqual(letterIdsFromQueue);
64+
4465
verifyIndexPositionOfLetterVariants(
4566
letterIdsFromQueue,
4667
urgencyTenLetterIds,

tests/component-tests/letterQueue-tests/queue-operations.spec.ts

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ import {
1313
import getRestApiGatewayBaseUrl from "tests/helpers/aws-gateway-helper";
1414
import { SUPPLIER_LETTERS } from "tests/constants/api-constants";
1515
import { supplierDataSetup } from "tests/helpers/suppliers-setup-helper";
16-
import { checkLetterQueueTable } from "tests/helpers/generate-fetch-test-data";
16+
import {
17+
checkLetterQueueTable,
18+
getLetterFromQueueById,
19+
} from "tests/helpers/generate-fetch-test-data";
20+
import { createValidRequestHeaders } from "../../constants/request-headers";
1721
import {
1822
patchRequestHeaders,
1923
patchValidRequestBody,
@@ -104,4 +108,65 @@ test.describe("Letter Queue Tests", () => {
104108

105109
await pollUpsertLetterLogForWarning("Letter already exists", letterId);
106110
});
111+
112+
test("Verify if VisibilityTimeStamp is updated when Get /letters endpoint is called and subsequent calls returns no data until VisibilityTimeStamp is reached", async ({
113+
request,
114+
}) => {
115+
const letterId = randomUUID();
116+
logger.info(`Sending event with domainId: ${letterId}`);
117+
const preparedEvent = createPreparedV1Event({ domainId: letterId });
118+
const response = await sendSnsEvent(preparedEvent);
119+
120+
expect(response.MessageId).toBeTruthy();
121+
122+
const supplierId = await supplierIdFromSupplierAllocatorLog(letterId);
123+
124+
await supplierDataSetup(supplierId);
125+
126+
const letters = await getLetterFromQueueById(supplierId, letterId);
127+
expect(letters).toHaveLength(1);
128+
const letter = letters[0];
129+
expect(letter.visibilityTimestamp).toBe(letter.queueTimestamp);
130+
logger.info(
131+
"Visibility timestamp is same as queue timestamp before calling Get /letters endpoint",
132+
);
133+
134+
// call get letters endpoint which should update the visibility timestamp
135+
const header = createValidRequestHeaders(supplierId);
136+
const getLettersResponse = await request.get(
137+
`${baseUrl}/${SUPPLIER_LETTERS}`,
138+
{
139+
headers: header,
140+
},
141+
);
142+
143+
expect(getLettersResponse.status()).toBe(200);
144+
const currentTimeWithTimeOut = Math.floor(
145+
(Date.now() + 5 * 60 * 1000) / 1000,
146+
);
147+
148+
logger.info(
149+
"Called Get /letters endpoint verify visibility timestamp is updated and subsequent calls returns no data until visibility timestamp is reached",
150+
);
151+
const lettersAfterGet = await getLetterFromQueueById(supplierId, letterId);
152+
const visibilityTimestampAfterGet = Math.floor(
153+
new Date(lettersAfterGet[0].visibilityTimestamp).getTime() / 1000,
154+
);
155+
156+
// allow a 1 second tolerance
157+
expect(
158+
Math.abs(visibilityTimestampAfterGet - currentTimeWithTimeOut),
159+
).toBeLessThanOrEqual(1);
160+
161+
const getLettersWithInVisibility = await request.get(
162+
`${baseUrl}/${SUPPLIER_LETTERS}`,
163+
{
164+
headers: header,
165+
},
166+
);
167+
168+
expect(getLettersWithInVisibility.status()).toBe(200);
169+
const responseBody = await getLettersWithInVisibility.json();
170+
expect(responseBody.data).toHaveLength(0);
171+
});
107172
});

0 commit comments

Comments
 (0)