Skip to content

Commit

Permalink
Merge branch 'master' into corentin.girard/SYNTH-16456/incomplete-res…
Browse files Browse the repository at this point in the history
…ults-when-poll-result-404
  • Loading branch information
Drarig29 authored Oct 29, 2024
2 parents d01883a + ca6664b commit 85cba58
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/commands/synthetics/utils/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export const hasResultPassed = (
return result.status === 'passed'
}

/**
* Whether the result is of type {@link BaseResult}, i.e. it wasn't skipped.
*/
export const isBaseResult = (result: Result): result is BaseResult => {
return !isResultSkippedBySelectiveRerun(result)
}
Expand All @@ -57,6 +60,16 @@ export const hasDefinedResult = (result: Result): result is BaseResult & {result
return !isResultSkippedBySelectiveRerun(result) && result.result !== undefined
}

/**
* Whether the result has a defined {@link BaseResult.result} property.
*
* This property would be undefined if the server result isn't available when polling for it,
* which is a known latency issue. We call such result an incomplete result.
*/
export const hasDefinedResult = (result: Result): result is BaseResult & {result: ServerResult} => {

Check failure on line 69 in src/commands/synthetics/utils/internal.ts

View workflow job for this annotation

GitHub Actions / Build and test (14)

Cannot redeclare block-scoped variable 'hasDefinedResult'.

Check failure on line 69 in src/commands/synthetics/utils/internal.ts

View workflow job for this annotation

GitHub Actions / Build and test (16)

Cannot redeclare block-scoped variable 'hasDefinedResult'.

Check failure on line 69 in src/commands/synthetics/utils/internal.ts

View workflow job for this annotation

GitHub Actions / Test standalone binary in macOS

Cannot redeclare block-scoped variable 'hasDefinedResult'.

Check failure on line 69 in src/commands/synthetics/utils/internal.ts

View workflow job for this annotation

GitHub Actions / Build and test (18)

Cannot redeclare block-scoped variable 'hasDefinedResult'.

Check failure on line 69 in src/commands/synthetics/utils/internal.ts

View workflow job for this annotation

GitHub Actions / Test standalone binary in ubuntu

Cannot redeclare block-scoped variable 'hasDefinedResult'.

Check failure on line 69 in src/commands/synthetics/utils/internal.ts

View workflow job for this annotation

GitHub Actions / Test standalone binary in ARM macOS

Cannot redeclare block-scoped variable 'hasDefinedResult'.

Check failure on line 69 in src/commands/synthetics/utils/internal.ts

View workflow job for this annotation

GitHub Actions / Build and test (20)

Cannot redeclare block-scoped variable 'hasDefinedResult'.

Check failure on line 69 in src/commands/synthetics/utils/internal.ts

View workflow job for this annotation

GitHub Actions / Test standalone binary in windows

Cannot redeclare block-scoped variable 'hasDefinedResult'.
return isBaseResult(result) && result.result !== undefined
}

/**
* When the test is configured to be retried and the first attempt fails, `retries` is set to `0`
* and the result is kept `in_progress` until the final result is received.
Expand Down

0 comments on commit 85cba58

Please sign in to comment.