Skip to content

Commit 7d74e8e

Browse files
authored
add assertion at end of testing schedule invokes function (#2152)
* add assertion at end of testing schedule invokes function * change name of variable
1 parent 8a7f22e commit 7d74e8e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.changeset/eleven-chairs-camp.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/integration-tests/src/test-project-setup/data_storage_auth_with_triggers.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ class DataStorageAuthWithTriggerTestProject extends TestProjectBase {
603603
) => {
604604
const TIMEOUT_MS = 1000 * 60 * 2; // 2 minutes
605605
const startTime = Date.now();
606-
let messageCount = 0;
606+
let receivedMessageCount = 0;
607607

608608
const queue = await this.resourceFinder.findByBackendIdentifier(
609609
backendId,
@@ -612,16 +612,17 @@ class DataStorageAuthWithTriggerTestProject extends TestProjectBase {
612612
);
613613

614614
// wait for schedule to invoke the function one time for it to send a message
615-
while (Date.now() - startTime < TIMEOUT_MS && messageCount < 1) {
615+
while (Date.now() - startTime < TIMEOUT_MS) {
616616
const response = await this.sqsClient.send(
617617
new ReceiveMessageCommand({
618618
QueueUrl: queue[0],
619619
WaitTimeSeconds: 20,
620+
MaxNumberOfMessages: 10,
620621
})
621622
);
622623

623624
if (response.Messages) {
624-
messageCount += response.Messages.length;
625+
receivedMessageCount += response.Messages.length;
625626

626627
// delete messages afterwards
627628
for (const message of response.Messages) {
@@ -634,5 +635,11 @@ class DataStorageAuthWithTriggerTestProject extends TestProjectBase {
634635
}
635636
}
636637
}
638+
639+
if (receivedMessageCount === 0) {
640+
assert.fail(
641+
`The scheduled function failed to invoke and send a message to the queue.`
642+
);
643+
}
637644
};
638645
}

0 commit comments

Comments
 (0)