Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

context.cancel & rename errors & lazy fetch #8

Merged
merged 18 commits into from
Nov 20, 2024
Merged
Changes from 1 commit
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
26 changes: 16 additions & 10 deletions examples/ci/app/test-routes/sleepWithoutAwait/route.ts
Original file line number Diff line number Diff line change
@@ -12,20 +12,20 @@ type Invoice = {
type Charge = {
invoice: Invoice;
success: boolean;
counter: number
};

const header = `test-header-foo`
const headerValue = `header-bar`
const payload: Invoice = { date: 123, email: "my@mail.com", amount: 10 }

let counter = 0;
const attemptCharge = () => {
const attemptCharge = (counter: number) => {
counter += 1;
if (counter === 3) {
counter = 0;
return true;
return { success: true, counter };
}
return false;
return { success: false, counter };
};

export const { POST, GET } = testServe(
@@ -36,13 +36,19 @@ export const { POST, GET } = testServe(
expect(typeof invoice, typeof payload);
expect(JSON.stringify(invoice), JSON.stringify(payload));

let charge: Charge = {
success: false,
counter: 0,
invoice
}

for (let index = 0; index < 3; index++) {
const charge = await context.run("attemptCharge", () => {
const success = attemptCharge();
const charge: Charge = { invoice, success };
return charge;
charge = await context.run("attemptCharge", () => {
const { success, counter } = attemptCharge(charge.counter);
const newCharge: Charge = { invoice, success, counter };
return newCharge;
});

if (charge.success) {
const [updateDb, receipt, sleepResult] = await Promise.all([
context.run("updateDb", () => {
@@ -82,4 +88,4 @@ export const { POST, GET } = testServe(
[ header ]: headerValue
}
}
)
)

Unchanged files with check annotations Beta

const key = getRedisKey("result", route, randomTestId)
const testResult = await redis.get<RedisResult>(key)
if (!testResult) {
throw new Error(`result not found for route ${route} with randomTestId ${randomTestId}`)

Check failure on line 92 in examples/ci/app/ci/upstash/redis.ts

GitHub Actions / integration-test

error: result not found for route call/workflow with randomTestId 923

at /home/runner/work/workflow-js/workflow-js/examples/ci/app/ci/upstash/redis.ts:92:11

Check failure on line 92 in examples/ci/app/ci/upstash/redis.ts

GitHub Actions / integration-test

error: result not found for route large-payload/call-result/workflow with randomTestId 9084

at /home/runner/work/workflow-js/workflow-js/examples/ci/app/ci/upstash/redis.ts:92:11

Check failure on line 92 in examples/ci/app/ci/upstash/redis.ts

GitHub Actions / integration-test

error: result not found for route large-payload/error with randomTestId 1451

at /home/runner/work/workflow-js/workflow-js/examples/ci/app/ci/upstash/redis.ts:92:11

Check failure on line 92 in examples/ci/app/ci/upstash/redis.ts

GitHub Actions / integration-test

error: result not found for route large-payload/step-result with randomTestId 6508

at /home/runner/work/workflow-js/workflow-js/examples/ci/app/ci/upstash/redis.ts:92:11

Check failure on line 92 in examples/ci/app/ci/upstash/redis.ts

GitHub Actions / integration-test

error: result not found for route large-payload/step-result-parallel with randomTestId 1104

at /home/runner/work/workflow-js/workflow-js/examples/ci/app/ci/upstash/redis.ts:92:11
}
const { callCount, randomTestId: resultRandomTestId, result } = testResult
const startMessageDelivered = Boolean(events.find(event => event.state === "DELIVERED"))
if (!startMessageDelivered) {
await client.messages.delete(messageId)
throw new Error(`Couldn't verify that workflow has begun. Number of events: ${events.length}`)

Check failure on line 43 in examples/ci/app/ci/upstash/qstash.ts

GitHub Actions / integration-test

error: Couldn't verify that workflow has begun. Number of events: 2

at /home/runner/work/workflow-js/workflow-js/examples/ci/app/ci/upstash/qstash.ts:43:13
}
} catch (error) {
if (error instanceof QstashError && error.message.includes(`message ${messageId} not found`)) {