Skip to content

Commit

Permalink
[synthetics] Change error message for timed out results (#1163)
Browse files Browse the repository at this point in the history
* [synthetics] Change error message for timed out results

* Update snapshots
  • Loading branch information
Drarig29 authored Jan 30, 2024
1 parent 8acdb1d commit fb5a1de
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/commands/synthetics/__tests__/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export const getTimedOutBrowserResult = (): Result => ({
passed: false,
result: {
duration: 0,
failure: {code: 'TIMEOUT', message: 'Result timed out'},
failure: {code: 'TIMEOUT', message: 'The batch timed out before receiving the result.'},
passed: false,
steps: [],
},
Expand Down Expand Up @@ -483,7 +483,7 @@ export const getResults = (resultsFixtures: ResultFixtures[]): Result[] => {

if (timedOut) {
result.timedOut = true
result.result.failure = {code: 'TIMEOUT', message: 'Result timed out'}
result.result.failure = {code: 'TIMEOUT', message: 'The batch timed out before receiving the result.'}
}

if (selectiveRerun) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ exports[`Default reporter resultEnd 3 Browser test: failed blocking, timed out,
✖ [blocking] [abc-def-ghi] Test name - location: Location name
⎋ View test run details: https://app.datadoghq.com/synthetics/details/abc-def-ghi/result/1?from_ci=true (not yet received)
[31m [[1mTIMEOUT[22m] - [2mResult timed out[22m[39m
[31m [[1mTIMEOUT[22m] - [2mThe batch timed out before receiving the result.[22m[39m
✖ [blocking] [abc-def-ghi] Test name - location: Location name
⎋ View test run details: https://app.datadoghq.com/synthetics/details/abc-def-ghi/result/1?from_ci=true
Expand Down
5 changes: 4 additions & 1 deletion src/commands/synthetics/__tests__/reporters/junit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,10 @@ describe('Junit reporter', () => {
}
const browserResult3: Result = {
...globalResultMock,
result: {...getBrowserServerResult(), failure: {code: 'TIMEOUT', message: 'Result timed out'}},
result: {
...getBrowserServerResult(),
failure: {code: 'TIMEOUT', message: 'The batch timed out before receiving the result.'},
},
timedOut: true,
}
const apiResult: Result = {
Expand Down
16 changes: 12 additions & 4 deletions src/commands/synthetics/__tests__/utils/public.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ describe('utils', () => {
...result,
result: {
...result.result,
failure: {code: 'TIMEOUT', message: 'Result timed out'},
failure: {code: 'TIMEOUT', message: 'The batch timed out before receiving the result.'},
passed: false,
},
resultId: '3',
Expand Down Expand Up @@ -1077,7 +1077,11 @@ describe('utils', () => {
).toStrictEqual([
{
...result,
result: {...result.result, failure: {code: 'TIMEOUT', message: 'Result timed out'}, passed: false},
result: {
...result.result,
failure: {code: 'TIMEOUT', message: 'The batch timed out before receiving the result.'},
passed: false,
},
timedOut: true,
},
])
Expand Down Expand Up @@ -1107,7 +1111,11 @@ describe('utils', () => {
).toEqual([
{
...result,
result: {...result.result, failure: {code: 'TIMEOUT', message: 'Result timed out'}, passed: false},
result: {
...result.result,
failure: {code: 'TIMEOUT', message: 'The batch timed out before receiving the result.'},
passed: false,
},
timedOut: true,
},
])
Expand Down Expand Up @@ -1189,7 +1197,7 @@ describe('utils', () => {
...result.result,
failure: {
code: 'TIMEOUT',
message: 'Result timed out',
message: 'The batch timed out before receiving the result.',
},
passed: false,
},
Expand Down
2 changes: 1 addition & 1 deletion src/commands/synthetics/reporters/junit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class JUnitReporter implements Reporter {
}

if (result.timedOut) {
// Timeout errors are manually reported by the CLI at the test level. ('Result timed out')
// Timeout errors are manually reported by the CLI at the test level. ('The batch timed out before receiving the result.')
errorOrFailure.push({
$: {type: 'timeout'},
_: String(result.result.failure?.message),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/synthetics/utils/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ const getResultFromBatch = (
const pollResult = pollResultMap[resultInBatch.result_id]

if (hasTimedOut) {
pollResult.result.failure = {code: 'TIMEOUT', message: 'Result timed out'}
pollResult.result.failure = {code: 'TIMEOUT', message: 'The batch timed out before receiving the result.'}
pollResult.result.passed = false
}

Expand Down

0 comments on commit fb5a1de

Please sign in to comment.