@datadog/datadog-ci 3.4.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js.map +1 -1
- package/dist/commands/cloud-run/flare.js +14 -14
- package/dist/commands/cloud-run/flare.js.map +1 -1
- package/dist/commands/coverage/api.js +10 -0
- package/dist/commands/coverage/api.js.map +1 -1
- package/dist/commands/coverage/interfaces.d.ts +3 -0
- package/dist/commands/coverage/renderer.js +2 -2
- package/dist/commands/coverage/renderer.js.map +1 -1
- package/dist/commands/coverage/upload.d.ts +3 -0
- package/dist/commands/coverage/upload.js +59 -12
- package/dist/commands/coverage/upload.js.map +1 -1
- package/dist/commands/coverage/utils.js +2 -2
- package/dist/commands/coverage/utils.js.map +1 -1
- package/dist/commands/dsyms/renderer.js +3 -3
- package/dist/commands/dsyms/renderer.js.map +1 -1
- package/dist/commands/dsyms/upload.js +9 -9
- package/dist/commands/dsyms/upload.js.map +1 -1
- package/dist/commands/dsyms/utils.js +4 -4
- package/dist/commands/dsyms/utils.js.map +1 -1
- package/dist/commands/elf-symbols/upload.js +4 -4
- package/dist/commands/elf-symbols/upload.js.map +1 -1
- package/dist/commands/flutter-symbols/helpers.js +5 -25
- package/dist/commands/flutter-symbols/helpers.js.map +1 -1
- package/dist/commands/flutter-symbols/upload.js +2 -2
- package/dist/commands/flutter-symbols/upload.js.map +1 -1
- package/dist/commands/gate/renderer.js +1 -1
- package/dist/commands/gate/renderer.js.map +1 -1
- package/dist/commands/git-metadata/git.d.ts +6 -0
- package/dist/commands/git-metadata/git.js +74 -2
- package/dist/commands/git-metadata/git.js.map +1 -1
- package/dist/commands/git-metadata/gitdb.js +4 -4
- package/dist/commands/git-metadata/gitdb.js.map +1 -1
- package/dist/commands/junit/api.js +2 -2
- package/dist/commands/junit/api.js.map +1 -1
- package/dist/commands/junit/renderer.js +2 -2
- package/dist/commands/junit/renderer.js.map +1 -1
- package/dist/commands/junit/upload.js +7 -7
- package/dist/commands/junit/upload.js.map +1 -1
- package/dist/commands/lambda/flare.js +18 -18
- package/dist/commands/lambda/flare.js.map +1 -1
- package/dist/commands/pe-symbols/upload.js +2 -3
- package/dist/commands/pe-symbols/upload.js.map +1 -1
- package/dist/commands/react-native/xcode.js +1 -2
- package/dist/commands/react-native/xcode.js.map +1 -1
- package/dist/commands/sarif/renderer.js +3 -3
- package/dist/commands/sarif/renderer.js.map +1 -1
- package/dist/commands/sarif/upload.js +5 -6
- package/dist/commands/sarif/upload.js.map +1 -1
- package/dist/commands/sourcemaps/upload.js +4 -5
- package/dist/commands/sourcemaps/upload.js.map +1 -1
- package/dist/commands/sourcemaps/utils.js +2 -2
- package/dist/commands/sourcemaps/utils.js.map +1 -1
- package/dist/commands/synthetics/api.d.ts +1 -1
- package/dist/commands/synthetics/api.js +40 -12
- package/dist/commands/synthetics/api.js.map +1 -1
- package/dist/commands/synthetics/base-command.d.ts +1 -1
- package/dist/commands/synthetics/base-command.js +12 -7
- package/dist/commands/synthetics/base-command.js.map +1 -1
- package/dist/commands/synthetics/batch.js +12 -11
- package/dist/commands/synthetics/batch.js.map +1 -1
- package/dist/commands/synthetics/build-and-test.d.ts +1 -1
- package/dist/commands/synthetics/build-and-test.js +11 -31
- package/dist/commands/synthetics/build-and-test.js.map +1 -1
- package/dist/commands/synthetics/deploy-tests-command.d.ts +1 -1
- package/dist/commands/synthetics/deploy-tests-command.js +8 -11
- package/dist/commands/synthetics/deploy-tests-command.js.map +1 -1
- package/dist/commands/synthetics/import-tests-command.js +10 -9
- package/dist/commands/synthetics/import-tests-command.js.map +1 -1
- package/dist/commands/synthetics/interfaces.d.ts +71 -35
- package/dist/commands/synthetics/interfaces.js.map +1 -1
- package/dist/commands/synthetics/multilocator.js +2 -2
- package/dist/commands/synthetics/multilocator.js.map +1 -1
- package/dist/commands/synthetics/reporters/default.js +10 -9
- package/dist/commands/synthetics/reporters/default.js.map +1 -1
- package/dist/commands/synthetics/reporters/junit.js +74 -63
- package/dist/commands/synthetics/reporters/junit.js.map +1 -1
- package/dist/commands/synthetics/run-tests-command.js +26 -18
- package/dist/commands/synthetics/run-tests-command.js.map +1 -1
- package/dist/commands/synthetics/test.d.ts +2 -2
- package/dist/commands/synthetics/upload-application-command.d.ts +1 -1
- package/dist/commands/synthetics/upload-application-command.js +19 -5
- package/dist/commands/synthetics/upload-application-command.js.map +1 -1
- package/dist/commands/synthetics/utils/internal.d.ts +3 -3
- package/dist/commands/synthetics/utils/internal.js +1 -2
- package/dist/commands/synthetics/utils/internal.js.map +1 -1
- package/dist/commands/synthetics/utils/public.d.ts +4 -4
- package/dist/commands/synthetics/utils/public.js +22 -11
- package/dist/commands/synthetics/utils/public.js.map +1 -1
- package/dist/commands/trace/test-utils.d.ts +4 -1
- package/dist/commands/trace/test-utils.js.map +1 -1
- package/dist/commands/unity-symbols/renderer.js +1 -1
- package/dist/commands/unity-symbols/upload.js +7 -7
- package/dist/commands/unity-symbols/upload.js.map +1 -1
- package/dist/helpers/ci.d.ts +1 -0
- package/dist/helpers/ci.js +3 -2
- package/dist/helpers/ci.js.map +1 -1
- package/dist/helpers/file-finder.js +3 -3
- package/dist/helpers/file-finder.js.map +1 -1
- package/dist/helpers/flare.js +4 -4
- package/dist/helpers/flare.js.map +1 -1
- package/dist/helpers/fs.js +3 -3
- package/dist/helpers/fs.js.map +1 -1
- package/dist/helpers/glob.d.ts +12 -0
- package/dist/helpers/glob.js +70 -0
- package/dist/helpers/glob.js.map +1 -0
- package/dist/helpers/interfaces.d.ts +7 -8
- package/dist/helpers/renderer.js +3 -3
- package/dist/helpers/renderer.js.map +1 -1
- package/dist/helpers/tags.d.ts +1 -0
- package/dist/helpers/tags.js +6 -4
- package/dist/helpers/tags.js.map +1 -1
- package/dist/helpers/utils.d.ts +5 -1
- package/dist/helpers/utils.js +6 -12
- package/dist/helpers/utils.js.map +1 -1
- package/package.json +6 -5
- package/dist/__tests__/cli.test.d.ts +0 -1
- package/dist/__tests__/cli.test.js +0 -93
- package/dist/__tests__/cli.test.js.map +0 -1
- package/dist/commands/cloud-run/__tests__/fixtures.d.ts +0 -2
- package/dist/commands/cloud-run/__tests__/fixtures.js +0 -12
- package/dist/commands/cloud-run/__tests__/fixtures.js.map +0 -1
- package/dist/commands/cloud-run/__tests__/flare.test.d.ts +0 -1
- package/dist/commands/cloud-run/__tests__/flare.test.js +0 -557
- package/dist/commands/cloud-run/__tests__/flare.test.js.map +0 -1
- package/dist/commands/coverage/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/coverage/__tests__/upload.test.js +0 -291
- package/dist/commands/coverage/__tests__/upload.test.js.map +0 -1
- package/dist/commands/coverage/__tests__/utils.test.d.ts +0 -1
- package/dist/commands/coverage/__tests__/utils.test.js +0 -47
- package/dist/commands/coverage/__tests__/utils.test.js.map +0 -1
- package/dist/commands/deployment/__tests__/correlate.test.d.ts +0 -1
- package/dist/commands/deployment/__tests__/correlate.test.js +0 -106
- package/dist/commands/deployment/__tests__/correlate.test.js.map +0 -1
- package/dist/commands/deployment/__tests__/mark.test.d.ts +0 -1
- package/dist/commands/deployment/__tests__/mark.test.js +0 -97
- package/dist/commands/deployment/__tests__/mark.test.js.map +0 -1
- package/dist/commands/dora/__tests__/deployment.test.d.ts +0 -1
- package/dist/commands/dora/__tests__/deployment.test.js +0 -203
- package/dist/commands/dora/__tests__/deployment.test.js.map +0 -1
- package/dist/commands/dsyms/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/dsyms/__tests__/upload.test.js +0 -346
- package/dist/commands/dsyms/__tests__/upload.test.js.map +0 -1
- package/dist/commands/dsyms/__tests__/utils.test.d.ts +0 -1
- package/dist/commands/dsyms/__tests__/utils.test.js +0 -100
- package/dist/commands/dsyms/__tests__/utils.test.js.map +0 -1
- package/dist/commands/elf-symbols/__tests__/elf.test.d.ts +0 -1
- package/dist/commands/elf-symbols/__tests__/elf.test.js +0 -822
- package/dist/commands/elf-symbols/__tests__/elf.test.js.map +0 -1
- package/dist/commands/elf-symbols/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/elf-symbols/__tests__/upload.test.js +0 -228
- package/dist/commands/elf-symbols/__tests__/upload.test.js.map +0 -1
- package/dist/commands/flutter-symbols/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/flutter-symbols/__tests__/upload.test.js +0 -617
- package/dist/commands/flutter-symbols/__tests__/upload.test.js.map +0 -1
- package/dist/commands/gate/__tests__/evaluate.test.d.ts +0 -1
- package/dist/commands/gate/__tests__/evaluate.test.js +0 -398
- package/dist/commands/gate/__tests__/evaluate.test.js.map +0 -1
- package/dist/commands/gate/__tests__/scope.test.d.ts +0 -1
- package/dist/commands/gate/__tests__/scope.test.js +0 -29
- package/dist/commands/gate/__tests__/scope.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/git.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/git.test.js +0 -132
- package/dist/commands/git-metadata/__tests__/git.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/gitdb.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/gitdb.test.js +0 -1386
- package/dist/commands/git-metadata/__tests__/gitdb.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/library.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/library.test.js +0 -118
- package/dist/commands/git-metadata/__tests__/library.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/upload.test.js +0 -52
- package/dist/commands/git-metadata/__tests__/upload.test.js.map +0 -1
- package/dist/commands/junit/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/junit/__tests__/upload.test.js +0 -495
- package/dist/commands/junit/__tests__/upload.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/fixtures.d.ts +0 -51
- package/dist/commands/lambda/__tests__/fixtures.js +0 -146
- package/dist/commands/lambda/__tests__/fixtures.js.map +0 -1
- package/dist/commands/lambda/__tests__/flare.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/flare.test.js +0 -730
- package/dist/commands/lambda/__tests__/flare.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/commons.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/commons.test.js +0 -791
- package/dist/commands/lambda/__tests__/functions/commons.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part1.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js +0 -388
- package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part2.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js +0 -732
- package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/uninstrument.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/uninstrument.test.js +0 -516
- package/dist/commands/lambda/__tests__/functions/uninstrument.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/versionChecker.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/versionChecker.test.js +0 -33
- package/dist/commands/lambda/__tests__/functions/versionChecker.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/instrument.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/instrument.test.js +0 -1606
- package/dist/commands/lambda/__tests__/instrument.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/loggroup.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/loggroup.test.js +0 -340
- package/dist/commands/lambda/__tests__/loggroup.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/prompt.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/prompt.test.js +0 -206
- package/dist/commands/lambda/__tests__/prompt.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/tags.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/tags.test.js +0 -305
- package/dist/commands/lambda/__tests__/tags.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/uninstrument.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/uninstrument.test.js +0 -725
- package/dist/commands/lambda/__tests__/uninstrument.test.js.map +0 -1
- package/dist/commands/measure/__tests__/measure.test.d.ts +0 -1
- package/dist/commands/measure/__tests__/measure.test.js +0 -102
- package/dist/commands/measure/__tests__/measure.test.js.map +0 -1
- package/dist/commands/pe-symbols/__tests__/pe.test.d.ts +0 -1
- package/dist/commands/pe-symbols/__tests__/pe.test.js +0 -81
- package/dist/commands/pe-symbols/__tests__/pe.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/codepush.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/codepush.test.js +0 -196
- package/dist/commands/react-native/__tests__/codepush.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/interfaces.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/interfaces.test.js +0 -33
- package/dist/commands/react-native/__tests__/interfaces.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/upload.test.js +0 -238
- package/dist/commands/react-native/__tests__/upload.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/utils.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/utils.test.js +0 -69
- package/dist/commands/react-native/__tests__/utils.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/xcode.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/xcode.test.js +0 -465
- package/dist/commands/react-native/__tests__/xcode.test.js.map +0 -1
- package/dist/commands/sarif/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/sarif/__tests__/upload.test.js +0 -291
- package/dist/commands/sarif/__tests__/upload.test.js.map +0 -1
- package/dist/commands/sarif/__tests__/utils.test.d.ts +0 -1
- package/dist/commands/sarif/__tests__/utils.test.js +0 -26
- package/dist/commands/sarif/__tests__/utils.test.js.map +0 -1
- package/dist/commands/sarif/__tests__/validation.test.d.ts +0 -1
- package/dist/commands/sarif/__tests__/validation.test.js +0 -19
- package/dist/commands/sarif/__tests__/validation.test.js.map +0 -1
- package/dist/commands/sbom/__tests__/payload.test.d.ts +0 -1
- package/dist/commands/sbom/__tests__/payload.test.js +0 -467
- package/dist/commands/sbom/__tests__/payload.test.js.map +0 -1
- package/dist/commands/sbom/__tests__/validation.test.d.ts +0 -1
- package/dist/commands/sbom/__tests__/validation.test.js +0 -145
- package/dist/commands/sbom/__tests__/validation.test.js.map +0 -1
- package/dist/commands/sourcemaps/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/sourcemaps/__tests__/upload.test.js +0 -270
- package/dist/commands/sourcemaps/__tests__/upload.test.js.map +0 -1
- package/dist/commands/sourcemaps/__tests__/utils.test.d.ts +0 -1
- package/dist/commands/sourcemaps/__tests__/utils.test.js +0 -31
- package/dist/commands/sourcemaps/__tests__/utils.test.js.map +0 -1
- package/dist/commands/span/__tests__/span.test.d.ts +0 -1
- package/dist/commands/span/__tests__/span.test.js +0 -108
- package/dist/commands/span/__tests__/span.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/awsCommands.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/awsCommands.test.js +0 -210
- package/dist/commands/stepfunctions/__tests__/awsCommands.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.d.ts +0 -6
- package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js +0 -45
- package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/fixtures/cli.d.ts +0 -5
- package/dist/commands/stepfunctions/__tests__/fixtures/cli.js +0 -19
- package/dist/commands/stepfunctions/__tests__/fixtures/cli.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/helpers.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/helpers.test.js +0 -501
- package/dist/commands/stepfunctions/__tests__/helpers.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/instrument.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/instrument.test.js +0 -431
- package/dist/commands/stepfunctions/__tests__/instrument.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/uninstrument.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/uninstrument.test.js +0 -166
- package/dist/commands/stepfunctions/__tests__/uninstrument.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/api.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/api.test.js +0 -416
- package/dist/commands/synthetics/__tests__/api.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/batch.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/batch.test.js +0 -907
- package/dist/commands/synthetics/__tests__/batch.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/build-and-test.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/build-and-test.test.js +0 -91
- package/dist/commands/synthetics/__tests__/build-and-test.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/cli.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/cli.test.js +0 -1407
- package/dist/commands/synthetics/__tests__/cli.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.js +0 -112
- package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/fixtures.d.ts +0 -123
- package/dist/commands/synthetics/__tests__/fixtures.js +0 -493
- package/dist/commands/synthetics/__tests__/fixtures.js.map +0 -1
- package/dist/commands/synthetics/__tests__/import-tests-lib.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/import-tests-lib.test.js +0 -186
- package/dist/commands/synthetics/__tests__/import-tests-lib.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/mobile.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/mobile.test.js +0 -376
- package/dist/commands/synthetics/__tests__/mobile.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/multilocator.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/multilocator.test.js +0 -142
- package/dist/commands/synthetics/__tests__/multilocator.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/reporters/default.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/reporters/default.test.js +0 -410
- package/dist/commands/synthetics/__tests__/reporters/default.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/reporters/junit.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/reporters/junit.test.js +0 -354
- package/dist/commands/synthetics/__tests__/reporters/junit.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js +0 -232
- package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/run-tests-lib.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/run-tests-lib.test.js +0 -698
- package/dist/commands/synthetics/__tests__/run-tests-lib.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/test.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/test.test.js +0 -268
- package/dist/commands/synthetics/__tests__/test.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/crypto.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js +0 -21
- package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js +0 -80
- package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/websocket.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js +0 -109
- package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/utils/internal.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/utils/internal.test.js +0 -161
- package/dist/commands/synthetics/__tests__/utils/internal.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/utils/public.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/utils/public.test.js +0 -576
- package/dist/commands/synthetics/__tests__/utils/public.test.js.map +0 -1
- package/dist/commands/tag/__tests__/tag.test.d.ts +0 -1
- package/dist/commands/tag/__tests__/tag.test.js +0 -85
- package/dist/commands/tag/__tests__/tag.test.js.map +0 -1
- package/dist/commands/trace/__tests__/trace.test.d.ts +0 -1
- package/dist/commands/trace/__tests__/trace.test.js +0 -48
- package/dist/commands/trace/__tests__/trace.test.js.map +0 -1
- package/dist/commands/unity-symbols/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/unity-symbols/__tests__/upload.test.js +0 -369
- package/dist/commands/unity-symbols/__tests__/upload.test.js.map +0 -1
- package/dist/helpers/__tests__/app.test.d.ts +0 -1
- package/dist/helpers/__tests__/app.test.js +0 -31
- package/dist/helpers/__tests__/app.test.js.map +0 -1
- package/dist/helpers/__tests__/ci.test.d.ts +0 -1
- package/dist/helpers/__tests__/ci.test.js +0 -344
- package/dist/helpers/__tests__/ci.test.js.map +0 -1
- package/dist/helpers/__tests__/env.test.d.ts +0 -1
- package/dist/helpers/__tests__/env.test.js +0 -74
- package/dist/helpers/__tests__/env.test.js.map +0 -1
- package/dist/helpers/__tests__/fips.test.d.ts +0 -1
- package/dist/helpers/__tests__/fips.test.js +0 -30
- package/dist/helpers/__tests__/fips.test.js.map +0 -1
- package/dist/helpers/__tests__/fixtures.d.ts +0 -41
- package/dist/helpers/__tests__/fixtures.js +0 -80
- package/dist/helpers/__tests__/fixtures.js.map +0 -1
- package/dist/helpers/__tests__/flare.test.d.ts +0 -1
- package/dist/helpers/__tests__/flare.test.js +0 -227
- package/dist/helpers/__tests__/flare.test.js.map +0 -1
- package/dist/helpers/__tests__/fs.test.d.ts +0 -1
- package/dist/helpers/__tests__/fs.test.js +0 -189
- package/dist/helpers/__tests__/fs.test.js.map +0 -1
- package/dist/helpers/__tests__/id.test.d.ts +0 -1
- package/dist/helpers/__tests__/id.test.js +0 -24
- package/dist/helpers/__tests__/id.test.js.map +0 -1
- package/dist/helpers/__tests__/plist.test.d.ts +0 -1
- package/dist/helpers/__tests__/plist.test.js +0 -43
- package/dist/helpers/__tests__/plist.test.js.map +0 -1
- package/dist/helpers/__tests__/prompt.test.d.ts +0 -1
- package/dist/helpers/__tests__/prompt.test.js +0 -71
- package/dist/helpers/__tests__/prompt.test.js.map +0 -1
- package/dist/helpers/__tests__/retry.test.d.ts +0 -1
- package/dist/helpers/__tests__/retry.test.js +0 -99
- package/dist/helpers/__tests__/retry.test.js.map +0 -1
- package/dist/helpers/__tests__/tags.test.d.ts +0 -1
- package/dist/helpers/__tests__/tags.test.js +0 -362
- package/dist/helpers/__tests__/tags.test.js.map +0 -1
- package/dist/helpers/__tests__/upload.test.d.ts +0 -1
- package/dist/helpers/__tests__/upload.test.js +0 -231
- package/dist/helpers/__tests__/upload.test.js.map +0 -1
- package/dist/helpers/__tests__/user-provided-git.test.d.ts +0 -1
- package/dist/helpers/__tests__/user-provided-git.test.js +0 -119
- package/dist/helpers/__tests__/user-provided-git.test.js.map +0 -1
- package/dist/helpers/__tests__/utils.test.d.ts +0 -1
- package/dist/helpers/__tests__/utils.test.js +0 -429
- package/dist/helpers/__tests__/utils.test.js.map +0 -1
- package/dist/helpers/__tests__/validation.test.d.ts +0 -1
- package/dist/helpers/__tests__/validation.test.js +0 -25
- package/dist/helpers/__tests__/validation.test.js.map +0 -1
- package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.d.ts +0 -1
- package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js +0 -103
- package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js.map +0 -1
- package/dist/helpers/git/__tests__/format-git-span-data.test.d.ts +0 -1
- package/dist/helpers/git/__tests__/format-git-span-data.test.js +0 -121
- package/dist/helpers/git/__tests__/format-git-span-data.test.js.map +0 -1
- package/dist/helpers/git/__tests__/get-git-data.test.d.ts +0 -1
- package/dist/helpers/git/__tests__/get-git-data.test.js +0 -72
- package/dist/helpers/git/__tests__/get-git-data.test.js.map +0 -1
|
@@ -1,907 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const axios_1 = __importDefault(require("axios"));
|
|
39
|
-
const deep_extend_1 = __importDefault(require("deep-extend"));
|
|
40
|
-
const fixtures_1 = require("../../../helpers/__tests__/fixtures");
|
|
41
|
-
const ciHelpers = __importStar(require("../../../helpers/ci"));
|
|
42
|
-
process.env.DATADOG_SYNTHETICS_CI_TRIGGER_APP = 'env_default';
|
|
43
|
-
const api_1 = require("../api");
|
|
44
|
-
const batch_1 = require("../batch");
|
|
45
|
-
const errors_1 = require("../errors");
|
|
46
|
-
const interfaces_1 = require("../interfaces");
|
|
47
|
-
const run_tests_lib_1 = require("../run-tests-lib");
|
|
48
|
-
const internalUtils = __importStar(require("../utils/internal"));
|
|
49
|
-
const utils = __importStar(require("../utils/public"));
|
|
50
|
-
const fixtures_2 = require("./fixtures");
|
|
51
|
-
const apiConfiguration = {
|
|
52
|
-
apiKey: '123',
|
|
53
|
-
appKey: '123',
|
|
54
|
-
baseIntakeUrl: 'baseintake',
|
|
55
|
-
baseUnstableUrl: 'baseUnstable',
|
|
56
|
-
baseUrl: 'base',
|
|
57
|
-
proxyOpts: { protocol: 'http' },
|
|
58
|
-
};
|
|
59
|
-
const api = (0, api_1.apiConstructor)(apiConfiguration);
|
|
60
|
-
const DEFAULT_COMMAND_CONFIG = (0, run_tests_lib_1.getDefaultConfig)();
|
|
61
|
-
describe('runTests', () => {
|
|
62
|
-
beforeEach(() => {
|
|
63
|
-
jest.restoreAllMocks();
|
|
64
|
-
});
|
|
65
|
-
const fakeId = '123-456-789';
|
|
66
|
-
const fakeTrigger = {
|
|
67
|
-
batch_id: 'bid',
|
|
68
|
-
locations: [],
|
|
69
|
-
};
|
|
70
|
-
test('should run test', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
-
jest.spyOn(api, 'triggerTests').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return fakeTrigger; }));
|
|
72
|
-
const output = yield (0, batch_1.runTests)(api, [{ public_id: fakeId, executionRule: interfaces_1.ExecutionRule.NON_BLOCKING }]);
|
|
73
|
-
expect(output).toEqual(fakeTrigger);
|
|
74
|
-
}));
|
|
75
|
-
test('runTests sends batch metadata', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
76
|
-
jest.spyOn(ciHelpers, 'getCIMetadata').mockImplementation(() => undefined);
|
|
77
|
-
const payloadMetadataSpy = jest.fn();
|
|
78
|
-
jest.spyOn(axios_1.default, 'create').mockImplementation((() => (request) => {
|
|
79
|
-
payloadMetadataSpy(request.data.metadata);
|
|
80
|
-
if (request.url === '/synthetics/tests/trigger/ci') {
|
|
81
|
-
return { data: fakeTrigger };
|
|
82
|
-
}
|
|
83
|
-
}));
|
|
84
|
-
yield (0, batch_1.runTests)(api, [{ public_id: fakeId, executionRule: interfaces_1.ExecutionRule.NON_BLOCKING }]);
|
|
85
|
-
expect(payloadMetadataSpy).toHaveBeenCalledWith(undefined);
|
|
86
|
-
const metadata = {
|
|
87
|
-
ci: { job: { name: 'job' }, pipeline: {}, provider: { name: 'jest' }, stage: {} },
|
|
88
|
-
git: { commit: { author: {}, committer: {}, message: 'test' } },
|
|
89
|
-
};
|
|
90
|
-
jest.spyOn(ciHelpers, 'getCIMetadata').mockImplementation(() => metadata);
|
|
91
|
-
yield (0, batch_1.runTests)(api, [{ public_id: fakeId, executionRule: interfaces_1.ExecutionRule.NON_BLOCKING }]);
|
|
92
|
-
expect(payloadMetadataSpy).toHaveBeenCalledWith(metadata);
|
|
93
|
-
}));
|
|
94
|
-
test('runTests api call has the right payload and trigger app header', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
-
jest.spyOn(ciHelpers, 'getCIMetadata').mockImplementation(() => undefined);
|
|
96
|
-
const testsPayloadSpy = jest.fn();
|
|
97
|
-
const headersMetadataSpy = jest.fn();
|
|
98
|
-
jest.spyOn(axios_1.default, 'create').mockImplementation((() => (request) => {
|
|
99
|
-
testsPayloadSpy(request.data.tests);
|
|
100
|
-
headersMetadataSpy(request.headers);
|
|
101
|
-
if (request.url === '/synthetics/tests/trigger/ci') {
|
|
102
|
-
return { data: fakeTrigger };
|
|
103
|
-
}
|
|
104
|
-
}));
|
|
105
|
-
yield (0, batch_1.runTests)(api, [{ public_id: fakeId, executionRule: interfaces_1.ExecutionRule.NON_BLOCKING }]);
|
|
106
|
-
expect(headersMetadataSpy).toHaveBeenCalledWith(expect.objectContaining({ 'X-Trigger-App': 'env_default' }));
|
|
107
|
-
expect(testsPayloadSpy).toHaveBeenCalledWith([
|
|
108
|
-
{
|
|
109
|
-
public_id: fakeId,
|
|
110
|
-
executionRule: interfaces_1.ExecutionRule.NON_BLOCKING,
|
|
111
|
-
},
|
|
112
|
-
]);
|
|
113
|
-
utils.setCiTriggerApp('unit_test');
|
|
114
|
-
yield (0, batch_1.runTests)(api, [{ public_id: fakeId, executionRule: interfaces_1.ExecutionRule.NON_BLOCKING }]);
|
|
115
|
-
expect(headersMetadataSpy).toHaveBeenCalledWith(expect.objectContaining({ 'X-Trigger-App': 'unit_test' }));
|
|
116
|
-
expect(testsPayloadSpy).toHaveBeenCalledWith([
|
|
117
|
-
{
|
|
118
|
-
public_id: fakeId,
|
|
119
|
-
executionRule: interfaces_1.ExecutionRule.NON_BLOCKING,
|
|
120
|
-
},
|
|
121
|
-
]);
|
|
122
|
-
}));
|
|
123
|
-
test('should run test with publicId from url', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
|
-
jest.spyOn(api, 'triggerTests').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return fakeTrigger; }));
|
|
125
|
-
const output = yield (0, batch_1.runTests)(api, [
|
|
126
|
-
{
|
|
127
|
-
executionRule: interfaces_1.ExecutionRule.NON_BLOCKING,
|
|
128
|
-
public_id: `http://localhost/synthetics/tests/details/${fakeId}`,
|
|
129
|
-
},
|
|
130
|
-
]);
|
|
131
|
-
expect(output).toEqual(fakeTrigger);
|
|
132
|
-
}));
|
|
133
|
-
test('triggerTests throws', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
134
|
-
jest.spyOn(api, 'triggerTests').mockImplementation(() => {
|
|
135
|
-
throw (0, fixtures_1.getAxiosError)(502, { message: 'Server Error' });
|
|
136
|
-
});
|
|
137
|
-
yield expect((0, batch_1.runTests)(api, [{ public_id: fakeId, executionRule: interfaces_1.ExecutionRule.NON_BLOCKING }])).rejects.toThrow(/Failed to trigger tests:/);
|
|
138
|
-
}));
|
|
139
|
-
});
|
|
140
|
-
describe('waitForResults', () => {
|
|
141
|
-
beforeEach(() => {
|
|
142
|
-
jest.useFakeTimers({ now: 123 });
|
|
143
|
-
jest.spyOn(internalUtils, 'wait').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return jest.advanceTimersByTime(5000); }));
|
|
144
|
-
});
|
|
145
|
-
afterEach(() => {
|
|
146
|
-
jest.useRealTimers();
|
|
147
|
-
jest.restoreAllMocks();
|
|
148
|
-
});
|
|
149
|
-
const batch = (0, fixtures_2.getBatch)();
|
|
150
|
-
const apiTest = (0, fixtures_2.getApiTest)('pid');
|
|
151
|
-
const result = {
|
|
152
|
-
duration: 1000,
|
|
153
|
-
executionRule: interfaces_1.ExecutionRule.BLOCKING,
|
|
154
|
-
initialResultId: undefined,
|
|
155
|
-
isNonFinal: false,
|
|
156
|
-
location: fixtures_2.mockLocation.display_name,
|
|
157
|
-
passed: true,
|
|
158
|
-
result: (0, fixtures_2.getBrowserServerResult)({ passed: true }),
|
|
159
|
-
resultId: 'rid',
|
|
160
|
-
retries: 0,
|
|
161
|
-
maxRetries: 0,
|
|
162
|
-
selectiveRerun: undefined,
|
|
163
|
-
test: apiTest,
|
|
164
|
-
timedOut: false,
|
|
165
|
-
timestamp: 0,
|
|
166
|
-
};
|
|
167
|
-
const pollResult = {
|
|
168
|
-
check: result.test,
|
|
169
|
-
result: result.result,
|
|
170
|
-
resultID: result.resultId,
|
|
171
|
-
timestamp: result.timestamp,
|
|
172
|
-
};
|
|
173
|
-
const trigger = { batch_id: 'bid', locations: [fixtures_2.mockLocation] };
|
|
174
|
-
const mockApi = ({ getBatchImplementation, pollResultsImplementation, } = {}) => {
|
|
175
|
-
const getBatchMock = jest
|
|
176
|
-
.spyOn(api, 'getBatch')
|
|
177
|
-
.mockImplementation(getBatchImplementation || (() => __awaiter(void 0, void 0, void 0, function* () { return (0, deep_extend_1.default)({}, batch); })));
|
|
178
|
-
const pollResultsMock = jest
|
|
179
|
-
.spyOn(api, 'pollResults')
|
|
180
|
-
.mockImplementation(pollResultsImplementation || (() => __awaiter(void 0, void 0, void 0, function* () { return [(0, deep_extend_1.default)({}, pollResult)]; })));
|
|
181
|
-
return { getBatchMock, pollResultsMock };
|
|
182
|
-
};
|
|
183
|
-
const waiter = {
|
|
184
|
-
promise: Promise.resolve(),
|
|
185
|
-
resolve: () => { },
|
|
186
|
-
start() {
|
|
187
|
-
this.promise = new Promise((resolve) => (this.resolve = resolve));
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
test('should poll result ids', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
191
|
-
mockApi();
|
|
192
|
-
expect(yield (0, batch_1.waitForResults)(api, trigger, [result.test], {
|
|
193
|
-
batchTimeout: 120000,
|
|
194
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
195
|
-
failOnCriticalErrors: false,
|
|
196
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
197
|
-
}, fixtures_2.mockReporter)).toEqual([result]);
|
|
198
|
-
}));
|
|
199
|
-
test('should show results as they arrive', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
200
|
-
jest.spyOn(internalUtils, 'wait').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return waiter.resolve(); }));
|
|
201
|
-
const tests = [result.test, Object.assign(Object.assign({}, result.test), { public_id: 'other-public-id' })];
|
|
202
|
-
// === STEP 1 === (batch 'in_progress')
|
|
203
|
-
waiter.start();
|
|
204
|
-
mockApi({
|
|
205
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
206
|
-
return ({
|
|
207
|
-
status: 'in_progress',
|
|
208
|
-
results: [
|
|
209
|
-
Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()),
|
|
210
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { result_id: 'rid-2' }),
|
|
211
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-3' }),
|
|
212
|
-
],
|
|
213
|
-
});
|
|
214
|
-
}),
|
|
215
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () { return [(0, deep_extend_1.default)({}, pollResult)]; }),
|
|
216
|
-
});
|
|
217
|
-
const resultsPromise = (0, batch_1.waitForResults)(api, trigger, tests, {
|
|
218
|
-
batchTimeout: 120000,
|
|
219
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
220
|
-
failOnCriticalErrors: false,
|
|
221
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
222
|
-
}, fixtures_2.mockReporter);
|
|
223
|
-
// Wait for the 2 tests (initial)
|
|
224
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(1, [tests[0], tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id);
|
|
225
|
-
yield waiter.promise;
|
|
226
|
-
// No results received
|
|
227
|
-
expect(fixtures_2.mockReporter.resultReceived).not.toHaveBeenCalled();
|
|
228
|
-
expect(fixtures_2.mockReporter.resultEnd).not.toHaveBeenCalled();
|
|
229
|
-
// Still waiting for the 2 tests
|
|
230
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(2, [tests[0], tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id, 0);
|
|
231
|
-
// === STEP 2 === (batch 'in_progress')
|
|
232
|
-
waiter.start();
|
|
233
|
-
mockApi({
|
|
234
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
235
|
-
return ({
|
|
236
|
-
status: 'in_progress',
|
|
237
|
-
results: [
|
|
238
|
-
Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()),
|
|
239
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { result_id: 'rid-2' }),
|
|
240
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-3' }),
|
|
241
|
-
],
|
|
242
|
-
});
|
|
243
|
-
}),
|
|
244
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
245
|
-
return [
|
|
246
|
-
(0, deep_extend_1.default)({}, pollResult),
|
|
247
|
-
(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-2' }),
|
|
248
|
-
(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-3' }),
|
|
249
|
-
];
|
|
250
|
-
}),
|
|
251
|
-
});
|
|
252
|
-
yield waiter.promise;
|
|
253
|
-
// One result received
|
|
254
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenNthCalledWith(1, Object.assign(Object.assign({}, batch.results[0]), { status: 'passed', result_id: 'rid-2' }));
|
|
255
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(1, Object.assign(Object.assign({}, result), { resultId: 'rid-2' }), fixtures_1.MOCK_BASE_URL, 'bid');
|
|
256
|
-
// Still waiting for 2 tests
|
|
257
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(3, [tests[0], tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id, 0);
|
|
258
|
-
// === STEP 3 === (batch 'in_progress')
|
|
259
|
-
waiter.start();
|
|
260
|
-
mockApi({
|
|
261
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
262
|
-
return ({
|
|
263
|
-
status: 'in_progress',
|
|
264
|
-
results: [
|
|
265
|
-
Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()),
|
|
266
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { result_id: 'rid-2' }),
|
|
267
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-3' }),
|
|
268
|
-
],
|
|
269
|
-
});
|
|
270
|
-
}),
|
|
271
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
272
|
-
return [
|
|
273
|
-
(0, deep_extend_1.default)({}, pollResult),
|
|
274
|
-
(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-2' }),
|
|
275
|
-
(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-3' }),
|
|
276
|
-
];
|
|
277
|
-
}),
|
|
278
|
-
});
|
|
279
|
-
yield waiter.promise;
|
|
280
|
-
// One result received
|
|
281
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenNthCalledWith(2, Object.assign(Object.assign({}, batch.results[0]), { status: 'passed' }));
|
|
282
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(2, result, fixtures_1.MOCK_BASE_URL, 'bid');
|
|
283
|
-
// Now waiting for 1 test
|
|
284
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(4, [tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id, 0);
|
|
285
|
-
// === STEP 4 === (batch 'in_progress')
|
|
286
|
-
waiter.start();
|
|
287
|
-
mockApi({
|
|
288
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
289
|
-
return ({
|
|
290
|
-
status: 'in_progress',
|
|
291
|
-
results: [
|
|
292
|
-
Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()),
|
|
293
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { result_id: 'rid-2' }),
|
|
294
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { duration: 1000, retries: 0, test_public_id: 'other-public-id', timed_out: false, result_id: 'rid-3' }),
|
|
295
|
-
],
|
|
296
|
-
});
|
|
297
|
-
}),
|
|
298
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
299
|
-
return [
|
|
300
|
-
(0, deep_extend_1.default)({}, pollResult),
|
|
301
|
-
(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-2' }),
|
|
302
|
-
(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-3' }),
|
|
303
|
-
];
|
|
304
|
-
}),
|
|
305
|
-
});
|
|
306
|
-
yield waiter.promise;
|
|
307
|
-
// One result received
|
|
308
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenNthCalledWith(3, Object.assign(Object.assign({}, batch.results[0]), { duration: 1000, status: 'in_progress', test_public_id: 'other-public-id', result_id: 'rid-3' }));
|
|
309
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(3, Object.assign(Object.assign({}, result), { isNonFinal: true, resultId: 'rid-3', passed: false }), // the first attempt failed, so it's being retried
|
|
310
|
-
fixtures_1.MOCK_BASE_URL, 'bid');
|
|
311
|
-
// Now waiting for 1 test
|
|
312
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(5, [tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id, 0);
|
|
313
|
-
// === STEP 5 === (batch 'passed')
|
|
314
|
-
mockApi({
|
|
315
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
316
|
-
return ({
|
|
317
|
-
status: 'passed',
|
|
318
|
-
results: [
|
|
319
|
-
Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()),
|
|
320
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { result_id: 'rid-2' }),
|
|
321
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { retries: 1, test_public_id: 'other-public-id', result_id: 'rid-3-final' }),
|
|
322
|
-
],
|
|
323
|
-
});
|
|
324
|
-
}),
|
|
325
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
326
|
-
return [
|
|
327
|
-
(0, deep_extend_1.default)({}, pollResult),
|
|
328
|
-
(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-2' }),
|
|
329
|
-
(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-3-final' }),
|
|
330
|
-
];
|
|
331
|
-
}),
|
|
332
|
-
});
|
|
333
|
-
expect(yield resultsPromise).toEqual([
|
|
334
|
-
result,
|
|
335
|
-
Object.assign(Object.assign({}, result), { resultId: 'rid-2' }),
|
|
336
|
-
Object.assign(Object.assign({}, result), { resultId: 'rid-3-final', retries: 1 }),
|
|
337
|
-
]);
|
|
338
|
-
// One result received
|
|
339
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenNthCalledWith(4, Object.assign(Object.assign({}, batch.results[0]), { status: 'passed', test_public_id: 'other-public-id', result_id: 'rid-3-final', retries: 1 }));
|
|
340
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(4, Object.assign(Object.assign({}, result), { resultId: 'rid-3-final', retries: 1 }), fixtures_1.MOCK_BASE_URL, 'bid');
|
|
341
|
-
// Do not report when there are no tests to wait anymore
|
|
342
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenCalledTimes(5);
|
|
343
|
-
}));
|
|
344
|
-
test('skipped results are reported as received', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
345
|
-
jest.spyOn(internalUtils, 'wait').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return waiter.resolve(); }));
|
|
346
|
-
const tests = [result.test, Object.assign(Object.assign({}, result.test), { public_id: 'other-public-id' })];
|
|
347
|
-
// === STEP 1 === (batch 'in_progress')
|
|
348
|
-
waiter.start();
|
|
349
|
-
mockApi({
|
|
350
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
351
|
-
return ({
|
|
352
|
-
status: 'in_progress',
|
|
353
|
-
results: [
|
|
354
|
-
Object.assign({}, (0, fixtures_2.getSkippedResultInBatch)()),
|
|
355
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-2' }),
|
|
356
|
-
],
|
|
357
|
-
});
|
|
358
|
-
}),
|
|
359
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () { return [Object.assign(Object.assign({}, pollResult), { resultID: 'rid-2' })]; }),
|
|
360
|
-
});
|
|
361
|
-
const resultsPromise = (0, batch_1.waitForResults)(api, trigger, tests, {
|
|
362
|
-
batchTimeout: 120000,
|
|
363
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
364
|
-
failOnCriticalErrors: false,
|
|
365
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
366
|
-
}, fixtures_2.mockReporter);
|
|
367
|
-
// Wait for the 2 tests (initial)
|
|
368
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(1, [tests[0], tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id);
|
|
369
|
-
yield waiter.promise;
|
|
370
|
-
// The skipped result is received
|
|
371
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenNthCalledWith(1, Object.assign({}, (0, fixtures_2.getSkippedResultInBatch)()));
|
|
372
|
-
// And marked as passed because it's selective rerun
|
|
373
|
-
const skippedResult = {
|
|
374
|
-
executionRule: interfaces_1.ExecutionRule.SKIPPED,
|
|
375
|
-
passed: true,
|
|
376
|
-
resultId: '123',
|
|
377
|
-
selectiveRerun: { decision: 'skip', reason: 'passed', linked_result_id: '123' },
|
|
378
|
-
test: result.test,
|
|
379
|
-
timedOut: false,
|
|
380
|
-
};
|
|
381
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(1, skippedResult, fixtures_1.MOCK_BASE_URL, 'bid');
|
|
382
|
-
// Now waiting for the remaining test
|
|
383
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(2, [tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id, 1);
|
|
384
|
-
// === STEP 2 === (batch 'passed')
|
|
385
|
-
mockApi({
|
|
386
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
387
|
-
return ({
|
|
388
|
-
status: 'passed',
|
|
389
|
-
results: [
|
|
390
|
-
Object.assign({}, (0, fixtures_2.getSkippedResultInBatch)()),
|
|
391
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-2' }),
|
|
392
|
-
],
|
|
393
|
-
});
|
|
394
|
-
}),
|
|
395
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () { return [(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-2' })]; }),
|
|
396
|
-
});
|
|
397
|
-
expect(yield resultsPromise).toEqual([Object.assign({}, skippedResult), Object.assign(Object.assign({}, result), { resultId: 'rid-2' })]);
|
|
398
|
-
// One result received
|
|
399
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenNthCalledWith(2, Object.assign(Object.assign({}, batch.results[0]), { status: 'passed', test_public_id: 'other-public-id', result_id: 'rid-2' }));
|
|
400
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(2, Object.assign(Object.assign({}, result), { resultId: 'rid-2' }), fixtures_1.MOCK_BASE_URL, 'bid');
|
|
401
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenCalledTimes(2);
|
|
402
|
-
}));
|
|
403
|
-
test('should wait for incomplete results', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
404
|
-
jest.spyOn(internalUtils, 'wait').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return waiter.resolve(); }));
|
|
405
|
-
const tests = [result.test, Object.assign(Object.assign({}, result.test), { public_id: 'other-public-id' })];
|
|
406
|
-
// === STEP 1 === (batch 'in_progress')
|
|
407
|
-
waiter.start();
|
|
408
|
-
mockApi({
|
|
409
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
410
|
-
return ({
|
|
411
|
-
status: 'in_progress',
|
|
412
|
-
results: [
|
|
413
|
-
Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()),
|
|
414
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { result_id: 'rid-2' }),
|
|
415
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-3' }),
|
|
416
|
-
],
|
|
417
|
-
});
|
|
418
|
-
}),
|
|
419
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () { return [Object.assign(Object.assign({}, pollResult), { resultID: 'rid-2', result: (0, fixtures_2.getIncompleteServerResult)() })]; }),
|
|
420
|
-
});
|
|
421
|
-
const resultsPromise = (0, batch_1.waitForResults)(api, trigger, tests, {
|
|
422
|
-
batchTimeout: 120000,
|
|
423
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
424
|
-
failOnCriticalErrors: false,
|
|
425
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
426
|
-
}, fixtures_2.mockReporter);
|
|
427
|
-
// Wait for the 2 tests (initial)
|
|
428
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(1, [tests[0], tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id);
|
|
429
|
-
yield waiter.promise;
|
|
430
|
-
// One result received
|
|
431
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenNthCalledWith(1, Object.assign(Object.assign({}, batch.results[0]), { status: 'passed', result_id: 'rid-2' }));
|
|
432
|
-
// But the data from `/poll_results` data is not available yet, so we should wait more before reporting
|
|
433
|
-
expect(fixtures_2.mockReporter.resultEnd).not.toHaveBeenCalled();
|
|
434
|
-
// Still waiting for 2 tests
|
|
435
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(2, [tests[0], tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id, 0);
|
|
436
|
-
// === STEP 2 === (batch 'in_progress')
|
|
437
|
-
waiter.start();
|
|
438
|
-
mockApi({
|
|
439
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
440
|
-
return ({
|
|
441
|
-
status: 'in_progress',
|
|
442
|
-
results: [
|
|
443
|
-
Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()),
|
|
444
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { result_id: 'rid-2' }),
|
|
445
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-3' }),
|
|
446
|
-
],
|
|
447
|
-
});
|
|
448
|
-
}),
|
|
449
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
450
|
-
return [
|
|
451
|
-
Object.assign(Object.assign({}, pollResult), { result: (0, fixtures_2.getIncompleteServerResult)() }),
|
|
452
|
-
(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-2' }), // just became available
|
|
453
|
-
];
|
|
454
|
-
}),
|
|
455
|
-
});
|
|
456
|
-
yield waiter.promise;
|
|
457
|
-
// One result received
|
|
458
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenNthCalledWith(2, Object.assign(Object.assign({}, batch.results[0]), { status: 'passed' }));
|
|
459
|
-
// Result 2 just became available, so it should be reported
|
|
460
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(1, Object.assign(Object.assign({}, result), { resultId: 'rid-2' }), fixtures_1.MOCK_BASE_URL, 'bid');
|
|
461
|
-
// Now waiting for 1 test
|
|
462
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(3, [tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id, 0);
|
|
463
|
-
// === STEP 3 === (batch 'failed')
|
|
464
|
-
mockApi({
|
|
465
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
466
|
-
return ({
|
|
467
|
-
status: 'failed',
|
|
468
|
-
results: [
|
|
469
|
-
Object.assign({}, (0, fixtures_2.getFailedResultInBatch)()),
|
|
470
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { result_id: 'rid-2' }),
|
|
471
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-3' }),
|
|
472
|
-
],
|
|
473
|
-
});
|
|
474
|
-
}),
|
|
475
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
476
|
-
return [
|
|
477
|
-
Object.assign(Object.assign({}, pollResult), { result: (0, fixtures_2.getIncompleteServerResult)() }),
|
|
478
|
-
(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-2' }),
|
|
479
|
-
(0, deep_extend_1.default)({}, pollResult, { resultID: 'rid-3' }),
|
|
480
|
-
];
|
|
481
|
-
}),
|
|
482
|
-
});
|
|
483
|
-
expect(yield resultsPromise).toEqual([
|
|
484
|
-
Object.assign(Object.assign({}, result), { resultId: 'rid', passed: false, result: undefined }),
|
|
485
|
-
Object.assign(Object.assign({}, result), { resultId: 'rid-2' }),
|
|
486
|
-
Object.assign(Object.assign({}, result), { resultId: 'rid-3' }),
|
|
487
|
-
]);
|
|
488
|
-
// One result received
|
|
489
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenNthCalledWith(3, Object.assign(Object.assign({}, batch.results[0]), { status: 'passed', test_public_id: 'other-public-id', result_id: 'rid-3' }));
|
|
490
|
-
// Result 3 was available instantly
|
|
491
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(2, Object.assign(Object.assign({}, result), { resultId: 'rid-3' }), fixtures_1.MOCK_BASE_URL, 'bid');
|
|
492
|
-
// Result 1 never became available (but the batch says it did not pass)
|
|
493
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(3, Object.assign(Object.assign({}, result), { passed: false, resultId: 'rid', result: undefined }), fixtures_1.MOCK_BASE_URL, 'bid');
|
|
494
|
-
expect(fixtures_2.mockReporter.error).toHaveBeenCalledWith('The information for result rid of test pid was incomplete at the end of the batch.\n\n');
|
|
495
|
-
// Do not report when there are no tests to wait anymore
|
|
496
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenCalledTimes(3);
|
|
497
|
-
}));
|
|
498
|
-
test('should wait for incomplete results caused by 404', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
499
|
-
jest.spyOn(internalUtils, 'wait').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return waiter.resolve(); }));
|
|
500
|
-
const tests = [result.test, Object.assign(Object.assign({}, result.test), { public_id: 'other-public-id' })];
|
|
501
|
-
// === STEP 1 === (batch 'in_progress')
|
|
502
|
-
waiter.start();
|
|
503
|
-
mockApi({
|
|
504
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
505
|
-
return ({
|
|
506
|
-
status: 'in_progress',
|
|
507
|
-
results: [
|
|
508
|
-
Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()),
|
|
509
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-2' }),
|
|
510
|
-
],
|
|
511
|
-
});
|
|
512
|
-
}),
|
|
513
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () { return []; }),
|
|
514
|
-
});
|
|
515
|
-
const resultsPromise = (0, batch_1.waitForResults)(api, trigger, tests, {
|
|
516
|
-
batchTimeout: 120000,
|
|
517
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
518
|
-
failOnCriticalErrors: false,
|
|
519
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
520
|
-
}, fixtures_2.mockReporter);
|
|
521
|
-
// Wait for the 2 tests (initial)
|
|
522
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(1, [tests[0], tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id);
|
|
523
|
-
yield waiter.promise;
|
|
524
|
-
// Still waiting for 2 tests
|
|
525
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(2, [tests[0], tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id, 0);
|
|
526
|
-
// === STEP 2 === (batch 'in_progress')
|
|
527
|
-
waiter.start();
|
|
528
|
-
mockApi({
|
|
529
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
530
|
-
return ({
|
|
531
|
-
status: 'in_progress',
|
|
532
|
-
results: [
|
|
533
|
-
Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()),
|
|
534
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-2' }),
|
|
535
|
-
],
|
|
536
|
-
});
|
|
537
|
-
}),
|
|
538
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
539
|
-
throw (0, fixtures_1.getAxiosError)(404, { message: 'Test results not found' });
|
|
540
|
-
}),
|
|
541
|
-
});
|
|
542
|
-
yield waiter.promise;
|
|
543
|
-
// One result received
|
|
544
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenNthCalledWith(1, Object.assign(Object.assign({}, batch.results[0]), { status: 'passed' }));
|
|
545
|
-
// But not available
|
|
546
|
-
expect(fixtures_2.mockReporter.resultEnd).not.toHaveBeenCalled();
|
|
547
|
-
// Now waiting for 1 test
|
|
548
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(3, [tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id, 0);
|
|
549
|
-
// === STEP 3 === (batch 'in_progress')
|
|
550
|
-
waiter.start();
|
|
551
|
-
mockApi({
|
|
552
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
553
|
-
return ({
|
|
554
|
-
status: 'in_progress',
|
|
555
|
-
results: [
|
|
556
|
-
Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()),
|
|
557
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-2' }),
|
|
558
|
-
],
|
|
559
|
-
});
|
|
560
|
-
}),
|
|
561
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
562
|
-
return [
|
|
563
|
-
(0, deep_extend_1.default)({}, pollResult), // became available
|
|
564
|
-
];
|
|
565
|
-
}),
|
|
566
|
-
});
|
|
567
|
-
yield waiter.promise;
|
|
568
|
-
// Result 1 just became available, so it should be reported
|
|
569
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(1, result, fixtures_1.MOCK_BASE_URL, 'bid');
|
|
570
|
-
// Still waiting for 1 test
|
|
571
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenNthCalledWith(3, [tests[1]], fixtures_1.MOCK_BASE_URL, trigger.batch_id, 0);
|
|
572
|
-
mockApi({
|
|
573
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
574
|
-
return ({
|
|
575
|
-
status: 'passed',
|
|
576
|
-
results: [
|
|
577
|
-
Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()),
|
|
578
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { test_public_id: 'other-public-id', result_id: 'rid-2' }),
|
|
579
|
-
],
|
|
580
|
-
});
|
|
581
|
-
}),
|
|
582
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
583
|
-
throw (0, fixtures_1.getAxiosError)(404, { message: 'Test results not found' });
|
|
584
|
-
}),
|
|
585
|
-
});
|
|
586
|
-
expect(yield resultsPromise).toEqual([
|
|
587
|
-
result,
|
|
588
|
-
Object.assign(Object.assign({}, result), { resultId: 'rid-2', result: undefined, timestamp: 123, test: tests[1] }),
|
|
589
|
-
]);
|
|
590
|
-
// One result received
|
|
591
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenNthCalledWith(2, Object.assign(Object.assign({}, batch.results[0]), { status: 'passed', test_public_id: 'other-public-id', result_id: 'rid-2' }));
|
|
592
|
-
// Last result is reported without a poll result
|
|
593
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(2, Object.assign(Object.assign({}, result), { resultId: 'rid-2', result: undefined, test: tests[1], timestamp: 123 }), fixtures_1.MOCK_BASE_URL, 'bid');
|
|
594
|
-
expect(fixtures_2.mockReporter.error).toHaveBeenCalledWith('The information for result rid-2 of test other-public-id was incomplete at the end of the batch.\n\n');
|
|
595
|
-
// Do not report when there are no tests to wait anymore
|
|
596
|
-
expect(fixtures_2.mockReporter.testsWait).toHaveBeenCalledTimes(4);
|
|
597
|
-
}));
|
|
598
|
-
test('object in each result should be different even if they share the same public ID (config overrides)', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
599
|
-
mockApi({
|
|
600
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
601
|
-
return ({
|
|
602
|
-
results: [(0, fixtures_2.getPassedResultInBatch)(), Object.assign(Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), { result_id: '3' })],
|
|
603
|
-
status: 'passed',
|
|
604
|
-
});
|
|
605
|
-
}),
|
|
606
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
607
|
-
return [
|
|
608
|
-
(0, deep_extend_1.default)({}, pollResult),
|
|
609
|
-
// The test object from the second result has an overridden start URL
|
|
610
|
-
(0, deep_extend_1.default)({}, pollResult, { check: { config: { request: { url: 'https://reddit.com/' } } }, resultID: '3' }),
|
|
611
|
-
];
|
|
612
|
-
}),
|
|
613
|
-
});
|
|
614
|
-
const results = yield (0, batch_1.waitForResults)(api, trigger, [result.test, result.test], {
|
|
615
|
-
batchTimeout: 0,
|
|
616
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
617
|
-
failOnCriticalErrors: false,
|
|
618
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
619
|
-
}, fixtures_2.mockReporter);
|
|
620
|
-
expect(results.map(({ test }) => test.config.request.url)).toEqual(['http://fake.url', 'https://reddit.com/']);
|
|
621
|
-
}));
|
|
622
|
-
test('results should be timed out if the backend says so', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
623
|
-
mockApi({
|
|
624
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
625
|
-
return ({
|
|
626
|
-
status: 'failed',
|
|
627
|
-
results: [Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()), Object.assign(Object.assign({}, (0, fixtures_2.getFailedResultInBatch)()), { result_id: '3', timed_out: true })],
|
|
628
|
-
});
|
|
629
|
-
}),
|
|
630
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
631
|
-
return [
|
|
632
|
-
Object.assign(Object.assign({}, pollResult), { result: Object.assign({}, pollResult.result) }),
|
|
633
|
-
Object.assign(Object.assign({}, pollResult), { result: Object.assign({}, pollResult.result), resultID: '3' }),
|
|
634
|
-
];
|
|
635
|
-
}),
|
|
636
|
-
});
|
|
637
|
-
const expectedTimeoutResult = Object.assign(Object.assign({}, result), { result: Object.assign(Object.assign({}, result.result), { failure: { code: 'TIMEOUT', message: 'The batch timed out before receiving the result.' }, passed: false }), resultId: '3', timedOut: true });
|
|
638
|
-
expect(yield (0, batch_1.waitForResults)(api, trigger, [result.test, result.test], {
|
|
639
|
-
batchTimeout: 3000,
|
|
640
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
641
|
-
failOnCriticalErrors: false,
|
|
642
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
643
|
-
}, fixtures_2.mockReporter)).toEqual([result, expectedTimeoutResult]);
|
|
644
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenCalledTimes(2);
|
|
645
|
-
// `resultEnd` should return the same data as `waitForResults`
|
|
646
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(1, result, fixtures_1.MOCK_BASE_URL, 'bid');
|
|
647
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(2, expectedTimeoutResult, fixtures_1.MOCK_BASE_URL, 'bid');
|
|
648
|
-
// Failed directly.
|
|
649
|
-
expect(internalUtils.wait).toHaveBeenCalledTimes(0);
|
|
650
|
-
}));
|
|
651
|
-
test('results should be timed out with a different error if the backend did not say so', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
652
|
-
mockApi({
|
|
653
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
654
|
-
return ({
|
|
655
|
-
status: 'in_progress',
|
|
656
|
-
results: [
|
|
657
|
-
Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()),
|
|
658
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { result_id: '3' }),
|
|
659
|
-
],
|
|
660
|
-
});
|
|
661
|
-
}),
|
|
662
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
663
|
-
return [
|
|
664
|
-
Object.assign(Object.assign({}, pollResult), { result: Object.assign({}, pollResult.result) }),
|
|
665
|
-
Object.assign(Object.assign({}, pollResult), { result: Object.assign({}, pollResult.result), resultID: '3' }),
|
|
666
|
-
];
|
|
667
|
-
}),
|
|
668
|
-
});
|
|
669
|
-
const expectedDeadlineResult = Object.assign(Object.assign({}, result), { duration: 0, result: Object.assign(Object.assign({}, result.result), { failure: {
|
|
670
|
-
code: 'BATCH_TIMEOUT_RUNAWAY',
|
|
671
|
-
message: "The batch didn't timeout after the expected timeout period.",
|
|
672
|
-
}, passed: false }), resultId: '3', timedOut: true });
|
|
673
|
-
yield expect((0, batch_1.waitForResults)(api, trigger, [result.test, result.test], {
|
|
674
|
-
batchTimeout: 3000,
|
|
675
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
676
|
-
failOnCriticalErrors: false,
|
|
677
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
678
|
-
}, fixtures_2.mockReporter)).rejects.toThrow(new errors_1.BatchTimeoutRunawayError());
|
|
679
|
-
// Residual results are never 'received': we force-end them.
|
|
680
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenCalledTimes(1);
|
|
681
|
-
// `resultEnd` should return the same data as `waitForResults`
|
|
682
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(1, result, fixtures_1.MOCK_BASE_URL, 'bid');
|
|
683
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenNthCalledWith(2, expectedDeadlineResult, fixtures_1.MOCK_BASE_URL, 'bid');
|
|
684
|
-
// Initial wait + 3 polling cycles.
|
|
685
|
-
expect(internalUtils.wait).toHaveBeenCalledTimes(4);
|
|
686
|
-
}));
|
|
687
|
-
test('results failure should be ignored if timed out', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
688
|
-
// The original failure of a result received between timing out in batch poll
|
|
689
|
-
// and retrieving it should be ignored in favor of timeout.
|
|
690
|
-
mockApi({
|
|
691
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
692
|
-
return ({
|
|
693
|
-
status: 'failed',
|
|
694
|
-
results: [Object.assign(Object.assign({}, (0, fixtures_2.getFailedResultInBatch)()), { timed_out: true })],
|
|
695
|
-
});
|
|
696
|
-
}),
|
|
697
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
698
|
-
return [
|
|
699
|
-
Object.assign(Object.assign({}, pollResult), { passed: false, result: Object.assign(Object.assign({}, pollResult.result), { failure: { code: 'FAILURE', message: 'Original failure, should be ignored' }, passed: false }) }),
|
|
700
|
-
];
|
|
701
|
-
}),
|
|
702
|
-
});
|
|
703
|
-
expect(yield (0, batch_1.waitForResults)(api, trigger, [result.test], {
|
|
704
|
-
batchTimeout: 0,
|
|
705
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
706
|
-
failOnCriticalErrors: false,
|
|
707
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
708
|
-
}, fixtures_2.mockReporter)).toStrictEqual([
|
|
709
|
-
Object.assign(Object.assign({}, result), { result: Object.assign(Object.assign({}, result.result), { failure: { code: 'TIMEOUT', message: 'The batch timed out before receiving the result.' }, passed: false }), timedOut: true }),
|
|
710
|
-
]);
|
|
711
|
-
}));
|
|
712
|
-
test('results should be timed out if batch result is timed out', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
713
|
-
const batchWithTimeoutResult = Object.assign(Object.assign({}, batch), { results: [Object.assign(Object.assign({}, (0, fixtures_2.getFailedResultInBatch)()), { timed_out: true })] });
|
|
714
|
-
mockApi({ getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () { return batchWithTimeoutResult; }) });
|
|
715
|
-
expect(yield (0, batch_1.waitForResults)(api, trigger, [result.test], {
|
|
716
|
-
batchTimeout: 120000,
|
|
717
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
718
|
-
failOnCriticalErrors: false,
|
|
719
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
720
|
-
}, fixtures_2.mockReporter)).toEqual([
|
|
721
|
-
Object.assign(Object.assign({}, result), { result: Object.assign(Object.assign({}, result.result), { failure: { code: 'TIMEOUT', message: 'The batch timed out before receiving the result.' }, passed: false }), timedOut: true }),
|
|
722
|
-
]);
|
|
723
|
-
}));
|
|
724
|
-
test('wait between batch polling', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
725
|
-
const { getBatchMock } = mockApi({
|
|
726
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
727
|
-
return getBatchMock.mock.calls.length === 3 ? batch : Object.assign(Object.assign({}, batch), { status: 'in_progress' });
|
|
728
|
-
}),
|
|
729
|
-
});
|
|
730
|
-
expect(yield (0, batch_1.waitForResults)(api, trigger, [result.test], {
|
|
731
|
-
batchTimeout: 120000,
|
|
732
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
733
|
-
failOnCriticalErrors: false,
|
|
734
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
735
|
-
}, fixtures_2.mockReporter)).toEqual([result]);
|
|
736
|
-
expect(getBatchMock).toHaveBeenCalledTimes(3);
|
|
737
|
-
expect(internalUtils.wait).toHaveBeenCalledTimes(2);
|
|
738
|
-
}));
|
|
739
|
-
test('correct number of passed and timed out results', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
740
|
-
const pollTimeoutResult = Object.assign(Object.assign({}, (0, deep_extend_1.default)({}, pollResult)), { resultID: 'another-id' });
|
|
741
|
-
const batchWithTimeoutResult = Object.assign(Object.assign({}, batch), { results: [
|
|
742
|
-
Object.assign({}, (0, fixtures_2.getPassedResultInBatch)()),
|
|
743
|
-
Object.assign(Object.assign({}, (0, fixtures_2.getFailedResultInBatch)()), { timed_out: true, result_id: pollTimeoutResult.resultID }),
|
|
744
|
-
] });
|
|
745
|
-
mockApi({
|
|
746
|
-
getBatchImplementation: () => __awaiter(void 0, void 0, void 0, function* () { return batchWithTimeoutResult; }),
|
|
747
|
-
pollResultsImplementation: () => __awaiter(void 0, void 0, void 0, function* () { return [pollResult, pollTimeoutResult]; }),
|
|
748
|
-
});
|
|
749
|
-
expect(yield (0, batch_1.waitForResults)(api, trigger, [result.test], {
|
|
750
|
-
batchTimeout: 2000,
|
|
751
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
752
|
-
failOnCriticalErrors: false,
|
|
753
|
-
failOnTimeout: false,
|
|
754
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
755
|
-
}, fixtures_2.mockReporter)).toEqual([
|
|
756
|
-
Object.assign(Object.assign({}, result), { passed: true, timedOut: false }),
|
|
757
|
-
Object.assign(Object.assign({}, result), { passed: true, timedOut: true, resultId: pollTimeoutResult.resultID, result: Object.assign(Object.assign({}, result.result), { failure: {
|
|
758
|
-
code: 'TIMEOUT',
|
|
759
|
-
message: 'The batch timed out before receiving the result.',
|
|
760
|
-
}, passed: false }) }),
|
|
761
|
-
]);
|
|
762
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenCalledTimes(2);
|
|
763
|
-
expect(fixtures_2.mockReporter.resultEnd).toHaveBeenCalledTimes(2);
|
|
764
|
-
}));
|
|
765
|
-
test('tunnel failure', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
766
|
-
mockApi();
|
|
767
|
-
const mockTunnel = {
|
|
768
|
-
keepAlive: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
769
|
-
throw new Error('keepAlive failed');
|
|
770
|
-
}),
|
|
771
|
-
};
|
|
772
|
-
yield (0, batch_1.waitForResults)(api, trigger, [result.test], {
|
|
773
|
-
batchTimeout: 2000,
|
|
774
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
775
|
-
failOnCriticalErrors: true,
|
|
776
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
777
|
-
}, fixtures_2.mockReporter, mockTunnel);
|
|
778
|
-
expect(fixtures_2.mockReporter.error).toHaveBeenCalledWith('The tunnel has stopped working, this may have affected the results.');
|
|
779
|
-
}));
|
|
780
|
-
test('location when tunnel', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
781
|
-
mockApi();
|
|
782
|
-
const mockTunnel = { keepAlive: () => __awaiter(void 0, void 0, void 0, function* () { return true; }) };
|
|
783
|
-
let results = yield (0, batch_1.waitForResults)(api, trigger, [result.test], {
|
|
784
|
-
batchTimeout: 2000,
|
|
785
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
786
|
-
failOnCriticalErrors: true,
|
|
787
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
788
|
-
}, fixtures_2.mockReporter, mockTunnel);
|
|
789
|
-
expect(results[0].location).toBe('Tunneled');
|
|
790
|
-
const newTest = Object.assign({}, result.test);
|
|
791
|
-
newTest.type = 'api';
|
|
792
|
-
newTest.subtype = 'http';
|
|
793
|
-
results = yield (0, batch_1.waitForResults)(api, trigger, [newTest], {
|
|
794
|
-
batchTimeout: 2000,
|
|
795
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
796
|
-
failOnCriticalErrors: true,
|
|
797
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
798
|
-
}, fixtures_2.mockReporter, mockTunnel);
|
|
799
|
-
expect(results[0].location).toBe('Tunneled');
|
|
800
|
-
newTest.type = 'api';
|
|
801
|
-
newTest.subtype = 'ssl';
|
|
802
|
-
results = yield (0, batch_1.waitForResults)(api, trigger, [newTest], {
|
|
803
|
-
batchTimeout: 2000,
|
|
804
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
805
|
-
failOnCriticalErrors: true,
|
|
806
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
807
|
-
}, fixtures_2.mockReporter, mockTunnel);
|
|
808
|
-
expect(results[0].location).toBe('Frankfurt (AWS)');
|
|
809
|
-
}));
|
|
810
|
-
test('pollResults throws', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
811
|
-
const { pollResultsMock } = mockApi({
|
|
812
|
-
pollResultsImplementation: () => {
|
|
813
|
-
throw (0, fixtures_1.getAxiosError)(502, { message: 'Poll results server error' });
|
|
814
|
-
},
|
|
815
|
-
});
|
|
816
|
-
yield expect((0, batch_1.waitForResults)(api, trigger, [result.test], {
|
|
817
|
-
batchTimeout: 2000,
|
|
818
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
819
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
820
|
-
}, fixtures_2.mockReporter)).rejects.toThrow('Failed to poll results: could not query https://app.datadoghq.com/example\nPoll results server error\n');
|
|
821
|
-
expect(pollResultsMock).toHaveBeenCalledWith([result.resultId]);
|
|
822
|
-
}));
|
|
823
|
-
test('getBatch throws', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
824
|
-
const { getBatchMock } = mockApi({
|
|
825
|
-
getBatchImplementation: () => {
|
|
826
|
-
throw (0, fixtures_1.getAxiosError)(502, { message: 'Get batch server error' });
|
|
827
|
-
},
|
|
828
|
-
});
|
|
829
|
-
yield expect((0, batch_1.waitForResults)(api, trigger, [result.test], {
|
|
830
|
-
batchTimeout: 2000,
|
|
831
|
-
datadogSite: DEFAULT_COMMAND_CONFIG.datadogSite,
|
|
832
|
-
subdomain: DEFAULT_COMMAND_CONFIG.subdomain,
|
|
833
|
-
}, fixtures_2.mockReporter)).rejects.toThrow('Failed to get batch: could not query https://app.datadoghq.com/example\nGet batch server error\n');
|
|
834
|
-
expect(getBatchMock).toHaveBeenCalledWith(trigger.batch_id);
|
|
835
|
-
}));
|
|
836
|
-
});
|
|
837
|
-
describe('getResultsToReport', () => {
|
|
838
|
-
test.each([false])('timed out retry - shouldContinuePolling=%s', (shouldContinuePolling) => {
|
|
839
|
-
const timedOutRetry = Object.assign(Object.assign({}, (0, fixtures_2.getFailedResultInBatch)()), { retries: 0, max_retries: 1, timed_out: true });
|
|
840
|
-
const batch = {
|
|
841
|
-
status: 'failed',
|
|
842
|
-
results: [timedOutRetry],
|
|
843
|
-
};
|
|
844
|
-
const resultsToReport = (0, batch_1.getResultsToReport)(shouldContinuePolling, batch, [], new Set(['rid']), new Set(), new Set(), fixtures_2.mockReporter);
|
|
845
|
-
expect(resultsToReport).toStrictEqual([timedOutRetry]);
|
|
846
|
-
});
|
|
847
|
-
test.each([false])('timed out retry never emitted before - shouldContinuePolling=%s', (shouldContinuePolling) => {
|
|
848
|
-
const timedOutRetry = Object.assign(Object.assign({}, (0, fixtures_2.getFailedResultInBatch)()), { retries: 0, max_retries: 1, timed_out: true });
|
|
849
|
-
const batch = {
|
|
850
|
-
status: 'failed',
|
|
851
|
-
results: [timedOutRetry],
|
|
852
|
-
};
|
|
853
|
-
const resultsToReport = (0, batch_1.getResultsToReport)(shouldContinuePolling, batch, [timedOutRetry], new Set(), new Set(), new Set(), fixtures_2.mockReporter);
|
|
854
|
-
expect(resultsToReport).toStrictEqual([timedOutRetry]);
|
|
855
|
-
});
|
|
856
|
-
});
|
|
857
|
-
describe('reportReceivedResults', () => {
|
|
858
|
-
test('skipped', () => {
|
|
859
|
-
const skippedResult = (0, fixtures_2.getSkippedResultInBatch)();
|
|
860
|
-
const batch = {
|
|
861
|
-
status: 'failed',
|
|
862
|
-
results: [skippedResult],
|
|
863
|
-
};
|
|
864
|
-
const emittedResultIds = new Set();
|
|
865
|
-
const receivedResults = (0, batch_1.reportReceivedResults)(batch, emittedResultIds, fixtures_2.mockReporter);
|
|
866
|
-
expect(receivedResults).toStrictEqual([skippedResult]);
|
|
867
|
-
expect(emittedResultIds).toContain('skipped-0');
|
|
868
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenCalledWith(skippedResult);
|
|
869
|
-
});
|
|
870
|
-
test('final', () => {
|
|
871
|
-
const result = (0, fixtures_2.getPassedResultInBatch)();
|
|
872
|
-
const batch = {
|
|
873
|
-
status: 'passed',
|
|
874
|
-
results: [result],
|
|
875
|
-
};
|
|
876
|
-
const emittedResultIds = new Set();
|
|
877
|
-
const receivedResults = (0, batch_1.reportReceivedResults)(batch, emittedResultIds, fixtures_2.mockReporter);
|
|
878
|
-
expect(receivedResults).toStrictEqual([result]);
|
|
879
|
-
expect(emittedResultIds).toContain('rid');
|
|
880
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenCalledWith(result);
|
|
881
|
-
});
|
|
882
|
-
test('non final', () => {
|
|
883
|
-
const result = Object.assign(Object.assign({}, (0, fixtures_2.getInProgressResultInBatch)()), { retries: 0, max_retries: 1 });
|
|
884
|
-
const batch = {
|
|
885
|
-
status: 'in_progress',
|
|
886
|
-
results: [result],
|
|
887
|
-
};
|
|
888
|
-
const emittedResultIds = new Set();
|
|
889
|
-
const receivedResults = (0, batch_1.reportReceivedResults)(batch, emittedResultIds, fixtures_2.mockReporter);
|
|
890
|
-
expect(receivedResults).toStrictEqual([result]);
|
|
891
|
-
expect(emittedResultIds).toContain('rid');
|
|
892
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenCalledWith(result);
|
|
893
|
-
});
|
|
894
|
-
test('timed out', () => {
|
|
895
|
-
const timedOut = Object.assign(Object.assign({}, (0, fixtures_2.getFailedResultInBatch)()), { timed_out: true });
|
|
896
|
-
const batch = {
|
|
897
|
-
status: 'failed',
|
|
898
|
-
results: [timedOut],
|
|
899
|
-
};
|
|
900
|
-
const emittedResultIds = new Set();
|
|
901
|
-
const receivedResults = (0, batch_1.reportReceivedResults)(batch, emittedResultIds, fixtures_2.mockReporter);
|
|
902
|
-
expect(receivedResults).toStrictEqual([timedOut]);
|
|
903
|
-
expect(emittedResultIds).toContain('rid');
|
|
904
|
-
expect(fixtures_2.mockReporter.resultReceived).toHaveBeenCalledWith(timedOut);
|
|
905
|
-
});
|
|
906
|
-
});
|
|
907
|
-
//# sourceMappingURL=batch.test.js.map
|