@datadog/datadog-ci 0.17.10 → 0.18.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/LICENSE-3rdparty.csv +2 -0
- package/README.md +9 -2
- package/dist/{commands/dependencies/index.d.ts → cli.d.ts} +0 -0
- package/dist/cli.js +34 -0
- package/dist/commands/{dsyms/index.d.ts → dependencies/cli.d.ts} +0 -0
- package/dist/commands/dependencies/{index.js → cli.js} +0 -0
- package/dist/commands/dependencies/upload.d.ts +1 -1
- package/dist/commands/{git-metadata/index.d.ts → dsyms/cli.d.ts} +0 -0
- package/dist/commands/dsyms/{index.js → cli.js} +0 -0
- package/dist/commands/dsyms/upload.d.ts +1 -1
- package/dist/commands/{junit/index.d.ts → git-metadata/cli.d.ts} +0 -0
- package/dist/commands/git-metadata/{index.js → cli.js} +0 -0
- package/dist/commands/git-metadata/upload.d.ts +1 -1
- package/dist/commands/git-metadata/upload.js +6 -1
- package/dist/commands/{lambda/index.d.ts → junit/cli.d.ts} +0 -0
- package/dist/commands/junit/{index.js → cli.js} +0 -0
- package/dist/commands/junit/upload.d.ts +1 -1
- package/dist/commands/junit/upload.js +1 -1
- package/dist/commands/lambda/__tests__/fixtures.d.ts +5 -1
- package/dist/commands/lambda/__tests__/fixtures.js +13 -2
- package/dist/commands/lambda/__tests__/functions/commons.test.js +281 -2
- package/dist/commands/lambda/__tests__/functions/instrument.test.js +109 -54
- package/dist/commands/lambda/__tests__/functions/uninstrument.test.js +113 -7
- package/dist/commands/lambda/__tests__/instrument.test.js +760 -111
- package/dist/commands/{sourcemaps/index.d.ts → lambda/__tests__/prompt.test.d.ts} +0 -0
- package/dist/commands/lambda/__tests__/prompt.test.js +216 -0
- package/dist/commands/lambda/__tests__/uninstrument.test.js +380 -17
- package/dist/commands/{trace/index.d.ts → lambda/cli.d.ts} +0 -0
- package/dist/commands/lambda/{index.js → cli.js} +0 -0
- package/dist/commands/lambda/constants.d.ts +47 -16
- package/dist/commands/lambda/constants.js +72 -17
- package/dist/commands/lambda/functions/commons.d.ts +38 -3
- package/dist/commands/lambda/functions/commons.js +179 -9
- package/dist/commands/lambda/functions/instrument.d.ts +5 -11
- package/dist/commands/lambda/functions/instrument.js +89 -63
- package/dist/commands/lambda/functions/uninstrument.d.ts +3 -2
- package/dist/commands/lambda/functions/uninstrument.js +41 -15
- package/dist/commands/lambda/instrument.d.ts +2 -1
- package/dist/commands/lambda/instrument.js +115 -58
- package/dist/commands/lambda/interfaces.d.ts +4 -1
- package/dist/commands/lambda/loggroup.js +3 -1
- package/dist/commands/lambda/prompt.d.ts +9 -0
- package/dist/commands/lambda/prompt.js +187 -0
- package/dist/commands/lambda/uninstrument.d.ts +2 -0
- package/dist/commands/lambda/uninstrument.js +107 -30
- package/dist/commands/sourcemaps/cli.d.ts +1 -0
- package/dist/commands/sourcemaps/{index.js → cli.js} +0 -0
- package/dist/commands/sourcemaps/upload.d.ts +1 -1
- package/dist/commands/synthetics/__tests__/cli.test.js +36 -13
- package/dist/commands/synthetics/__tests__/fixtures.js +1 -0
- package/dist/commands/synthetics/__tests__/run-test.test.js +48 -2
- package/dist/commands/synthetics/__tests__/utils.test.js +12 -0
- package/dist/commands/synthetics/__tests__/websocket.test.js +3 -3
- package/dist/commands/synthetics/cli.d.ts +1 -26
- package/dist/commands/synthetics/cli.js +2 -227
- package/dist/commands/synthetics/command.d.ts +27 -0
- package/dist/commands/synthetics/command.js +236 -0
- package/dist/commands/synthetics/index.d.ts +5 -1
- package/dist/commands/synthetics/index.js +31 -2
- package/dist/commands/synthetics/interfaces.d.ts +9 -3
- package/dist/commands/synthetics/interfaces.js +7 -3
- package/dist/commands/synthetics/reporters/default.js +5 -1
- package/dist/commands/synthetics/run-test.d.ts +2 -0
- package/dist/commands/synthetics/run-test.js +3 -1
- package/dist/commands/synthetics/utils.d.ts +3 -0
- package/dist/commands/synthetics/utils.js +37 -13
- package/dist/commands/trace/api.js +1 -1
- package/dist/commands/trace/cli.d.ts +1 -0
- package/dist/commands/trace/{index.js → cli.js} +0 -0
- package/dist/commands/trace/trace.d.ts +1 -1
- package/dist/helpers/__tests__/ci.test.js +71 -24
- package/dist/helpers/__tests__/user-provided-git.test.js +69 -27
- package/dist/helpers/ci.js +1 -1
- package/dist/helpers/git.js +1 -1
- package/dist/helpers/user-provided-git.d.ts +2 -1
- package/dist/helpers/user-provided-git.js +18 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +23 -31
- package/package.json +9 -7
|
@@ -34,12 +34,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
34
34
|
// tslint:disable: no-string-literal
|
|
35
35
|
jest.mock('fs');
|
|
36
36
|
jest.mock('aws-sdk');
|
|
37
|
+
jest.mock('../prompt');
|
|
37
38
|
const aws_sdk_1 = require("aws-sdk");
|
|
38
39
|
const chalk_1 = require("chalk");
|
|
39
40
|
const advanced_1 = require("clipanion/lib/advanced");
|
|
40
41
|
const fs = __importStar(require("fs"));
|
|
41
42
|
const path_1 = __importDefault(require("path"));
|
|
43
|
+
const constants_1 = require("../constants");
|
|
42
44
|
const instrument_1 = require("../instrument");
|
|
45
|
+
const prompt_1 = require("../prompt");
|
|
43
46
|
const fixtures_1 = require("./fixtures");
|
|
44
47
|
// tslint:disable-next-line
|
|
45
48
|
const { version } = require(path_1.default.join(__dirname, '../../../../package.json'));
|
|
@@ -89,36 +92,116 @@ describe('lambda', () => {
|
|
|
89
92
|
const output = context.stdout.toString();
|
|
90
93
|
expect(code).toBe(0);
|
|
91
94
|
expect(output).toMatchInlineSnapshot(`
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
95
|
+
"${chalk_1.bold(chalk_1.yellow('[Warning]'))} Instrument your ${chalk_1.hex('#FF9900').bold('Lambda')} functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run \`${chalk_1.bold('uninstrument')}\` with the same arguments to revert the changes.
|
|
96
|
+
\n${chalk_1.bold(chalk_1.yellow('[!]'))} Functions to be updated:
|
|
97
|
+
\t- ${chalk_1.bold('arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world')}\n
|
|
98
|
+
${chalk_1.bold(chalk_1.cyan('[Dry Run] '))}Will apply the following updates:
|
|
99
|
+
UpdateFunctionConfiguration -> arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world
|
|
100
|
+
{
|
|
101
|
+
\\"FunctionName\\": \\"arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world\\",
|
|
102
|
+
\\"Handler\\": \\"/opt/nodejs/node_modules/datadog-lambda-js/handler.handler\\",
|
|
103
|
+
\\"Environment\\": {
|
|
104
|
+
\\"Variables\\": {
|
|
105
|
+
\\"DD_LAMBDA_HANDLER\\": \\"index.handler\\",
|
|
106
|
+
\\"DD_SITE\\": \\"datadoghq.com\\",
|
|
107
|
+
\\"DD_CAPTURE_LAMBDA_PAYLOAD\\": \\"false\\",
|
|
108
|
+
\\"DD_ENV\\": \\"staging\\",
|
|
109
|
+
\\"DD_TAGS\\": \\"layer:api,team:intake\\",
|
|
110
|
+
\\"DD_MERGE_XRAY_TRACES\\": \\"false\\",
|
|
111
|
+
\\"DD_SERVICE\\": \\"middletier\\",
|
|
112
|
+
\\"DD_TRACE_ENABLED\\": \\"true\\",
|
|
113
|
+
\\"DD_VERSION\\": \\"0.2\\",
|
|
114
|
+
\\"DD_FLUSH_TO_LOG\\": \\"true\\",
|
|
115
|
+
\\"DD_LOG_LEVEL\\": \\"debug\\"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
\\"Layers\\": [
|
|
119
|
+
\\"arn:aws:lambda:us-east-1:464622532012:layer:Datadog-Node12-x:10\\"
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
TagResource -> arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world
|
|
123
|
+
{
|
|
124
|
+
\\"dd_sls_ci\\": \\"v${version}\\"
|
|
125
|
+
}
|
|
126
|
+
"
|
|
127
|
+
`);
|
|
128
|
+
}));
|
|
129
|
+
test('prints dry run data for lambda library and extension layers using kebab case args', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
130
|
+
;
|
|
131
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
132
|
+
aws_sdk_1.Lambda.mockImplementation(() => fixtures_1.makeMockLambda({
|
|
133
|
+
'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world': {
|
|
134
|
+
FunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world',
|
|
135
|
+
Handler: 'index.handler',
|
|
136
|
+
Runtime: 'nodejs12.x',
|
|
137
|
+
},
|
|
138
|
+
}));
|
|
139
|
+
const cli = fixtures_1.makeCli();
|
|
140
|
+
const context = fixtures_1.createMockContext();
|
|
141
|
+
const functionARN = 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world';
|
|
142
|
+
process.env.DATADOG_API_KEY = '1234';
|
|
143
|
+
const code = yield cli.run([
|
|
144
|
+
'lambda',
|
|
145
|
+
'instrument',
|
|
146
|
+
'-f',
|
|
147
|
+
functionARN,
|
|
148
|
+
'--dry',
|
|
149
|
+
'--service',
|
|
150
|
+
'middletier',
|
|
151
|
+
'--env',
|
|
152
|
+
'staging',
|
|
153
|
+
'--version',
|
|
154
|
+
'0.2',
|
|
155
|
+
'--extra-tags',
|
|
156
|
+
'layer:api,team:intake',
|
|
157
|
+
'--layer-version',
|
|
158
|
+
'10',
|
|
159
|
+
'--extension-version',
|
|
160
|
+
'5',
|
|
161
|
+
'--merge-xray-traces',
|
|
162
|
+
'true',
|
|
163
|
+
'--flush-metrics-to-logs',
|
|
164
|
+
'false',
|
|
165
|
+
'--log-level',
|
|
166
|
+
'debug',
|
|
167
|
+
], context);
|
|
168
|
+
const output = context.stdout.toString();
|
|
169
|
+
expect(code).toBe(0);
|
|
170
|
+
expect(output).toMatchInlineSnapshot(`
|
|
171
|
+
"${chalk_1.bold(chalk_1.yellow('[Warning]'))} Instrument your ${chalk_1.hex('#FF9900').bold('Lambda')} functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run \`${chalk_1.bold('uninstrument')}\` with the same arguments to revert the changes.
|
|
172
|
+
\n${chalk_1.bold(chalk_1.yellow('[!]'))} Functions to be updated:
|
|
173
|
+
\t- ${chalk_1.bold('arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world')}\n
|
|
174
|
+
${chalk_1.bold(chalk_1.cyan('[Dry Run] '))}Will apply the following updates:
|
|
175
|
+
UpdateFunctionConfiguration -> arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world
|
|
176
|
+
{
|
|
177
|
+
\\"FunctionName\\": \\"arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world\\",
|
|
178
|
+
\\"Handler\\": \\"/opt/nodejs/node_modules/datadog-lambda-js/handler.handler\\",
|
|
179
|
+
\\"Environment\\": {
|
|
180
|
+
\\"Variables\\": {
|
|
181
|
+
\\"DD_LAMBDA_HANDLER\\": \\"index.handler\\",
|
|
182
|
+
\\"DD_API_KEY\\": \\"1234\\",
|
|
183
|
+
\\"DD_SITE\\": \\"datadoghq.com\\",
|
|
184
|
+
\\"DD_CAPTURE_LAMBDA_PAYLOAD\\": \\"false\\",
|
|
185
|
+
\\"DD_ENV\\": \\"staging\\",
|
|
186
|
+
\\"DD_TAGS\\": \\"layer:api,team:intake\\",
|
|
187
|
+
\\"DD_MERGE_XRAY_TRACES\\": \\"true\\",
|
|
188
|
+
\\"DD_SERVICE\\": \\"middletier\\",
|
|
189
|
+
\\"DD_TRACE_ENABLED\\": \\"true\\",
|
|
190
|
+
\\"DD_VERSION\\": \\"0.2\\",
|
|
191
|
+
\\"DD_LOG_LEVEL\\": \\"debug\\"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
\\"Layers\\": [
|
|
195
|
+
\\"arn:aws:lambda:us-east-1:464622532012:layer:Datadog-Extension:5\\",
|
|
196
|
+
\\"arn:aws:lambda:us-east-1:464622532012:layer:Datadog-Node12-x:10\\"
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
TagResource -> arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world
|
|
200
|
+
{
|
|
201
|
+
\\"dd_sls_ci\\": \\"v${version}\\"
|
|
202
|
+
}
|
|
203
|
+
"
|
|
204
|
+
`);
|
|
122
205
|
}));
|
|
123
206
|
test('prints dry run data for lambda extension layer', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
207
|
;
|
|
@@ -154,36 +237,107 @@ describe('lambda', () => {
|
|
|
154
237
|
const output = context.stdout.toString();
|
|
155
238
|
expect(code).toBe(0);
|
|
156
239
|
expect(output).toMatchInlineSnapshot(`
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
240
|
+
"${chalk_1.bold(chalk_1.yellow('[Warning]'))} Instrument your ${chalk_1.hex('#FF9900').bold('Lambda')} functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run \`${chalk_1.bold('uninstrument')}\` with the same arguments to revert the changes.
|
|
241
|
+
\n${chalk_1.bold(chalk_1.yellow('[!]'))} Functions to be updated:
|
|
242
|
+
\t- ${chalk_1.bold('arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world')}\n
|
|
243
|
+
${chalk_1.bold(chalk_1.cyan('[Dry Run] '))}Will apply the following updates:
|
|
244
|
+
UpdateFunctionConfiguration -> arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world
|
|
245
|
+
{
|
|
246
|
+
\\"FunctionName\\": \\"arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world\\",
|
|
247
|
+
\\"Handler\\": \\"/opt/nodejs/node_modules/datadog-lambda-js/handler.handler\\",
|
|
248
|
+
\\"Environment\\": {
|
|
249
|
+
\\"Variables\\": {
|
|
250
|
+
\\"DD_LAMBDA_HANDLER\\": \\"index.handler\\",
|
|
251
|
+
\\"DD_API_KEY\\": \\"1234\\",
|
|
252
|
+
\\"DD_SITE\\": \\"datadoghq.com\\",
|
|
253
|
+
\\"DD_CAPTURE_LAMBDA_PAYLOAD\\": \\"false\\",
|
|
254
|
+
\\"DD_ENV\\": \\"staging\\",
|
|
255
|
+
\\"DD_TAGS\\": \\"layer:api,team:intake\\",
|
|
256
|
+
\\"DD_MERGE_XRAY_TRACES\\": \\"false\\",
|
|
257
|
+
\\"DD_SERVICE\\": \\"middletier\\",
|
|
258
|
+
\\"DD_TRACE_ENABLED\\": \\"true\\",
|
|
259
|
+
\\"DD_VERSION\\": \\"0.2\\"
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
\\"Layers\\": [
|
|
263
|
+
\\"arn:aws:lambda:us-east-1:464622532012:layer:Datadog-Extension:6\\"
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
TagResource -> arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world
|
|
267
|
+
{
|
|
268
|
+
\\"dd_sls_ci\\": \\"v${version}\\"
|
|
269
|
+
}
|
|
270
|
+
"
|
|
271
|
+
`);
|
|
272
|
+
}));
|
|
273
|
+
test('prints dry run data for lambda .NET layer', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
274
|
+
;
|
|
275
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
276
|
+
aws_sdk_1.Lambda.mockImplementation(() => fixtures_1.makeMockLambda({
|
|
277
|
+
'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world': {
|
|
278
|
+
FunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world',
|
|
279
|
+
Runtime: 'dotnetcore3.1',
|
|
280
|
+
},
|
|
281
|
+
}));
|
|
282
|
+
const cli = fixtures_1.makeCli();
|
|
283
|
+
const context = fixtures_1.createMockContext();
|
|
284
|
+
const functionARN = 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world';
|
|
285
|
+
process.env.DATADOG_API_KEY = '1234';
|
|
286
|
+
const code = yield cli.run([
|
|
287
|
+
'lambda',
|
|
288
|
+
'instrument',
|
|
289
|
+
'-f',
|
|
290
|
+
functionARN,
|
|
291
|
+
'--dry',
|
|
292
|
+
'-v',
|
|
293
|
+
'129',
|
|
294
|
+
'--extra-tags',
|
|
295
|
+
'layer:api,team:intake',
|
|
296
|
+
'--service',
|
|
297
|
+
'middletier',
|
|
298
|
+
'--env',
|
|
299
|
+
'staging',
|
|
300
|
+
'--version',
|
|
301
|
+
'0.2',
|
|
302
|
+
], context);
|
|
303
|
+
const output = context.stdout.toString();
|
|
304
|
+
expect(code).toBe(0);
|
|
305
|
+
expect(output).toMatchInlineSnapshot(`
|
|
306
|
+
"${chalk_1.bold(chalk_1.yellow('[Warning]'))} Instrument your ${chalk_1.hex('#FF9900').bold('Lambda')} functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run \`${chalk_1.bold('uninstrument')}\` with the same arguments to revert the changes.
|
|
307
|
+
\n${chalk_1.bold(chalk_1.yellow('[!]'))} Functions to be updated:
|
|
308
|
+
\t- ${chalk_1.bold('arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world')}\n
|
|
309
|
+
${chalk_1.bold(chalk_1.cyan('[Dry Run] '))}Will apply the following updates:
|
|
310
|
+
UpdateFunctionConfiguration -> arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world
|
|
311
|
+
{
|
|
312
|
+
\\"FunctionName\\": \\"arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world\\",
|
|
313
|
+
\\"Environment\\": {
|
|
314
|
+
\\"Variables\\": {
|
|
315
|
+
\\"DD_API_KEY\\": \\"1234\\",
|
|
316
|
+
\\"DD_SITE\\": \\"datadoghq.com\\",
|
|
317
|
+
\\"DD_CAPTURE_LAMBDA_PAYLOAD\\": \\"false\\",
|
|
318
|
+
\\"DD_ENV\\": \\"staging\\",
|
|
319
|
+
\\"DD_TAGS\\": \\"layer:api,team:intake\\",
|
|
320
|
+
\\"DD_MERGE_XRAY_TRACES\\": \\"false\\",
|
|
321
|
+
\\"DD_SERVICE\\": \\"middletier\\",
|
|
322
|
+
\\"DD_TRACE_ENABLED\\": \\"true\\",
|
|
323
|
+
\\"DD_VERSION\\": \\"0.2\\",
|
|
324
|
+
\\"DD_FLUSH_TO_LOG\\": \\"true\\",
|
|
325
|
+
\\"CORECLR_ENABLE_PROFILING\\": \\"1\\",
|
|
326
|
+
\\"CORECLR_PROFILER\\": \\"{846F5F1C-F9AE-4B07-969E-05C26BC060D8}\\",
|
|
327
|
+
\\"CORECLR_PROFILER_PATH\\": \\"/opt/datadog/Datadog.Trace.ClrProfiler.Native.so\\",
|
|
328
|
+
\\"DD_DOTNET_TRACER_HOME\\": \\"/opt/datadog\\"
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
\\"Layers\\": [
|
|
332
|
+
\\"arn:aws:lambda:us-east-1:464622532012:layer:dd-trace-dotnet:129\\"
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
TagResource -> arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world
|
|
336
|
+
{
|
|
337
|
+
\\"dd_sls_ci\\": \\"v${version}\\"
|
|
338
|
+
}
|
|
339
|
+
"
|
|
340
|
+
`);
|
|
187
341
|
}));
|
|
188
342
|
test('instrumenting with source code integrations fails if not run within a git repo', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
189
343
|
;
|
|
@@ -330,36 +484,39 @@ describe('lambda', () => {
|
|
|
330
484
|
], context);
|
|
331
485
|
const output = context.stdout.toString();
|
|
332
486
|
expect(output).toMatchInlineSnapshot(`
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
487
|
+
"${chalk_1.bold(chalk_1.yellow('[Warning]'))} Instrument your ${chalk_1.hex('#FF9900').bold('Lambda')} functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run \`${chalk_1.bold('uninstrument')}\` with the same arguments to revert the changes.
|
|
488
|
+
\n${chalk_1.bold(chalk_1.yellow('[!]'))} Functions to be updated:
|
|
489
|
+
\t- ${chalk_1.bold('arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world')}\n
|
|
490
|
+
Will apply the following updates:
|
|
491
|
+
UpdateFunctionConfiguration -> arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world
|
|
492
|
+
{
|
|
493
|
+
\\"FunctionName\\": \\"arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world\\",
|
|
494
|
+
\\"Handler\\": \\"/opt/nodejs/node_modules/datadog-lambda-js/handler.handler\\",
|
|
495
|
+
\\"Environment\\": {
|
|
496
|
+
\\"Variables\\": {
|
|
497
|
+
\\"DD_LAMBDA_HANDLER\\": \\"index.handler\\",
|
|
498
|
+
\\"DD_API_KEY\\": \\"1234\\",
|
|
499
|
+
\\"DD_SITE\\": \\"datadoghq.com\\",
|
|
500
|
+
\\"DD_CAPTURE_LAMBDA_PAYLOAD\\": \\"false\\",
|
|
501
|
+
\\"DD_ENV\\": \\"dummy\\",
|
|
502
|
+
\\"DD_TAGS\\": \\"git.commit.sha:1be168ff837f043bde17c0314341c84271047b31\\",
|
|
503
|
+
\\"DD_MERGE_XRAY_TRACES\\": \\"false\\",
|
|
504
|
+
\\"DD_SERVICE\\": \\"dummy\\",
|
|
505
|
+
\\"DD_TRACE_ENABLED\\": \\"true\\",
|
|
506
|
+
\\"DD_VERSION\\": \\"0.1\\",
|
|
507
|
+
\\"DD_FLUSH_TO_LOG\\": \\"true\\"
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
\\"Layers\\": [
|
|
511
|
+
\\"arn:aws:lambda:us-east-1:464622532012:layer:Datadog-Node12-x:10\\"
|
|
512
|
+
]
|
|
513
|
+
}
|
|
514
|
+
TagResource -> arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world
|
|
515
|
+
{
|
|
516
|
+
\\"dd_sls_ci\\": \\"v${version}\\"
|
|
517
|
+
}
|
|
518
|
+
"
|
|
519
|
+
`);
|
|
363
520
|
}));
|
|
364
521
|
test('ensure the instrument command ran from a local git repo ahead of the origin fails', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
365
522
|
;
|
|
@@ -468,7 +625,7 @@ describe('lambda', () => {
|
|
|
468
625
|
const output = context.stdout.toString();
|
|
469
626
|
expect(code).toBe(1);
|
|
470
627
|
expect(output).toMatchInlineSnapshot(`
|
|
471
|
-
"No functions specified for instrumentation.
|
|
628
|
+
"${chalk_1.red('[Error]')} No functions specified for instrumentation.
|
|
472
629
|
"
|
|
473
630
|
`);
|
|
474
631
|
}));
|
|
@@ -486,7 +643,7 @@ describe('lambda', () => {
|
|
|
486
643
|
yield command['execute']();
|
|
487
644
|
const output = command.context.stdout.toString();
|
|
488
645
|
expect(output).toMatchInlineSnapshot(`
|
|
489
|
-
"No functions specified for instrumentation.
|
|
646
|
+
"${chalk_1.red('[Error]')} No functions specified for instrumentation.
|
|
490
647
|
"
|
|
491
648
|
`);
|
|
492
649
|
}));
|
|
@@ -545,7 +702,7 @@ describe('lambda', () => {
|
|
|
545
702
|
const output = context.stdout.toString();
|
|
546
703
|
expect(code).toBe(1);
|
|
547
704
|
expect(output).toMatchInlineSnapshot(`
|
|
548
|
-
"Couldn't fetch
|
|
705
|
+
"${chalk_1.red('[Error]')} Couldn't fetch Lambda functions. Error: Can't instrument arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world, as current State is Failed (must be \\"Active\\") and Last Update Status is Unsuccessful (must be \\"Successful\\")
|
|
549
706
|
"
|
|
550
707
|
`);
|
|
551
708
|
}));
|
|
@@ -576,7 +733,7 @@ describe('lambda', () => {
|
|
|
576
733
|
const output = context.stdout.toString();
|
|
577
734
|
expect(code).toBe(1);
|
|
578
735
|
expect(output).toMatchInlineSnapshot(`
|
|
579
|
-
"\\"extensionVersion\\" and \\"forwarder\\" should not be used at the same time.
|
|
736
|
+
"${chalk_1.red('[Error]')} \\"extensionVersion\\" and \\"forwarder\\" should not be used at the same time.
|
|
580
737
|
"
|
|
581
738
|
`);
|
|
582
739
|
}));
|
|
@@ -617,6 +774,19 @@ describe('lambda', () => {
|
|
|
617
774
|
output = command.context.stdout.toString();
|
|
618
775
|
expect(output).toMatch('"--functions" and "--functions-regex" should not be used at the same time.\n');
|
|
619
776
|
}));
|
|
777
|
+
test('aborts if pattern is set and no default region is specified', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
778
|
+
;
|
|
779
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({}));
|
|
780
|
+
process.env = {};
|
|
781
|
+
const command = fixtures_1.createCommand(instrument_1.InstrumentCommand);
|
|
782
|
+
command['environment'] = 'staging';
|
|
783
|
+
command['service'] = 'middletier';
|
|
784
|
+
command['version'] = '2';
|
|
785
|
+
command['regExPattern'] = 'valid-pattern';
|
|
786
|
+
yield command['execute']();
|
|
787
|
+
const output = command.context.stdout.toString();
|
|
788
|
+
expect(output).toMatch(`${chalk_1.red('[Error]')} No default region specified. Use \`-r\`, \`--region\`.\n`);
|
|
789
|
+
}));
|
|
620
790
|
test('aborts if the regEx pattern is an ARN', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
621
791
|
;
|
|
622
792
|
fs.readFile.mockImplementation((a, b, callback) => callback({}));
|
|
@@ -631,6 +801,469 @@ describe('lambda', () => {
|
|
|
631
801
|
const output = command.context.stdout.toString();
|
|
632
802
|
expect(output).toMatch(`"--functions-regex" isn't meant to be used with ARNs.\n`);
|
|
633
803
|
}));
|
|
804
|
+
test('instrument multiple functions interactively', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
805
|
+
const node14LibraryLayer = `arn:aws:lambda:sa-east-1:${constants_1.DEFAULT_LAYER_AWS_ACCOUNT}:layer:Datadog-Node14-x`;
|
|
806
|
+
const node12LibraryLayer = `arn:aws:lambda:sa-east-1:${constants_1.DEFAULT_LAYER_AWS_ACCOUNT}:layer:Datadog-Node12-x`;
|
|
807
|
+
const extensionLayer = `arn:aws:lambda:sa-east-1:${constants_1.DEFAULT_LAYER_AWS_ACCOUNT}:layer:Datadog-Extension`;
|
|
808
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
809
|
+
aws_sdk_1.Lambda.mockImplementation(() => fixtures_1.makeMockLambda({
|
|
810
|
+
'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world': {
|
|
811
|
+
FunctionArn: 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world',
|
|
812
|
+
FunctionName: 'lambda-hello-world',
|
|
813
|
+
Handler: 'index.handler',
|
|
814
|
+
Runtime: 'nodejs12.x',
|
|
815
|
+
},
|
|
816
|
+
'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2': {
|
|
817
|
+
FunctionArn: 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2',
|
|
818
|
+
FunctionName: 'lambda-hello-world-2',
|
|
819
|
+
Handler: 'index.handler',
|
|
820
|
+
Runtime: 'nodejs14.x',
|
|
821
|
+
},
|
|
822
|
+
}, {
|
|
823
|
+
[`${node14LibraryLayer}:1`]: {
|
|
824
|
+
LayerVersionArn: `${node14LibraryLayer}:1`,
|
|
825
|
+
Version: 1,
|
|
826
|
+
},
|
|
827
|
+
[`${node12LibraryLayer}:1`]: {
|
|
828
|
+
LayerVersionArn: `${node12LibraryLayer}:1`,
|
|
829
|
+
Version: 1,
|
|
830
|
+
},
|
|
831
|
+
[`${extensionLayer}:1`]: {
|
|
832
|
+
LayerVersionArn: `${extensionLayer}:1`,
|
|
833
|
+
Version: 1,
|
|
834
|
+
},
|
|
835
|
+
}));
|
|
836
|
+
prompt_1.requestAWSCredentials.mockImplementation(() => {
|
|
837
|
+
process.env[constants_1.AWS_ACCESS_KEY_ID_ENV_VAR] = fixtures_1.mockAwsAccessKeyId;
|
|
838
|
+
process.env[constants_1.AWS_SECRET_ACCESS_KEY_ENV_VAR] = fixtures_1.mockAwsSecretAccessKey;
|
|
839
|
+
process.env[constants_1.AWS_DEFAULT_REGION_ENV_VAR] = 'sa-east-1';
|
|
840
|
+
});
|
|
841
|
+
prompt_1.requestDatadogEnvVars.mockImplementation(() => {
|
|
842
|
+
process.env[constants_1.CI_SITE_ENV_VAR] = 'datadoghq.com';
|
|
843
|
+
process.env[constants_1.CI_API_KEY_ENV_VAR] = fixtures_1.mockDatadogApiKey;
|
|
844
|
+
});
|
|
845
|
+
prompt_1.requestFunctionSelection.mockImplementation(() => [
|
|
846
|
+
'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world',
|
|
847
|
+
'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2',
|
|
848
|
+
]);
|
|
849
|
+
prompt_1.requestChangesConfirmation.mockImplementation(() => true);
|
|
850
|
+
const cli = fixtures_1.makeCli();
|
|
851
|
+
const context = fixtures_1.createMockContext();
|
|
852
|
+
const code = yield cli.run(['lambda', 'instrument', '-i'], context);
|
|
853
|
+
const output = context.stdout.toString();
|
|
854
|
+
expect(code).toBe(0);
|
|
855
|
+
expect(output).toMatchInlineSnapshot(`
|
|
856
|
+
"${chalk_1.bold(chalk_1.yellow('[!]'))} No existing AWS credentials found, let's set them up!
|
|
857
|
+
${chalk_1.bold(chalk_1.yellow('[!]'))} Configure Datadog settings.
|
|
858
|
+
Fetching Lambda functions, this might take a while.
|
|
859
|
+
${chalk_1.bold(chalk_1.yellow('[Warning]'))} The environment, service and version tags have not been configured. Learn more about Datadog unified service tagging: ${chalk_1.underline(chalk_1.blueBright('https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/#serverless-environment.'))}
|
|
860
|
+
${chalk_1.bold(chalk_1.yellow('[Warning]'))} Instrument your ${chalk_1.hex('#FF9900').bold('Lambda')} functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run \`${chalk_1.bold('uninstrument')}\` with the same arguments to revert the changes.\n
|
|
861
|
+
${chalk_1.bold(chalk_1.yellow('[!]'))} Functions to be updated:
|
|
862
|
+
\t- ${chalk_1.bold('arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world')}
|
|
863
|
+
\t${chalk_1.bold(chalk_1.yellow('[Warning]'))} At least one latest layer version is being used. Ensure to lock in versions for production applications using \`--layerVersion\` and \`--extensionVersion\`.
|
|
864
|
+
\t- ${chalk_1.bold('arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2')}
|
|
865
|
+
\t${chalk_1.bold(chalk_1.yellow('[Warning]'))} At least one latest layer version is being used. Ensure to lock in versions for production applications using \`--layerVersion\` and \`--extensionVersion\`.\n
|
|
866
|
+
Will apply the following updates:
|
|
867
|
+
UpdateFunctionConfiguration -> arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world
|
|
868
|
+
{
|
|
869
|
+
\\"FunctionName\\": \\"arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world\\",
|
|
870
|
+
\\"Handler\\": \\"/opt/nodejs/node_modules/datadog-lambda-js/handler.handler\\",
|
|
871
|
+
\\"Environment\\": {
|
|
872
|
+
\\"Variables\\": {
|
|
873
|
+
\\"DD_LAMBDA_HANDLER\\": \\"index.handler\\",
|
|
874
|
+
\\"DD_API_KEY\\": \\"02aeb762fff59ac0d5ad1536cd9633bd\\",
|
|
875
|
+
\\"DD_SITE\\": \\"datadoghq.com\\",
|
|
876
|
+
\\"DD_CAPTURE_LAMBDA_PAYLOAD\\": \\"false\\",
|
|
877
|
+
\\"DD_MERGE_XRAY_TRACES\\": \\"false\\",
|
|
878
|
+
\\"DD_TRACE_ENABLED\\": \\"true\\",
|
|
879
|
+
\\"DD_FLUSH_TO_LOG\\": \\"true\\"
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
\\"Layers\\": [
|
|
883
|
+
\\"arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Extension:1\\",
|
|
884
|
+
\\"arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Node12-x:1\\"
|
|
885
|
+
]
|
|
886
|
+
}
|
|
887
|
+
TagResource -> arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world
|
|
888
|
+
{
|
|
889
|
+
\\"dd_sls_ci\\": \\"v${version}\\"
|
|
890
|
+
}
|
|
891
|
+
UpdateFunctionConfiguration -> arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2
|
|
892
|
+
{
|
|
893
|
+
\\"FunctionName\\": \\"arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2\\",
|
|
894
|
+
\\"Handler\\": \\"/opt/nodejs/node_modules/datadog-lambda-js/handler.handler\\",
|
|
895
|
+
\\"Environment\\": {
|
|
896
|
+
\\"Variables\\": {
|
|
897
|
+
\\"DD_LAMBDA_HANDLER\\": \\"index.handler\\",
|
|
898
|
+
\\"DD_API_KEY\\": \\"02aeb762fff59ac0d5ad1536cd9633bd\\",
|
|
899
|
+
\\"DD_SITE\\": \\"datadoghq.com\\",
|
|
900
|
+
\\"DD_CAPTURE_LAMBDA_PAYLOAD\\": \\"false\\",
|
|
901
|
+
\\"DD_MERGE_XRAY_TRACES\\": \\"false\\",
|
|
902
|
+
\\"DD_TRACE_ENABLED\\": \\"true\\",
|
|
903
|
+
\\"DD_FLUSH_TO_LOG\\": \\"true\\"
|
|
904
|
+
}
|
|
905
|
+
},
|
|
906
|
+
\\"Layers\\": [
|
|
907
|
+
\\"arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Extension:1\\",
|
|
908
|
+
\\"arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Node14-x:1\\"
|
|
909
|
+
]
|
|
910
|
+
}
|
|
911
|
+
TagResource -> arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2
|
|
912
|
+
{
|
|
913
|
+
\\"dd_sls_ci\\": \\"v${version}\\"
|
|
914
|
+
}
|
|
915
|
+
${chalk_1.yellow('[!]')} Confirmation needed.
|
|
916
|
+
${chalk_1.yellow('[!]')} Instrumenting functions.
|
|
917
|
+
"
|
|
918
|
+
`);
|
|
919
|
+
}));
|
|
920
|
+
test('instrument multiple specified functions interactively', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
921
|
+
const node14LibraryLayer = `arn:aws:lambda:sa-east-1:${constants_1.DEFAULT_LAYER_AWS_ACCOUNT}:layer:Datadog-Node14-x`;
|
|
922
|
+
const node12LibraryLayer = `arn:aws:lambda:sa-east-1:${constants_1.DEFAULT_LAYER_AWS_ACCOUNT}:layer:Datadog-Node12-x`;
|
|
923
|
+
const extensionLayer = `arn:aws:lambda:sa-east-1:${constants_1.DEFAULT_LAYER_AWS_ACCOUNT}:layer:Datadog-Extension`;
|
|
924
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
925
|
+
aws_sdk_1.Lambda.mockImplementation(() => fixtures_1.makeMockLambda({
|
|
926
|
+
'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world': {
|
|
927
|
+
FunctionArn: 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world',
|
|
928
|
+
FunctionName: 'lambda-hello-world',
|
|
929
|
+
Handler: 'index.handler',
|
|
930
|
+
Runtime: 'nodejs12.x',
|
|
931
|
+
},
|
|
932
|
+
'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2': {
|
|
933
|
+
FunctionArn: 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2',
|
|
934
|
+
FunctionName: 'lambda-hello-world-2',
|
|
935
|
+
Handler: 'index.handler',
|
|
936
|
+
Runtime: 'nodejs14.x',
|
|
937
|
+
},
|
|
938
|
+
}, {
|
|
939
|
+
[`${node14LibraryLayer}:1`]: {
|
|
940
|
+
LayerVersionArn: `${node14LibraryLayer}:1`,
|
|
941
|
+
Version: 1,
|
|
942
|
+
},
|
|
943
|
+
[`${node12LibraryLayer}:1`]: {
|
|
944
|
+
LayerVersionArn: `${node12LibraryLayer}:1`,
|
|
945
|
+
Version: 1,
|
|
946
|
+
},
|
|
947
|
+
[`${extensionLayer}:1`]: {
|
|
948
|
+
LayerVersionArn: `${extensionLayer}:1`,
|
|
949
|
+
Version: 1,
|
|
950
|
+
},
|
|
951
|
+
}));
|
|
952
|
+
prompt_1.requestAWSCredentials.mockImplementation(() => {
|
|
953
|
+
process.env[constants_1.AWS_ACCESS_KEY_ID_ENV_VAR] = fixtures_1.mockAwsAccessKeyId;
|
|
954
|
+
process.env[constants_1.AWS_SECRET_ACCESS_KEY_ENV_VAR] = fixtures_1.mockAwsSecretAccessKey;
|
|
955
|
+
process.env[constants_1.AWS_DEFAULT_REGION_ENV_VAR] = 'sa-east-1';
|
|
956
|
+
process.env[constants_1.AWS_SESSION_TOKEN_ENV_VAR] = 'some-session-token';
|
|
957
|
+
});
|
|
958
|
+
prompt_1.requestDatadogEnvVars.mockImplementation(() => {
|
|
959
|
+
process.env[constants_1.CI_SITE_ENV_VAR] = 'datadoghq.com';
|
|
960
|
+
process.env[constants_1.CI_API_KEY_ENV_VAR] = fixtures_1.mockDatadogApiKey;
|
|
961
|
+
});
|
|
962
|
+
prompt_1.requestChangesConfirmation.mockImplementation(() => true);
|
|
963
|
+
const cli = fixtures_1.makeCli();
|
|
964
|
+
const context = fixtures_1.createMockContext();
|
|
965
|
+
const code = yield cli.run([
|
|
966
|
+
'lambda',
|
|
967
|
+
'instrument',
|
|
968
|
+
'-i',
|
|
969
|
+
'-f',
|
|
970
|
+
'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world',
|
|
971
|
+
'-f',
|
|
972
|
+
'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2',
|
|
973
|
+
], context);
|
|
974
|
+
const output = context.stdout.toString();
|
|
975
|
+
expect(code).toBe(0);
|
|
976
|
+
expect(output).toMatchInlineSnapshot(`
|
|
977
|
+
"${chalk_1.bold(chalk_1.yellow('[!]'))} No existing AWS credentials found, let's set them up!
|
|
978
|
+
${chalk_1.bold(chalk_1.yellow('[!]'))} Configure Datadog settings.
|
|
979
|
+
${chalk_1.bold(chalk_1.yellow('[Warning]'))} The environment, service and version tags have not been configured. Learn more about Datadog unified service tagging: ${chalk_1.underline(chalk_1.blueBright('https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/#serverless-environment.'))}
|
|
980
|
+
${chalk_1.bold(chalk_1.yellow('[Warning]'))} Instrument your ${chalk_1.hex('#FF9900').bold('Lambda')} functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run \`${chalk_1.bold('uninstrument')}\` with the same arguments to revert the changes.\n
|
|
981
|
+
${chalk_1.bold(chalk_1.yellow('[!]'))} Functions to be updated:
|
|
982
|
+
\t- ${chalk_1.bold('arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world')}
|
|
983
|
+
\t${chalk_1.bold(chalk_1.yellow('[Warning]'))} At least one latest layer version is being used. Ensure to lock in versions for production applications using \`--layerVersion\` and \`--extensionVersion\`.
|
|
984
|
+
\t- ${chalk_1.bold('arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2')}
|
|
985
|
+
\t${chalk_1.bold(chalk_1.yellow('[Warning]'))} At least one latest layer version is being used. Ensure to lock in versions for production applications using \`--layerVersion\` and \`--extensionVersion\`.\n
|
|
986
|
+
Will apply the following updates:
|
|
987
|
+
UpdateFunctionConfiguration -> arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world
|
|
988
|
+
{
|
|
989
|
+
\\"FunctionName\\": \\"arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world\\",
|
|
990
|
+
\\"Handler\\": \\"/opt/nodejs/node_modules/datadog-lambda-js/handler.handler\\",
|
|
991
|
+
\\"Environment\\": {
|
|
992
|
+
\\"Variables\\": {
|
|
993
|
+
\\"DD_LAMBDA_HANDLER\\": \\"index.handler\\",
|
|
994
|
+
\\"DD_API_KEY\\": \\"02aeb762fff59ac0d5ad1536cd9633bd\\",
|
|
995
|
+
\\"DD_SITE\\": \\"datadoghq.com\\",
|
|
996
|
+
\\"DD_CAPTURE_LAMBDA_PAYLOAD\\": \\"false\\",
|
|
997
|
+
\\"DD_MERGE_XRAY_TRACES\\": \\"false\\",
|
|
998
|
+
\\"DD_TRACE_ENABLED\\": \\"true\\",
|
|
999
|
+
\\"DD_FLUSH_TO_LOG\\": \\"true\\"
|
|
1000
|
+
}
|
|
1001
|
+
},
|
|
1002
|
+
\\"Layers\\": [
|
|
1003
|
+
\\"arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Extension:1\\",
|
|
1004
|
+
\\"arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Node12-x:1\\"
|
|
1005
|
+
]
|
|
1006
|
+
}
|
|
1007
|
+
TagResource -> arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world
|
|
1008
|
+
{
|
|
1009
|
+
\\"dd_sls_ci\\": \\"v${version}\\"
|
|
1010
|
+
}
|
|
1011
|
+
UpdateFunctionConfiguration -> arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2
|
|
1012
|
+
{
|
|
1013
|
+
\\"FunctionName\\": \\"arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2\\",
|
|
1014
|
+
\\"Handler\\": \\"/opt/nodejs/node_modules/datadog-lambda-js/handler.handler\\",
|
|
1015
|
+
\\"Environment\\": {
|
|
1016
|
+
\\"Variables\\": {
|
|
1017
|
+
\\"DD_LAMBDA_HANDLER\\": \\"index.handler\\",
|
|
1018
|
+
\\"DD_API_KEY\\": \\"02aeb762fff59ac0d5ad1536cd9633bd\\",
|
|
1019
|
+
\\"DD_SITE\\": \\"datadoghq.com\\",
|
|
1020
|
+
\\"DD_CAPTURE_LAMBDA_PAYLOAD\\": \\"false\\",
|
|
1021
|
+
\\"DD_MERGE_XRAY_TRACES\\": \\"false\\",
|
|
1022
|
+
\\"DD_TRACE_ENABLED\\": \\"true\\",
|
|
1023
|
+
\\"DD_FLUSH_TO_LOG\\": \\"true\\"
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
\\"Layers\\": [
|
|
1027
|
+
\\"arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Extension:1\\",
|
|
1028
|
+
\\"arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Node14-x:1\\"
|
|
1029
|
+
]
|
|
1030
|
+
}
|
|
1031
|
+
TagResource -> arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2
|
|
1032
|
+
{
|
|
1033
|
+
\\"dd_sls_ci\\": \\"v${version}\\"
|
|
1034
|
+
}
|
|
1035
|
+
${chalk_1.yellow('[!]')} Confirmation needed.
|
|
1036
|
+
${chalk_1.yellow('[!]')} Instrumenting functions.
|
|
1037
|
+
"
|
|
1038
|
+
`);
|
|
1039
|
+
}));
|
|
1040
|
+
test('aborts if a problem occurs while setting the AWS credentials interactively', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1041
|
+
;
|
|
1042
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
1043
|
+
prompt_1.requestAWSCredentials.mockImplementation(() => Promise.reject('Unexpected error'));
|
|
1044
|
+
const cli = fixtures_1.makeCli();
|
|
1045
|
+
const context = fixtures_1.createMockContext();
|
|
1046
|
+
const code = yield cli.run(['lambda', 'instrument', '-i'], context);
|
|
1047
|
+
const output = context.stdout.toString();
|
|
1048
|
+
expect(code).toBe(1);
|
|
1049
|
+
expect(output).toMatchInlineSnapshot(`
|
|
1050
|
+
"${chalk_1.bold(chalk_1.yellow('[!]'))} No existing AWS credentials found, let's set them up!
|
|
1051
|
+
${chalk_1.red('[Error]')} Unexpected error
|
|
1052
|
+
"
|
|
1053
|
+
`);
|
|
1054
|
+
}));
|
|
1055
|
+
test('aborts if a problem occurs while setting the Datadog Environment Variables interactively', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1056
|
+
process.env = {
|
|
1057
|
+
[constants_1.AWS_ACCESS_KEY_ID_ENV_VAR]: fixtures_1.mockAwsAccessKeyId,
|
|
1058
|
+
[constants_1.AWS_SECRET_ACCESS_KEY_ENV_VAR]: fixtures_1.mockAwsSecretAccessKey,
|
|
1059
|
+
[constants_1.AWS_DEFAULT_REGION_ENV_VAR]: 'sa,-east-1',
|
|
1060
|
+
};
|
|
1061
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
1062
|
+
prompt_1.requestDatadogEnvVars.mockImplementation(() => Promise.reject('Unexpected error'));
|
|
1063
|
+
const cli = fixtures_1.makeCli();
|
|
1064
|
+
const context = fixtures_1.createMockContext();
|
|
1065
|
+
const code = yield cli.run(['lambda', 'instrument', '-i'], context);
|
|
1066
|
+
const output = context.stdout.toString();
|
|
1067
|
+
expect(code).toBe(1);
|
|
1068
|
+
expect(output).toMatchInlineSnapshot(`
|
|
1069
|
+
"${chalk_1.bold(chalk_1.yellow('[!]'))} Configure Datadog settings.
|
|
1070
|
+
${chalk_1.red('[Error]')} Unexpected error
|
|
1071
|
+
"
|
|
1072
|
+
`);
|
|
1073
|
+
}));
|
|
1074
|
+
test('aborts if there are no functions to instrument in the user AWS account', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1075
|
+
process.env = {
|
|
1076
|
+
[constants_1.AWS_ACCESS_KEY_ID_ENV_VAR]: fixtures_1.mockAwsAccessKeyId,
|
|
1077
|
+
[constants_1.AWS_SECRET_ACCESS_KEY_ENV_VAR]: fixtures_1.mockAwsSecretAccessKey,
|
|
1078
|
+
[constants_1.AWS_DEFAULT_REGION_ENV_VAR]: 'sa-east-1',
|
|
1079
|
+
[constants_1.CI_SITE_ENV_VAR]: 'datadoghq.com',
|
|
1080
|
+
[constants_1.CI_API_KEY_ENV_VAR]: fixtures_1.mockDatadogApiKey,
|
|
1081
|
+
};
|
|
1082
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
1083
|
+
aws_sdk_1.Lambda.mockImplementation(() => fixtures_1.makeMockLambda({}));
|
|
1084
|
+
const cli = fixtures_1.makeCli();
|
|
1085
|
+
const context = fixtures_1.createMockContext();
|
|
1086
|
+
const code = yield cli.run(['lambda', 'instrument', '-i'], context);
|
|
1087
|
+
const output = context.stdout.toString();
|
|
1088
|
+
expect(code).toBe(1);
|
|
1089
|
+
expect(output).toMatchInlineSnapshot(`
|
|
1090
|
+
"Fetching Lambda functions, this might take a while.
|
|
1091
|
+
${chalk_1.red('[Error]')} Couldn't find any Lambda functions in the specified region.
|
|
1092
|
+
"
|
|
1093
|
+
`);
|
|
1094
|
+
}));
|
|
1095
|
+
test('aborts early when the aws-sdk throws an error while instrumenting interactively', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1096
|
+
process.env = {
|
|
1097
|
+
[constants_1.AWS_ACCESS_KEY_ID_ENV_VAR]: fixtures_1.mockAwsAccessKeyId,
|
|
1098
|
+
[constants_1.AWS_SECRET_ACCESS_KEY_ENV_VAR]: fixtures_1.mockAwsSecretAccessKey,
|
|
1099
|
+
[constants_1.AWS_DEFAULT_REGION_ENV_VAR]: 'sa-east-1',
|
|
1100
|
+
[constants_1.CI_SITE_ENV_VAR]: 'datadoghq.com',
|
|
1101
|
+
[constants_1.CI_API_KEY_ENV_VAR]: fixtures_1.mockDatadogApiKey,
|
|
1102
|
+
};
|
|
1103
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
1104
|
+
aws_sdk_1.Lambda.mockImplementation(() => ({
|
|
1105
|
+
listFunctions: jest.fn().mockImplementation(() => ({ promise: () => Promise.reject('Lambda failed') })),
|
|
1106
|
+
}));
|
|
1107
|
+
const cli = fixtures_1.makeCli();
|
|
1108
|
+
const context = fixtures_1.createMockContext();
|
|
1109
|
+
const code = yield cli.run(['lambda', 'instrument', '-i'], context);
|
|
1110
|
+
const output = context.stdout.toString();
|
|
1111
|
+
expect(code).toBe(1);
|
|
1112
|
+
expect(output).toMatchInlineSnapshot(`
|
|
1113
|
+
"Fetching Lambda functions, this might take a while.
|
|
1114
|
+
${chalk_1.red('[Error]')} Couldn't fetch Lambda functions. Error: Max retry count exceeded.
|
|
1115
|
+
"
|
|
1116
|
+
`);
|
|
1117
|
+
}));
|
|
1118
|
+
test('aborts early when a layer version is set for Java', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1119
|
+
;
|
|
1120
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
1121
|
+
aws_sdk_1.Lambda.mockImplementation(() => fixtures_1.makeMockLambda({
|
|
1122
|
+
'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world': {
|
|
1123
|
+
FunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world',
|
|
1124
|
+
Runtime: 'java8.al2',
|
|
1125
|
+
},
|
|
1126
|
+
}));
|
|
1127
|
+
const cli = fixtures_1.makeCli();
|
|
1128
|
+
const context = fixtures_1.createMockContext();
|
|
1129
|
+
const functionARN = 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world';
|
|
1130
|
+
process.env.DATADOG_API_KEY = '1234';
|
|
1131
|
+
const code = yield cli.run([
|
|
1132
|
+
'lambda',
|
|
1133
|
+
'instrument',
|
|
1134
|
+
'-f',
|
|
1135
|
+
functionARN,
|
|
1136
|
+
'--dry',
|
|
1137
|
+
'-v',
|
|
1138
|
+
'6',
|
|
1139
|
+
'--extra-tags',
|
|
1140
|
+
'layer:api,team:intake',
|
|
1141
|
+
'--service',
|
|
1142
|
+
'middletier',
|
|
1143
|
+
'--env',
|
|
1144
|
+
'staging',
|
|
1145
|
+
'--version',
|
|
1146
|
+
'0.2',
|
|
1147
|
+
], context);
|
|
1148
|
+
const output = context.stdout.toString();
|
|
1149
|
+
expect(code).toBe(1);
|
|
1150
|
+
expect(output).toMatchInlineSnapshot(`
|
|
1151
|
+
"${chalk_1.red('[Error]')} Couldn't fetch Lambda functions. Error: Only the --extension-version argument should be set for the java8.al2 runtime. Please remove the --layer-version argument from the instrument command.
|
|
1152
|
+
"
|
|
1153
|
+
`);
|
|
1154
|
+
}));
|
|
1155
|
+
test('aborts early when a layer version is set for Ruby', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1156
|
+
;
|
|
1157
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
1158
|
+
aws_sdk_1.Lambda.mockImplementation(() => fixtures_1.makeMockLambda({
|
|
1159
|
+
'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world': {
|
|
1160
|
+
FunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world',
|
|
1161
|
+
Runtime: 'ruby2.7',
|
|
1162
|
+
},
|
|
1163
|
+
}));
|
|
1164
|
+
const cli = fixtures_1.makeCli();
|
|
1165
|
+
const context = fixtures_1.createMockContext();
|
|
1166
|
+
const functionARN = 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world';
|
|
1167
|
+
process.env.DATADOG_API_KEY = '1234';
|
|
1168
|
+
const code = yield cli.run([
|
|
1169
|
+
'lambda',
|
|
1170
|
+
'instrument',
|
|
1171
|
+
'-f',
|
|
1172
|
+
functionARN,
|
|
1173
|
+
'--dry',
|
|
1174
|
+
'-v',
|
|
1175
|
+
'40',
|
|
1176
|
+
'--extra-tags',
|
|
1177
|
+
'layer:api,team:intake',
|
|
1178
|
+
'--service',
|
|
1179
|
+
'middletier',
|
|
1180
|
+
'--env',
|
|
1181
|
+
'staging',
|
|
1182
|
+
'--version',
|
|
1183
|
+
'0.2',
|
|
1184
|
+
], context);
|
|
1185
|
+
const output = context.stdout.toString();
|
|
1186
|
+
expect(code).toBe(1);
|
|
1187
|
+
expect(output).toMatchInlineSnapshot(`
|
|
1188
|
+
"${chalk_1.red('[Error]')} Couldn't fetch Lambda functions. Error: Only the --extension-version argument should be set for the ruby2.7 runtime. Please remove the --layer-version argument from the instrument command.
|
|
1189
|
+
"
|
|
1190
|
+
`);
|
|
1191
|
+
}));
|
|
1192
|
+
test('aborts early when a layer version is set for a Custom runtime', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1193
|
+
;
|
|
1194
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
1195
|
+
aws_sdk_1.Lambda.mockImplementation(() => fixtures_1.makeMockLambda({
|
|
1196
|
+
'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world': {
|
|
1197
|
+
FunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world',
|
|
1198
|
+
Runtime: 'provided.al2',
|
|
1199
|
+
},
|
|
1200
|
+
}));
|
|
1201
|
+
const cli = fixtures_1.makeCli();
|
|
1202
|
+
const context = fixtures_1.createMockContext();
|
|
1203
|
+
const functionARN = 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world';
|
|
1204
|
+
process.env.DATADOG_API_KEY = '1234';
|
|
1205
|
+
const code = yield cli.run([
|
|
1206
|
+
'lambda',
|
|
1207
|
+
'instrument',
|
|
1208
|
+
'-f',
|
|
1209
|
+
functionARN,
|
|
1210
|
+
'--dry',
|
|
1211
|
+
'-v',
|
|
1212
|
+
'6',
|
|
1213
|
+
'--extra-tags',
|
|
1214
|
+
'layer:api,team:intake',
|
|
1215
|
+
'--service',
|
|
1216
|
+
'middletier',
|
|
1217
|
+
'--env',
|
|
1218
|
+
'staging',
|
|
1219
|
+
'--version',
|
|
1220
|
+
'0.2',
|
|
1221
|
+
], context);
|
|
1222
|
+
const output = context.stdout.toString();
|
|
1223
|
+
expect(code).toBe(1);
|
|
1224
|
+
expect(output).toMatchInlineSnapshot(`
|
|
1225
|
+
"${chalk_1.red('[Error]')} Couldn't fetch Lambda functions. Error: Only the --extension-version argument should be set for the provided.al2 runtime. Please remove the --layer-version argument from the instrument command.
|
|
1226
|
+
"
|
|
1227
|
+
`);
|
|
1228
|
+
}));
|
|
1229
|
+
test('aborts early when .NET is using ARM64 architecture', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1230
|
+
;
|
|
1231
|
+
fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
|
|
1232
|
+
aws_sdk_1.Lambda.mockImplementation(() => fixtures_1.makeMockLambda({
|
|
1233
|
+
'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world': {
|
|
1234
|
+
Architectures: ['arm64'],
|
|
1235
|
+
FunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world',
|
|
1236
|
+
Runtime: 'dotnetcore3.1',
|
|
1237
|
+
},
|
|
1238
|
+
}));
|
|
1239
|
+
const cli = fixtures_1.makeCli();
|
|
1240
|
+
const context = fixtures_1.createMockContext();
|
|
1241
|
+
const functionARN = 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world';
|
|
1242
|
+
process.env.DATADOG_API_KEY = '1234';
|
|
1243
|
+
const code = yield cli.run([
|
|
1244
|
+
'lambda',
|
|
1245
|
+
'instrument',
|
|
1246
|
+
'-f',
|
|
1247
|
+
functionARN,
|
|
1248
|
+
'--dry',
|
|
1249
|
+
'-v',
|
|
1250
|
+
'6',
|
|
1251
|
+
'--extra-tags',
|
|
1252
|
+
'layer:api,team:intake',
|
|
1253
|
+
'--service',
|
|
1254
|
+
'middletier',
|
|
1255
|
+
'--env',
|
|
1256
|
+
'staging',
|
|
1257
|
+
'--version',
|
|
1258
|
+
'0.2',
|
|
1259
|
+
], context);
|
|
1260
|
+
const output = context.stdout.toString();
|
|
1261
|
+
expect(code).toBe(1);
|
|
1262
|
+
expect(output).toMatchInlineSnapshot(`
|
|
1263
|
+
"${chalk_1.red('[Error]')} Couldn't fetch Lambda functions. Error: Instrumenting arm64 architecture is not currently supported for .NET. Please only instrument .NET functions using x86_64 architecture.
|
|
1264
|
+
"
|
|
1265
|
+
`);
|
|
1266
|
+
}));
|
|
634
1267
|
});
|
|
635
1268
|
describe('getSettings', () => {
|
|
636
1269
|
test('uses config file settings', () => {
|
|
@@ -645,14 +1278,20 @@ describe('lambda', () => {
|
|
|
645
1278
|
command['config']['tracing'] = 'false';
|
|
646
1279
|
command['config']['logLevel'] = 'debug';
|
|
647
1280
|
expect(command['getSettings']()).toEqual({
|
|
1281
|
+
captureLambdaPayload: false,
|
|
1282
|
+
environment: undefined,
|
|
648
1283
|
extensionVersion: 6,
|
|
1284
|
+
extraTags: undefined,
|
|
649
1285
|
flushMetricsToLogs: false,
|
|
650
1286
|
forwarderARN: 'my-forwarder',
|
|
1287
|
+
interactive: false,
|
|
651
1288
|
layerAWSAccount: 'another-account',
|
|
652
1289
|
layerVersion: 2,
|
|
653
1290
|
logLevel: 'debug',
|
|
654
1291
|
mergeXrayTraces: false,
|
|
1292
|
+
service: undefined,
|
|
655
1293
|
tracingEnabled: false,
|
|
1294
|
+
version: undefined,
|
|
656
1295
|
});
|
|
657
1296
|
});
|
|
658
1297
|
test('prefers command line arguments over config file', () => {
|
|
@@ -673,8 +1312,10 @@ describe('lambda', () => {
|
|
|
673
1312
|
command['logLevel'] = 'debug';
|
|
674
1313
|
command['config']['logLevel'] = 'info';
|
|
675
1314
|
expect(command['getSettings']()).toEqual({
|
|
1315
|
+
captureLambdaPayload: false,
|
|
676
1316
|
flushMetricsToLogs: false,
|
|
677
1317
|
forwarderARN: 'my-forwarder',
|
|
1318
|
+
interactive: false,
|
|
678
1319
|
layerAWSAccount: 'my-account',
|
|
679
1320
|
layerVersion: 1,
|
|
680
1321
|
logLevel: 'debug',
|
|
@@ -704,30 +1345,37 @@ describe('lambda', () => {
|
|
|
704
1345
|
process.env = {};
|
|
705
1346
|
const command = fixtures_1.createCommand(instrument_1.InstrumentCommand);
|
|
706
1347
|
const validSettings = {
|
|
1348
|
+
captureLambdaPayload: true,
|
|
707
1349
|
extensionVersion: undefined,
|
|
708
1350
|
flushMetricsToLogs: false,
|
|
709
1351
|
forwarderARN: undefined,
|
|
1352
|
+
interactive: false,
|
|
710
1353
|
layerAWSAccount: undefined,
|
|
711
1354
|
layerVersion: undefined,
|
|
712
1355
|
logLevel: undefined,
|
|
713
1356
|
mergeXrayTraces: false,
|
|
714
1357
|
tracingEnabled: true,
|
|
715
1358
|
};
|
|
1359
|
+
command['config']['captureLambdaPayload'] = 'truE';
|
|
716
1360
|
command['config']['flushMetricsToLogs'] = 'False';
|
|
717
1361
|
command['config']['mergeXrayTraces'] = 'falSE';
|
|
718
1362
|
command['config']['tracing'] = 'TRUE';
|
|
719
1363
|
expect(command['getSettings']()).toEqual(validSettings);
|
|
1364
|
+
command['config']['captureLambdaPayload'] = 'true';
|
|
720
1365
|
command['config']['flushMetricsToLogs'] = 'false';
|
|
721
1366
|
command['config']['mergeXrayTraces'] = 'false';
|
|
722
1367
|
command['config']['tracing'] = 'true';
|
|
723
1368
|
expect(command['getSettings']()).toEqual(validSettings);
|
|
1369
|
+
validSettings.captureLambdaPayload = false;
|
|
724
1370
|
validSettings.flushMetricsToLogs = true;
|
|
725
1371
|
validSettings.mergeXrayTraces = true;
|
|
726
1372
|
validSettings.tracingEnabled = false;
|
|
1373
|
+
command['captureLambdaPayload'] = 'faLSE';
|
|
727
1374
|
command['flushMetricsToLogs'] = 'truE';
|
|
728
1375
|
command['mergeXrayTraces'] = 'TRUe';
|
|
729
1376
|
command['tracing'] = 'FALSE';
|
|
730
1377
|
expect(command['getSettings']()).toEqual(validSettings);
|
|
1378
|
+
command['captureLambdaPayload'] = 'false';
|
|
731
1379
|
command['flushMetricsToLogs'] = 'true';
|
|
732
1380
|
command['mergeXrayTraces'] = 'true';
|
|
733
1381
|
command['tracing'] = 'false';
|
|
@@ -807,7 +1455,6 @@ describe('lambda', () => {
|
|
|
807
1455
|
{
|
|
808
1456
|
functionARN: 'my-func',
|
|
809
1457
|
lambdaConfig: {},
|
|
810
|
-
lambdaLibraryLayerArn: 'my-layer',
|
|
811
1458
|
logGroupConfiguration: {
|
|
812
1459
|
createLogGroupRequest: { logGroupName: 'my-log-group' },
|
|
813
1460
|
deleteSubscriptionFilterRequest: { filterName: 'my-filter' },
|
|
@@ -818,22 +1465,24 @@ describe('lambda', () => {
|
|
|
818
1465
|
]);
|
|
819
1466
|
const output = command.context.stdout.toString();
|
|
820
1467
|
expect(output).toMatchInlineSnapshot(`
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
1468
|
+
"${chalk_1.bold(chalk_1.yellow('[Warning]'))} Instrument your ${chalk_1.hex('#FF9900').bold('Lambda')} functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run \`${chalk_1.bold('uninstrument')}\` with the same arguments to revert the changes.
|
|
1469
|
+
\n${chalk_1.bold(chalk_1.yellow('[!]'))} Functions to be updated:
|
|
1470
|
+
\t- ${chalk_1.bold('my-func')}\n
|
|
1471
|
+
Will apply the following updates:
|
|
1472
|
+
CreateLogGroup -> my-log-group
|
|
1473
|
+
{
|
|
1474
|
+
\\"logGroupName\\": \\"my-log-group\\"
|
|
1475
|
+
}
|
|
1476
|
+
DeleteSubscriptionFilter -> my-log-group
|
|
1477
|
+
{
|
|
1478
|
+
\\"filterName\\": \\"my-filter\\"
|
|
1479
|
+
}
|
|
1480
|
+
PutSubscriptionFilter -> my-log-group
|
|
1481
|
+
{
|
|
1482
|
+
\\"filterName\\": \\"my-filter\\"
|
|
1483
|
+
}
|
|
1484
|
+
"
|
|
1485
|
+
`);
|
|
837
1486
|
});
|
|
838
1487
|
});
|
|
839
1488
|
});
|