@datadog/datadog-ci 3.2.0 → 3.3.1
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/README.md +3 -0
- package/dist/__tests__/cli.test.js +1 -0
- package/dist/__tests__/cli.test.js.map +1 -1
- package/dist/commands/dora/__tests__/deployment.test.js +2 -0
- package/dist/commands/dora/__tests__/deployment.test.js.map +1 -1
- package/dist/commands/dora/api.js +3 -0
- package/dist/commands/dora/api.js.map +1 -1
- package/dist/commands/dora/deployment.d.ts +1 -0
- package/dist/commands/dora/deployment.js +8 -1
- package/dist/commands/dora/deployment.js.map +1 -1
- package/dist/commands/dora/interfaces.d.ts +1 -0
- package/dist/commands/elf-symbols/__tests__/elf.test.js +12 -9
- package/dist/commands/elf-symbols/__tests__/elf.test.js.map +1 -1
- package/dist/commands/elf-symbols/__tests__/upload.test.js +9 -5
- package/dist/commands/elf-symbols/__tests__/upload.test.js.map +1 -1
- package/dist/commands/elf-symbols/elf.d.ts +2 -11
- package/dist/commands/elf-symbols/elf.js +52 -68
- package/dist/commands/elf-symbols/elf.js.map +1 -1
- package/dist/commands/elf-symbols/upload.js +3 -3
- package/dist/commands/elf-symbols/upload.js.map +1 -1
- package/dist/commands/pe-symbols/__tests__/pe.test.d.ts +1 -0
- package/dist/commands/pe-symbols/__tests__/pe.test.js +81 -0
- package/dist/commands/pe-symbols/__tests__/pe.test.js.map +1 -0
- package/dist/commands/pe-symbols/cli.d.ts +1 -0
- package/dist/commands/pe-symbols/cli.js +5 -0
- package/dist/commands/pe-symbols/cli.js.map +1 -0
- package/dist/commands/pe-symbols/helpers.d.ts +4 -0
- package/dist/commands/pe-symbols/helpers.js +30 -0
- package/dist/commands/pe-symbols/helpers.js.map +1 -0
- package/dist/commands/pe-symbols/interfaces.d.ts +17 -0
- package/dist/commands/pe-symbols/interfaces.js +7 -0
- package/dist/commands/pe-symbols/interfaces.js.map +1 -0
- package/dist/commands/pe-symbols/pe-constants.d.ts +51 -0
- package/dist/commands/pe-symbols/pe-constants.js +160 -0
- package/dist/commands/pe-symbols/pe-constants.js.map +1 -0
- package/dist/commands/pe-symbols/pe.d.ts +35 -0
- package/dist/commands/pe-symbols/pe.js +248 -0
- package/dist/commands/pe-symbols/pe.js.map +1 -0
- package/dist/commands/pe-symbols/renderer.d.ts +19 -0
- package/dist/commands/pe-symbols/renderer.js +87 -0
- package/dist/commands/pe-symbols/renderer.js.map +1 -0
- package/dist/commands/pe-symbols/upload.d.ts +32 -0
- package/dist/commands/pe-symbols/upload.js +412 -0
- package/dist/commands/pe-symbols/upload.js.map +1 -0
- package/dist/commands/sbom/__tests__/payload.test.js +88 -26
- package/dist/commands/sbom/__tests__/payload.test.js.map +1 -1
- package/dist/commands/sbom/payload.js +44 -0
- package/dist/commands/sbom/payload.js.map +1 -1
- package/dist/commands/sbom/types.d.ts +4 -0
- package/dist/commands/synthetics/__tests__/api.test.js +2 -2
- package/dist/commands/synthetics/__tests__/api.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/batch.test.js +38 -37
- package/dist/commands/synthetics/__tests__/batch.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/build-and-test.test.d.ts +1 -0
- package/dist/commands/synthetics/__tests__/build-and-test.test.js +133 -0
- package/dist/commands/synthetics/__tests__/build-and-test.test.js.map +1 -0
- package/dist/commands/synthetics/__tests__/cli.test.js +83 -47
- package/dist/commands/synthetics/__tests__/cli.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.js +2 -2
- package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/import-tests-lib.test.js +4 -4
- package/dist/commands/synthetics/__tests__/import-tests-lib.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/test.test.js +6 -7
- package/dist/commands/synthetics/__tests__/test.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js +1 -1
- package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/utils/public.test.js +8 -7
- package/dist/commands/synthetics/__tests__/utils/public.test.js.map +1 -1
- package/dist/commands/synthetics/api.js +2 -2
- package/dist/commands/synthetics/api.js.map +1 -1
- package/dist/commands/synthetics/base-command.d.ts +29 -0
- package/dist/commands/synthetics/base-command.js +125 -0
- package/dist/commands/synthetics/base-command.js.map +1 -0
- package/dist/commands/synthetics/batch.d.ts +1 -0
- package/dist/commands/synthetics/batch.js +3 -3
- package/dist/commands/synthetics/batch.js.map +1 -1
- package/dist/commands/synthetics/build-and-test.d.ts +8 -0
- package/dist/commands/synthetics/build-and-test.js +102 -0
- package/dist/commands/synthetics/build-and-test.js.map +1 -0
- package/dist/commands/synthetics/deploy-tests-command.d.ts +8 -16
- package/dist/commands/synthetics/deploy-tests-command.js +19 -91
- package/dist/commands/synthetics/deploy-tests-command.js.map +1 -1
- package/dist/commands/synthetics/import-tests-command.d.ts +6 -14
- package/dist/commands/synthetics/import-tests-command.js +15 -83
- package/dist/commands/synthetics/import-tests-command.js.map +1 -1
- package/dist/commands/synthetics/index.d.ts +1 -1
- package/dist/commands/synthetics/index.js +6 -6
- package/dist/commands/synthetics/index.js.map +1 -1
- package/dist/commands/synthetics/interfaces.d.ts +5 -2
- package/dist/commands/synthetics/run-tests-command.d.ts +12 -17
- package/dist/commands/synthetics/run-tests-command.js +133 -190
- package/dist/commands/synthetics/run-tests-command.js.map +1 -1
- package/dist/commands/synthetics/run-tests-lib.d.ts +1 -0
- package/dist/commands/synthetics/run-tests-lib.js +8 -4
- package/dist/commands/synthetics/run-tests-lib.js.map +1 -1
- package/dist/commands/synthetics/test.d.ts +2 -0
- package/dist/commands/synthetics/test.js +9 -8
- package/dist/commands/synthetics/test.js.map +1 -1
- package/dist/commands/synthetics/upload-application-command.d.ts +6 -13
- package/dist/commands/synthetics/upload-application-command.js +22 -87
- package/dist/commands/synthetics/upload-application-command.js.map +1 -1
- package/dist/commands/synthetics/utils/internal.d.ts +2 -0
- package/dist/commands/synthetics/utils/internal.js +15 -1
- package/dist/commands/synthetics/utils/internal.js.map +1 -1
- package/dist/helpers/ci.d.ts +2 -0
- package/dist/helpers/filereader.d.ts +21 -0
- package/dist/helpers/filereader.js +59 -0
- package/dist/helpers/filereader.js.map +1 -0
- package/dist/helpers/interfaces.d.ts +2 -2
- package/dist/helpers/tags.d.ts +2 -0
- package/dist/helpers/tags.js +4 -1
- package/dist/helpers/tags.js.map +1 -1
- package/dist/helpers/utils.d.ts +1 -0
- package/dist/helpers/utils.js +14 -1
- package/dist/helpers/utils.js.map +1 -1
- package/package.json +3 -2
|
@@ -49,8 +49,10 @@ const env_1 = require("../../../helpers/env");
|
|
|
49
49
|
const ciUtils = __importStar(require("../../../helpers/utils"));
|
|
50
50
|
const api = __importStar(require("../api"));
|
|
51
51
|
const deploy_tests_command_1 = require("../deploy-tests-command");
|
|
52
|
+
const errors_1 = require("../errors");
|
|
52
53
|
const import_tests_command_1 = require("../import-tests-command");
|
|
53
54
|
const interfaces_1 = require("../interfaces");
|
|
55
|
+
const mobile = __importStar(require("../mobile"));
|
|
54
56
|
const run_tests_command_1 = require("../run-tests-command");
|
|
55
57
|
const testUtils = __importStar(require("../test"));
|
|
56
58
|
const upload_application_command_1 = require("../upload-application-command");
|
|
@@ -98,6 +100,7 @@ describe('run-tests', () => {
|
|
|
98
100
|
DATADOG_SITE: 'datadoghq.eu',
|
|
99
101
|
DATADOG_SUBDOMAIN: 'custom',
|
|
100
102
|
DATADOG_SYNTHETICS_BATCH_TIMEOUT: '1',
|
|
103
|
+
DATADOG_SYNTHETICS_BUILD_COMMAND: 'build-command',
|
|
101
104
|
DATADOG_SYNTHETICS_CONFIG_PATH: 'path/to/config.json',
|
|
102
105
|
DATADOG_SYNTHETICS_FAIL_ON_CRITICAL_ERRORS: 'false',
|
|
103
106
|
DATADOG_SYNTHETICS_FAIL_ON_MISSING_TESTS: 'false',
|
|
@@ -135,7 +138,7 @@ describe('run-tests', () => {
|
|
|
135
138
|
process.env = overrideEnv;
|
|
136
139
|
const command = (0, fixtures_1.createCommand)(run_tests_command_1.RunTestsCommand);
|
|
137
140
|
yield command['resolveConfig']();
|
|
138
|
-
expect(command['config']).toEqual(Object.assign(Object.assign({}, run_tests_command_1.
|
|
141
|
+
expect(command['config']).toEqual(Object.assign(Object.assign({}, run_tests_command_1.RunTestsCommand.getDefaultConfig()), { apiKey: overrideEnv.DATADOG_API_KEY, appKey: overrideEnv.DATADOG_APP_KEY, batchTimeout: 1, buildCommand: overrideEnv.DATADOG_SYNTHETICS_BUILD_COMMAND, configPath: overrideEnv.DATADOG_SYNTHETICS_CONFIG_PATH, datadogSite: overrideEnv.DATADOG_SITE, defaultTestOverrides: {
|
|
139
142
|
allowInsecureCertificates: (0, env_1.toBoolean)(overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_ALLOW_INSECURE_CERTIFICATES),
|
|
140
143
|
basicAuth: {
|
|
141
144
|
password: overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_BASIC_AUTH_PASSWORD,
|
|
@@ -190,6 +193,7 @@ describe('run-tests', () => {
|
|
|
190
193
|
apiKey: 'fake_api_key',
|
|
191
194
|
appKey: 'fake_app_key',
|
|
192
195
|
batchTimeout: 1,
|
|
196
|
+
buildCommand: 'build-command',
|
|
193
197
|
configPath: 'src/commands/synthetics/__tests__/config-fixtures/config-with-all-keys.json',
|
|
194
198
|
datadogSite: 'datadoghq.eu',
|
|
195
199
|
defaultTestOverrides: {
|
|
@@ -238,7 +242,7 @@ describe('run-tests', () => {
|
|
|
238
242
|
tunnel: true,
|
|
239
243
|
};
|
|
240
244
|
const command = (0, fixtures_1.createCommand)(run_tests_command_1.RunTestsCommand);
|
|
241
|
-
command
|
|
245
|
+
command['configPath'] = 'src/commands/synthetics/__tests__/config-fixtures/config-with-all-keys.json';
|
|
242
246
|
yield command['resolveConfig']();
|
|
243
247
|
expect(command['config']).toEqual(expectedConfig);
|
|
244
248
|
}));
|
|
@@ -338,7 +342,7 @@ describe('run-tests', () => {
|
|
|
338
342
|
`variables.var2=${(_l = defaultTestOverrides.variables) === null || _l === void 0 ? void 0 : _l.var2}`,
|
|
339
343
|
];
|
|
340
344
|
yield command['resolveConfig']();
|
|
341
|
-
expect(command['config']).toEqual(Object.assign(Object.assign({}, run_tests_command_1.
|
|
345
|
+
expect(command['config']).toEqual(Object.assign(Object.assign({}, run_tests_command_1.RunTestsCommand.getDefaultConfig()), { apiKey: 'fake_api_key', appKey: 'fake_app_key', batchTimeout: 1, configPath: 'src/commands/synthetics/__tests__/config-fixtures/empty-config-file.json', datadogSite: 'datadoghq.eu', defaultTestOverrides: {
|
|
342
346
|
allowInsecureCertificates: true,
|
|
343
347
|
basicAuth: {
|
|
344
348
|
password: 'password',
|
|
@@ -390,6 +394,7 @@ describe('run-tests', () => {
|
|
|
390
394
|
const configFile = {
|
|
391
395
|
apiKey: 'config_file_api_key',
|
|
392
396
|
appKey: 'config_file_app_key',
|
|
397
|
+
buildCommand: 'build-command',
|
|
393
398
|
datadogSite: 'us3.datadoghq.com',
|
|
394
399
|
defaultTestOverrides: {
|
|
395
400
|
allowInsecureCertificates: true,
|
|
@@ -440,6 +445,7 @@ describe('run-tests', () => {
|
|
|
440
445
|
DATADOG_SITE: 'us5.datadoghq.com',
|
|
441
446
|
DATADOG_SUBDOMAIN: 'subdomain_from_env',
|
|
442
447
|
DATADOG_SYNTHETICS_BATCH_TIMEOUT: '1',
|
|
448
|
+
DATADOG_SYNTHETICS_BUILD_COMMAND: 'build-command',
|
|
443
449
|
DATADOG_SYNTHETICS_CONFIG_PATH: 'path/to/config_from_env.json',
|
|
444
450
|
DATADOG_SYNTHETICS_FAIL_ON_CRITICAL_ERRORS: 'true',
|
|
445
451
|
DATADOG_SYNTHETICS_FAIL_ON_MISSING_TESTS: 'true',
|
|
@@ -478,6 +484,7 @@ describe('run-tests', () => {
|
|
|
478
484
|
apiKey: overrideEnv.DATADOG_API_KEY,
|
|
479
485
|
appKey: overrideEnv.DATADOG_APP_KEY,
|
|
480
486
|
batchTimeout: (0, env_1.toNumber)(overrideEnv.DATADOG_SYNTHETICS_BATCH_TIMEOUT),
|
|
487
|
+
buildCommand: overrideEnv.DATADOG_SYNTHETICS_BUILD_COMMAND,
|
|
481
488
|
configPath: overrideEnv.DATADOG_SYNTHETICS_CONFIG_PATH,
|
|
482
489
|
datadogSite: overrideEnv.DATADOG_SITE,
|
|
483
490
|
defaultTestOverrides: {
|
|
@@ -500,7 +507,7 @@ describe('run-tests', () => {
|
|
|
500
507
|
deviceIds: overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_DEVICE_IDS.split(';'),
|
|
501
508
|
executionRule: (0, internal_1.toExecutionRule)(overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_EXECUTION_RULE),
|
|
502
509
|
followRedirects: (0, env_1.toBoolean)(overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_FOLLOW_REDIRECTS),
|
|
503
|
-
headers: (0, env_1.toStringMap)(overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_HEADERS),
|
|
510
|
+
headers: Object.assign(Object.assign({}, configFile.defaultTestOverrides.headers), (0, env_1.toStringMap)(overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_HEADERS)),
|
|
504
511
|
locations: overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_LOCATIONS.split(';'),
|
|
505
512
|
mobileApplicationVersion: overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_MOBILE_APPLICATION_VERSION,
|
|
506
513
|
resourceUrlSubstitutionRegexes: (_a = overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_RESOURCE_URL_SUBSTITUTION_REGEXES) === null || _a === void 0 ? void 0 : _a.split(';'),
|
|
@@ -511,7 +518,7 @@ describe('run-tests', () => {
|
|
|
511
518
|
startUrl: overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_START_URL,
|
|
512
519
|
startUrlSubstitutionRegex: overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_START_URL_SUBSTITUTION_REGEX,
|
|
513
520
|
testTimeout: (0, env_1.toNumber)(overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_TEST_TIMEOUT),
|
|
514
|
-
variables: (0, env_1.toStringMap)(overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_VARIABLES),
|
|
521
|
+
variables: Object.assign(Object.assign({}, configFile.defaultTestOverrides.variables), (0, env_1.toStringMap)(overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_VARIABLES)),
|
|
515
522
|
// XXX: Added to make the test pass as we don't have an ENV variable for `mobileApplicationVersionFilePath`.
|
|
516
523
|
mobileApplicationVersionFilePath: configFile.defaultTestOverrides.mobileApplicationVersionFilePath,
|
|
517
524
|
},
|
|
@@ -534,7 +541,7 @@ describe('run-tests', () => {
|
|
|
534
541
|
expect(command['config']).toEqual(expectedEnvOverrideResult);
|
|
535
542
|
}));
|
|
536
543
|
test('config file < CLI', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
537
|
-
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
544
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
538
545
|
jest.spyOn(ciUtils, 'resolveConfigFromFile').mockImplementationOnce((baseConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
539
546
|
return (Object.assign(Object.assign({}, baseConfig), configFile));
|
|
540
547
|
}));
|
|
@@ -542,6 +549,7 @@ describe('run-tests', () => {
|
|
|
542
549
|
apiKey: 'cli_api_key',
|
|
543
550
|
appKey: 'cli_app_key',
|
|
544
551
|
batchTimeout: 1,
|
|
552
|
+
buildCommand: 'build-command',
|
|
545
553
|
configPath: 'src/commands/synthetics/__tests__/config-fixtures/empty-config-file-from-cli.json',
|
|
546
554
|
datadogSite: 'datadoghq.eu',
|
|
547
555
|
failOnCriticalErrors: true,
|
|
@@ -597,6 +605,7 @@ describe('run-tests', () => {
|
|
|
597
605
|
command['apiKey'] = overrideCLI.apiKey;
|
|
598
606
|
command['appKey'] = overrideCLI.appKey;
|
|
599
607
|
command['batchTimeout'] = overrideCLI.batchTimeout;
|
|
608
|
+
command['buildCommand'] = overrideCLI.buildCommand;
|
|
600
609
|
command['configPath'] = overrideCLI.configPath;
|
|
601
610
|
command['datadogSite'] = overrideCLI.datadogSite;
|
|
602
611
|
command['failOnCriticalErrors'] = overrideCLI.failOnCriticalErrors;
|
|
@@ -625,25 +634,25 @@ describe('run-tests', () => {
|
|
|
625
634
|
`deviceIds=${(_f = defaultTestOverrides.deviceIds) === null || _f === void 0 ? void 0 : _f.join(';')}`,
|
|
626
635
|
`executionRule=${defaultTestOverrides.executionRule}`,
|
|
627
636
|
`followRedirects=${defaultTestOverrides.followRedirects}`,
|
|
628
|
-
`headers.Content-Type=${defaultTestOverrides.headers ?
|
|
629
|
-
`headers.Authorization=${(
|
|
630
|
-
`locations=${(
|
|
631
|
-
`retry.count=${(
|
|
632
|
-
`retry.interval=${(
|
|
637
|
+
`headers.Content-Type=${(_g = defaultTestOverrides.headers) === null || _g === void 0 ? void 0 : _g['Content-Type']}`,
|
|
638
|
+
`headers.Authorization=${(_h = defaultTestOverrides.headers) === null || _h === void 0 ? void 0 : _h.Authorization}`,
|
|
639
|
+
`locations=${(_j = defaultTestOverrides.locations) === null || _j === void 0 ? void 0 : _j.join(';')}`,
|
|
640
|
+
`retry.count=${(_k = defaultTestOverrides.retry) === null || _k === void 0 ? void 0 : _k.count}`,
|
|
641
|
+
`retry.interval=${(_l = defaultTestOverrides.retry) === null || _l === void 0 ? void 0 : _l.interval}`,
|
|
633
642
|
`startUrl=${defaultTestOverrides.startUrl}`,
|
|
634
643
|
`startUrlSubstitutionRegex=${defaultTestOverrides.startUrlSubstitutionRegex}`,
|
|
635
644
|
`testTimeout=${defaultTestOverrides.testTimeout}`,
|
|
636
|
-
`resourceUrlSubstitutionRegexes=${(
|
|
637
|
-
`variables.cliVar1=${(
|
|
638
|
-
`variables.cliVar2=${(
|
|
645
|
+
`resourceUrlSubstitutionRegexes=${(_m = defaultTestOverrides.resourceUrlSubstitutionRegexes) === null || _m === void 0 ? void 0 : _m.join(';')}`,
|
|
646
|
+
`variables.cliVar1=${(_o = defaultTestOverrides.variables) === null || _o === void 0 ? void 0 : _o.cliVar1}`,
|
|
647
|
+
`variables.cliVar2=${(_p = defaultTestOverrides.variables) === null || _p === void 0 ? void 0 : _p.cliVar2}`,
|
|
639
648
|
];
|
|
640
649
|
yield command['resolveConfig']();
|
|
641
650
|
const { mobileApplicationVersionFilePath } = overrideCLI, filteredOverrideCLI = __rest(overrideCLI, ["mobileApplicationVersionFilePath"]);
|
|
642
|
-
const expectedCLIOverrideResult = Object.assign(Object.assign({}, filteredOverrideCLI), { defaultTestOverrides: Object.assign(Object.assign({}, defaultTestOverrides), { mobileApplicationVersionFilePath }), proxy: configFile.proxy });
|
|
651
|
+
const expectedCLIOverrideResult = Object.assign(Object.assign({}, filteredOverrideCLI), { defaultTestOverrides: Object.assign(Object.assign({}, defaultTestOverrides), { headers: Object.assign(Object.assign({}, configFile.defaultTestOverrides.headers), defaultTestOverrides.headers), mobileApplicationVersionFilePath, variables: Object.assign(Object.assign({}, configFile.defaultTestOverrides.variables), defaultTestOverrides.variables) }), proxy: configFile.proxy });
|
|
643
652
|
expect(command['config']).toEqual(expectedCLIOverrideResult);
|
|
644
653
|
}));
|
|
645
654
|
test('ENV < CLI', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
646
|
-
var
|
|
655
|
+
var _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
647
656
|
jest.spyOn(ciUtils, 'resolveConfigFromFile').mockImplementationOnce((baseConfig) => __awaiter(void 0, void 0, void 0, function* () { return baseConfig; }));
|
|
648
657
|
const overrideEnv = {
|
|
649
658
|
DATADOG_API_KEY: 'env_api_key',
|
|
@@ -651,6 +660,7 @@ describe('run-tests', () => {
|
|
|
651
660
|
DATADOG_SITE: 'us5.datadoghq.com',
|
|
652
661
|
DATADOG_SYNTHETICS_CONFIG_PATH: 'path/to/config_from_env.json',
|
|
653
662
|
DATADOG_SUBDOMAIN: 'subdomain_from_env',
|
|
663
|
+
DATADOG_SYNTHETICS_BUILD_COMMAND: 'default-build-command',
|
|
654
664
|
DATADOG_SYNTHETICS_FAIL_ON_CRITICAL_ERRORS: 'true',
|
|
655
665
|
DATADOG_SYNTHETICS_FAIL_ON_MISSING_TESTS: 'true',
|
|
656
666
|
DATADOG_SYNTHETICS_FAIL_ON_TIMEOUT: 'true',
|
|
@@ -688,6 +698,7 @@ describe('run-tests', () => {
|
|
|
688
698
|
apiKey: 'cli_api_key',
|
|
689
699
|
appKey: 'cli_app_key',
|
|
690
700
|
batchTimeout: 1,
|
|
701
|
+
buildCommand: 'build-command',
|
|
691
702
|
configPath: 'path/to/config_from_cli.json',
|
|
692
703
|
datadogSite: 'datadoghq.eu',
|
|
693
704
|
failOnCriticalErrors: false,
|
|
@@ -744,6 +755,7 @@ describe('run-tests', () => {
|
|
|
744
755
|
command['apiKey'] = overrideCLI.apiKey;
|
|
745
756
|
command['appKey'] = overrideCLI.appKey;
|
|
746
757
|
command['batchTimeout'] = overrideCLI.batchTimeout;
|
|
758
|
+
command['buildCommand'] = overrideCLI.buildCommand;
|
|
747
759
|
command['configPath'] = overrideCLI.configPath;
|
|
748
760
|
command['datadogSite'] = overrideCLI.datadogSite;
|
|
749
761
|
command['failOnCriticalErrors'] = overrideCLI.failOnCriticalErrors;
|
|
@@ -760,8 +772,8 @@ describe('run-tests', () => {
|
|
|
760
772
|
command['testSearchQuery'] = overrideCLI.testSearchQuery;
|
|
761
773
|
command['overrides'] = [
|
|
762
774
|
`allowInsecureCertificates=${defaultTestOverrides.allowInsecureCertificates}`,
|
|
763
|
-
`basicAuth.password=${(
|
|
764
|
-
`basicAuth.username=${(
|
|
775
|
+
`basicAuth.password=${(_q = defaultTestOverrides.basicAuth) === null || _q === void 0 ? void 0 : _q.password}`,
|
|
776
|
+
`basicAuth.username=${(_r = defaultTestOverrides.basicAuth) === null || _r === void 0 ? void 0 : _r.username}`,
|
|
765
777
|
`body=${defaultTestOverrides.body}`,
|
|
766
778
|
`bodyType=${defaultTestOverrides.bodyType}`,
|
|
767
779
|
`cookies=${defaultTestOverrides.cookies.value}`,
|
|
@@ -769,24 +781,24 @@ describe('run-tests', () => {
|
|
|
769
781
|
`setCookies=${defaultTestOverrides.setCookies.value}`,
|
|
770
782
|
`setCookies.append=${defaultTestOverrides.setCookies.append}`,
|
|
771
783
|
`defaultStepTimeout=${defaultTestOverrides.defaultStepTimeout}`,
|
|
772
|
-
`deviceIds=${(
|
|
784
|
+
`deviceIds=${(_s = defaultTestOverrides.deviceIds) === null || _s === void 0 ? void 0 : _s.join(';')}`,
|
|
773
785
|
`executionRule=${defaultTestOverrides.executionRule}`,
|
|
774
786
|
`followRedirects=${defaultTestOverrides.followRedirects}`,
|
|
775
787
|
`headers.Content-Type=${defaultTestOverrides.headers ? defaultTestOverrides.headers['Content-Type'] : ''}`,
|
|
776
|
-
`headers.Authorization=${(
|
|
777
|
-
`locations=${(
|
|
778
|
-
`retry.count=${(
|
|
779
|
-
`retry.interval=${(
|
|
788
|
+
`headers.Authorization=${(_t = defaultTestOverrides.headers) === null || _t === void 0 ? void 0 : _t.Authorization}`,
|
|
789
|
+
`locations=${(_u = defaultTestOverrides.locations) === null || _u === void 0 ? void 0 : _u.join(';')}`,
|
|
790
|
+
`retry.count=${(_v = defaultTestOverrides.retry) === null || _v === void 0 ? void 0 : _v.count}`,
|
|
791
|
+
`retry.interval=${(_w = defaultTestOverrides.retry) === null || _w === void 0 ? void 0 : _w.interval}`,
|
|
780
792
|
`startUrl=${defaultTestOverrides.startUrl}`,
|
|
781
793
|
`startUrlSubstitutionRegex=${defaultTestOverrides.startUrlSubstitutionRegex}`,
|
|
782
794
|
`testTimeout=${defaultTestOverrides.testTimeout}`,
|
|
783
|
-
`resourceUrlSubstitutionRegexes=${(
|
|
784
|
-
`variables.cliVar1=${(
|
|
785
|
-
`variables.cliVar2=${(
|
|
795
|
+
`resourceUrlSubstitutionRegexes=${(_x = defaultTestOverrides.resourceUrlSubstitutionRegexes) === null || _x === void 0 ? void 0 : _x.join(';')}`,
|
|
796
|
+
`variables.cliVar1=${(_y = defaultTestOverrides.variables) === null || _y === void 0 ? void 0 : _y.cliVar1}`,
|
|
797
|
+
`variables.cliVar2=${(_z = defaultTestOverrides.variables) === null || _z === void 0 ? void 0 : _z.cliVar2}`,
|
|
786
798
|
];
|
|
787
799
|
yield command['resolveConfig']();
|
|
788
800
|
const { mobileApplicationVersionFilePath } = overrideCLI, filteredOverrideCLI = __rest(overrideCLI, ["mobileApplicationVersionFilePath"]);
|
|
789
|
-
const expectedCLIOverrideResult = Object.assign(Object.assign({}, filteredOverrideCLI), { defaultTestOverrides: Object.assign(Object.assign({}, defaultTestOverrides), { mobileApplicationVersionFilePath }), proxy: { protocol: 'http' } });
|
|
801
|
+
const expectedCLIOverrideResult = Object.assign(Object.assign({}, filteredOverrideCLI), { defaultTestOverrides: Object.assign(Object.assign({}, defaultTestOverrides), { headers: Object.assign(Object.assign({}, (0, env_1.toStringMap)(overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_HEADERS)), defaultTestOverrides.headers), mobileApplicationVersionFilePath, variables: Object.assign(Object.assign({}, (0, env_1.toStringMap)(overrideEnv.DATADOG_SYNTHETICS_OVERRIDE_VARIABLES)), defaultTestOverrides.variables) }), proxy: { protocol: 'http' } });
|
|
790
802
|
expect(command['config']).toEqual(expectedCLIOverrideResult);
|
|
791
803
|
}));
|
|
792
804
|
const overrideTestConfig = {
|
|
@@ -899,7 +911,7 @@ describe('run-tests', () => {
|
|
|
899
911
|
expect(getTestsToTriggerMock).toHaveBeenNthCalledWith(1, ...getExpectedTestsToTriggerArguments(overrideTestConfig));
|
|
900
912
|
}));
|
|
901
913
|
test('CLI < test file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
902
|
-
var
|
|
914
|
+
var _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
|
|
903
915
|
const getTestsToTriggerMock = jest.spyOn(testUtils, 'getTestsToTrigger');
|
|
904
916
|
const command = (0, fixtures_1.createCommand)(run_tests_command_1.RunTestsCommand);
|
|
905
917
|
jest.spyOn(ciUtils, 'resolveConfigFromFile').mockImplementation((config, _) => __awaiter(void 0, void 0, void 0, function* () { return config; }));
|
|
@@ -945,8 +957,8 @@ describe('run-tests', () => {
|
|
|
945
957
|
command['mobileApplicationVersion'] = defaultTestOverrides.mobileApplicationVersion;
|
|
946
958
|
command['overrides'] = [
|
|
947
959
|
`allowInsecureCertificates=${defaultTestOverrides.allowInsecureCertificates}`,
|
|
948
|
-
`basicAuth.password=${(
|
|
949
|
-
`basicAuth.username=${(
|
|
960
|
+
`basicAuth.password=${(_0 = defaultTestOverrides.basicAuth) === null || _0 === void 0 ? void 0 : _0.password}`,
|
|
961
|
+
`basicAuth.username=${(_1 = defaultTestOverrides.basicAuth) === null || _1 === void 0 ? void 0 : _1.username}`,
|
|
950
962
|
`body=${defaultTestOverrides.body}`,
|
|
951
963
|
`bodyType=${defaultTestOverrides.bodyType}`,
|
|
952
964
|
`cookies=${defaultTestOverrides.cookies.value}`,
|
|
@@ -954,20 +966,20 @@ describe('run-tests', () => {
|
|
|
954
966
|
`setCookies=${defaultTestOverrides.setCookies.value}`,
|
|
955
967
|
`setCookies.append=${defaultTestOverrides.setCookies.append}`,
|
|
956
968
|
`defaultStepTimeout=${defaultTestOverrides.defaultStepTimeout}`,
|
|
957
|
-
`deviceIds=${(
|
|
969
|
+
`deviceIds=${(_2 = defaultTestOverrides.deviceIds) === null || _2 === void 0 ? void 0 : _2.join(';')}`,
|
|
958
970
|
`executionRule=${defaultTestOverrides.executionRule}`,
|
|
959
971
|
`followRedirects=${defaultTestOverrides.followRedirects}`,
|
|
960
972
|
`headers.Content-Type=${defaultTestOverrides.headers ? defaultTestOverrides.headers['Content-Type'] : ''}`,
|
|
961
|
-
`headers.Authorization=${(
|
|
962
|
-
`locations=${(
|
|
963
|
-
`retry.count=${(
|
|
964
|
-
`retry.interval=${(
|
|
973
|
+
`headers.Authorization=${(_3 = defaultTestOverrides.headers) === null || _3 === void 0 ? void 0 : _3.Authorization}`,
|
|
974
|
+
`locations=${(_4 = defaultTestOverrides.locations) === null || _4 === void 0 ? void 0 : _4.join(';')}`,
|
|
975
|
+
`retry.count=${(_5 = defaultTestOverrides.retry) === null || _5 === void 0 ? void 0 : _5.count}`,
|
|
976
|
+
`retry.interval=${(_6 = defaultTestOverrides.retry) === null || _6 === void 0 ? void 0 : _6.interval}`,
|
|
965
977
|
`startUrl=${defaultTestOverrides.startUrl}`,
|
|
966
978
|
`startUrlSubstitutionRegex=${defaultTestOverrides.startUrlSubstitutionRegex}`,
|
|
967
979
|
`testTimeout=${defaultTestOverrides.testTimeout}`,
|
|
968
|
-
`resourceUrlSubstitutionRegexes=${(
|
|
969
|
-
`variables.cliVar1=${(
|
|
970
|
-
`variables.cliVar2=${(
|
|
980
|
+
`resourceUrlSubstitutionRegexes=${(_7 = defaultTestOverrides.resourceUrlSubstitutionRegexes) === null || _7 === void 0 ? void 0 : _7.join(';')}`,
|
|
981
|
+
`variables.cliVar1=${(_8 = defaultTestOverrides.variables) === null || _8 === void 0 ? void 0 : _8.cliVar1}`,
|
|
982
|
+
`variables.cliVar2=${(_9 = defaultTestOverrides.variables) === null || _9 === void 0 ? void 0 : _9.cliVar2}`,
|
|
971
983
|
];
|
|
972
984
|
yield command['resolveConfig']();
|
|
973
985
|
expect(yield command.execute()).toBe(0);
|
|
@@ -1156,7 +1168,7 @@ describe('upload-application', () => {
|
|
|
1156
1168
|
process.env = overrideEnv;
|
|
1157
1169
|
const command = (0, fixtures_1.createCommand)(upload_application_command_1.UploadApplicationCommand);
|
|
1158
1170
|
yield command['resolveConfig']();
|
|
1159
|
-
expect(command['config']).toEqual(Object.assign(Object.assign({}, upload_application_command_1.
|
|
1171
|
+
expect(command['config']).toEqual(Object.assign(Object.assign({}, upload_application_command_1.UploadApplicationCommand.getDefaultConfig()), { apiKey: overrideEnv.DATADOG_API_KEY, appKey: overrideEnv.DATADOG_APP_KEY, configPath: overrideEnv.DATADOG_SYNTHETICS_CONFIG_PATH, datadogSite: overrideEnv.DATADOG_SITE, versionName: overrideEnv.DATADOG_SYNTHETICS_VERSION_NAME, latest: (0, env_1.toBoolean)(overrideEnv.DATADOG_SYNTHETICS_LATEST) }));
|
|
1160
1172
|
}));
|
|
1161
1173
|
test('override from config file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1162
1174
|
const expectedConfig = {
|
|
@@ -1196,7 +1208,7 @@ describe('upload-application', () => {
|
|
|
1196
1208
|
command['versionName'] = overrideCLI.versionName;
|
|
1197
1209
|
command['latest'] = overrideCLI.latest;
|
|
1198
1210
|
yield command['resolveConfig']();
|
|
1199
|
-
expect(command['config']).toEqual(Object.assign(Object.assign({}, upload_application_command_1.
|
|
1211
|
+
expect(command['config']).toEqual(Object.assign(Object.assign({}, upload_application_command_1.UploadApplicationCommand.getDefaultConfig()), { apiKey: 'fake_api_key_cli', appKey: 'fake_app_key_cli', configPath: 'src/commands/synthetics/__tests__/config-fixtures/empty-config-file.json', datadogSite: 'datadoghq.cli', mobileApplicationVersionFilePath: 'fake_path/cli_fake_app.apk', mobileApplicationId: 'fake-abc-cli', versionName: 'new cli', latest: true }));
|
|
1200
1212
|
}));
|
|
1201
1213
|
test('override from config file < ENV < CLI', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1202
1214
|
jest.spyOn(ciUtils, 'resolveConfigFromFile').mockImplementationOnce((baseConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1210,7 +1222,31 @@ describe('upload-application', () => {
|
|
|
1210
1222
|
command['apiKey'] = 'api_key_cli';
|
|
1211
1223
|
command['mobileApplicationVersionFilePath'] = './path/to/application_cli.apk';
|
|
1212
1224
|
yield command['resolveConfig']();
|
|
1213
|
-
expect(command['config']).toEqual(Object.assign(Object.assign({}, upload_application_command_1.
|
|
1225
|
+
expect(command['config']).toEqual(Object.assign(Object.assign({}, upload_application_command_1.UploadApplicationCommand.getDefaultConfig()), { apiKey: 'api_key_cli', appKey: 'app_key_env', datadogSite: 'us5.datadoghq.com', mobileApplicationVersionFilePath: './path/to/application_cli.apk', mobileApplicationId: 'fake-abc', versionName: 'new', latest: true }));
|
|
1226
|
+
}));
|
|
1227
|
+
});
|
|
1228
|
+
describe('any kind of error is reported', () => {
|
|
1229
|
+
test.each([
|
|
1230
|
+
[
|
|
1231
|
+
'CI error',
|
|
1232
|
+
new errors_1.CriticalError('INVALID_MOBILE_APP', 'some message'),
|
|
1233
|
+
'A CI error occurred: [INVALID_MOBILE_APP] some message',
|
|
1234
|
+
],
|
|
1235
|
+
['Endpoint error', new api.EndpointError('some message', 404), 'A backend error occurred: some message (404)'],
|
|
1236
|
+
[
|
|
1237
|
+
'Axios error',
|
|
1238
|
+
(0, fixtures_1.getAxiosError)(400, { message: 'Bad Request' }),
|
|
1239
|
+
'An unexpected error occurred: AxiosError: Bad Request\n at getAxiosError',
|
|
1240
|
+
],
|
|
1241
|
+
['Unknown error', new Error('Unknown error'), 'An unexpected error occurred: Error: Unknown error\n at '],
|
|
1242
|
+
])('%s', (_, error, expectedMessage) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1243
|
+
const writeMock = jest.fn();
|
|
1244
|
+
const command = (0, fixtures_1.createCommand)(upload_application_command_1.UploadApplicationCommand, { stdout: { write: writeMock } });
|
|
1245
|
+
jest.spyOn(mobile, 'uploadMobileApplicationVersion').mockImplementation(() => {
|
|
1246
|
+
throw error;
|
|
1247
|
+
});
|
|
1248
|
+
expect(yield command['execute']()).toBe(1);
|
|
1249
|
+
expect(writeMock).toHaveBeenCalledWith(expect.stringContaining(expectedMessage));
|
|
1214
1250
|
}));
|
|
1215
1251
|
});
|
|
1216
1252
|
});
|
|
@@ -1237,7 +1273,7 @@ describe('import-tests', () => {
|
|
|
1237
1273
|
process.env = overrideEnv;
|
|
1238
1274
|
const command = (0, fixtures_1.createCommand)(import_tests_command_1.ImportTestsCommand);
|
|
1239
1275
|
yield command['resolveConfig']();
|
|
1240
|
-
expect(command['config']).toEqual(Object.assign(Object.assign({}, import_tests_command_1.
|
|
1276
|
+
expect(command['config']).toEqual(Object.assign(Object.assign({}, import_tests_command_1.ImportTestsCommand.getDefaultConfig()), { apiKey: overrideEnv.DATADOG_API_KEY, appKey: overrideEnv.DATADOG_APP_KEY, configPath: overrideEnv.DATADOG_SYNTHETICS_CONFIG_PATH, datadogSite: overrideEnv.DATADOG_SITE, files: (_a = overrideEnv.DATADOG_SYNTHETICS_FILES) === null || _a === void 0 ? void 0 : _a.split(';'), publicIds: (_b = overrideEnv.DATADOG_SYNTHETICS_PUBLIC_IDS) === null || _b === void 0 ? void 0 : _b.split(';'), testSearchQuery: overrideEnv.DATADOG_SYNTHETICS_TEST_SEARCH_QUERY }));
|
|
1241
1277
|
}));
|
|
1242
1278
|
test('override from config file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1243
1279
|
const expectedConfig = {
|
|
@@ -1274,7 +1310,7 @@ describe('import-tests', () => {
|
|
|
1274
1310
|
command['publicIds'] = overrideCLI.publicIds;
|
|
1275
1311
|
command['testSearchQuery'] = overrideCLI.testSearchQuery;
|
|
1276
1312
|
yield command['resolveConfig']();
|
|
1277
|
-
expect(command['config']).toEqual(Object.assign(Object.assign({}, import_tests_command_1.
|
|
1313
|
+
expect(command['config']).toEqual(Object.assign(Object.assign({}, import_tests_command_1.ImportTestsCommand.getDefaultConfig()), { apiKey: 'fake_api_key_cli', appKey: 'fake_app_key_cli', configPath: 'src/commands/synthetics/__tests__/config-fixtures/empty-config-file.json', datadogSite: 'datadoghq.cli', files: ['new-file'], publicIds: ['ran-dom-id2'], testSearchQuery: 'a-search-query' }));
|
|
1278
1314
|
}));
|
|
1279
1315
|
test('override from config file < ENV < CLI', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1280
1316
|
jest.spyOn(ciUtils, 'resolveConfigFromFile').mockImplementationOnce((baseConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1287,7 +1323,7 @@ describe('import-tests', () => {
|
|
|
1287
1323
|
const command = (0, fixtures_1.createCommand)(import_tests_command_1.ImportTestsCommand);
|
|
1288
1324
|
command['apiKey'] = 'api_key_cli';
|
|
1289
1325
|
yield command['resolveConfig']();
|
|
1290
|
-
expect(command['config']).toEqual(Object.assign(Object.assign({}, import_tests_command_1.
|
|
1326
|
+
expect(command['config']).toEqual(Object.assign(Object.assign({}, import_tests_command_1.ImportTestsCommand.getDefaultConfig()), { apiKey: 'api_key_cli', appKey: 'app_key_env', datadogSite: 'us5.datadoghq.com' }));
|
|
1291
1327
|
}));
|
|
1292
1328
|
});
|
|
1293
1329
|
});
|
|
@@ -1314,7 +1350,7 @@ describe('deploy-tests', () => {
|
|
|
1314
1350
|
process.env = overrideEnv;
|
|
1315
1351
|
const command = (0, fixtures_1.createCommand)(deploy_tests_command_1.DeployTestsCommand);
|
|
1316
1352
|
yield command['resolveConfig']();
|
|
1317
|
-
expect(command['config']).toEqual(Object.assign(Object.assign({}, deploy_tests_command_1.
|
|
1353
|
+
expect(command['config']).toEqual(Object.assign(Object.assign({}, deploy_tests_command_1.DeployTestsCommand.getDefaultConfig()), { apiKey: overrideEnv.DATADOG_API_KEY, appKey: overrideEnv.DATADOG_APP_KEY, configPath: overrideEnv.DATADOG_SYNTHETICS_CONFIG_PATH, datadogSite: overrideEnv.DATADOG_SITE, files: (_a = overrideEnv.DATADOG_SYNTHETICS_FILES) === null || _a === void 0 ? void 0 : _a.split(';'), publicIds: (_b = overrideEnv.DATADOG_SYNTHETICS_PUBLIC_IDS) === null || _b === void 0 ? void 0 : _b.split(';'), subdomain: overrideEnv.DATADOG_SUBDOMAIN }));
|
|
1318
1354
|
}));
|
|
1319
1355
|
test('override from config file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1320
1356
|
const expectedConfig = {
|
|
@@ -1351,7 +1387,7 @@ describe('deploy-tests', () => {
|
|
|
1351
1387
|
command['publicIds'] = overrideCLI.publicIds;
|
|
1352
1388
|
command['subdomain'] = overrideCLI.subdomain;
|
|
1353
1389
|
yield command['resolveConfig']();
|
|
1354
|
-
expect(command['config']).toEqual(Object.assign(Object.assign({}, deploy_tests_command_1.
|
|
1390
|
+
expect(command['config']).toEqual(Object.assign(Object.assign({}, deploy_tests_command_1.DeployTestsCommand.getDefaultConfig()), { apiKey: 'fake_api_key_cli', appKey: 'fake_app_key_cli', configPath: 'src/commands/synthetics/__tests__/config-fixtures/empty-config-file.json', datadogSite: 'datadoghq.cli', files: ['new-file'], publicIds: ['ran-dom-id2'], subdomain: 'subdomain-from-cli' }));
|
|
1355
1391
|
}));
|
|
1356
1392
|
test('override from config file < ENV < CLI', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1357
1393
|
jest.spyOn(ciUtils, 'resolveConfigFromFile').mockImplementationOnce((baseConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1364,7 +1400,7 @@ describe('deploy-tests', () => {
|
|
|
1364
1400
|
const command = (0, fixtures_1.createCommand)(deploy_tests_command_1.DeployTestsCommand);
|
|
1365
1401
|
command['apiKey'] = 'api_key_cli';
|
|
1366
1402
|
yield command['resolveConfig']();
|
|
1367
|
-
expect(command['config']).toEqual(Object.assign(Object.assign({}, deploy_tests_command_1.
|
|
1403
|
+
expect(command['config']).toEqual(Object.assign(Object.assign({}, deploy_tests_command_1.DeployTestsCommand.getDefaultConfig()), { apiKey: 'api_key_cli', appKey: 'app_key_env', datadogSite: 'us5.datadoghq.com' }));
|
|
1368
1404
|
}));
|
|
1369
1405
|
});
|
|
1370
1406
|
});
|