@datadog/datadog-ci 3.3.1 → 3.5.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.
Files changed (403) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/cloud-run/flare.js +14 -14
  4. package/dist/commands/cloud-run/flare.js.map +1 -1
  5. package/dist/commands/coverage/renderer.js +2 -2
  6. package/dist/commands/coverage/renderer.js.map +1 -1
  7. package/dist/commands/coverage/upload.js +10 -11
  8. package/dist/commands/coverage/upload.js.map +1 -1
  9. package/dist/commands/coverage/utils.js +2 -2
  10. package/dist/commands/coverage/utils.js.map +1 -1
  11. package/dist/commands/dsyms/renderer.js +3 -3
  12. package/dist/commands/dsyms/renderer.js.map +1 -1
  13. package/dist/commands/dsyms/upload.js +9 -9
  14. package/dist/commands/dsyms/upload.js.map +1 -1
  15. package/dist/commands/dsyms/utils.js +4 -4
  16. package/dist/commands/dsyms/utils.js.map +1 -1
  17. package/dist/commands/elf-symbols/upload.js +4 -4
  18. package/dist/commands/elf-symbols/upload.js.map +1 -1
  19. package/dist/commands/flutter-symbols/helpers.js +5 -25
  20. package/dist/commands/flutter-symbols/helpers.js.map +1 -1
  21. package/dist/commands/flutter-symbols/upload.js +2 -2
  22. package/dist/commands/flutter-symbols/upload.js.map +1 -1
  23. package/dist/commands/git-metadata/gitdb.js +4 -4
  24. package/dist/commands/git-metadata/gitdb.js.map +1 -1
  25. package/dist/commands/junit/api.js +2 -2
  26. package/dist/commands/junit/api.js.map +1 -1
  27. package/dist/commands/junit/renderer.js +2 -2
  28. package/dist/commands/junit/renderer.js.map +1 -1
  29. package/dist/commands/junit/upload.js +7 -7
  30. package/dist/commands/junit/upload.js.map +1 -1
  31. package/dist/commands/lambda/constants.d.ts +3 -0
  32. package/dist/commands/lambda/constants.js +5 -2
  33. package/dist/commands/lambda/constants.js.map +1 -1
  34. package/dist/commands/lambda/flare.js +18 -18
  35. package/dist/commands/lambda/flare.js.map +1 -1
  36. package/dist/commands/lambda/functions/instrument.js +10 -0
  37. package/dist/commands/lambda/functions/instrument.js.map +1 -1
  38. package/dist/commands/lambda/functions/uninstrument.js +3 -0
  39. package/dist/commands/lambda/functions/uninstrument.js.map +1 -1
  40. package/dist/commands/lambda/instrument.d.ts +1 -0
  41. package/dist/commands/lambda/instrument.js +5 -2
  42. package/dist/commands/lambda/instrument.js.map +1 -1
  43. package/dist/commands/lambda/interfaces.d.ts +3 -0
  44. package/dist/commands/pe-symbols/upload.js +2 -3
  45. package/dist/commands/pe-symbols/upload.js.map +1 -1
  46. package/dist/commands/react-native/codepush.js +7 -2
  47. package/dist/commands/react-native/codepush.js.map +1 -1
  48. package/dist/commands/react-native/utils.d.ts +1 -0
  49. package/dist/commands/react-native/utils.js +5 -1
  50. package/dist/commands/react-native/utils.js.map +1 -1
  51. package/dist/commands/react-native/xcode.js +1 -2
  52. package/dist/commands/react-native/xcode.js.map +1 -1
  53. package/dist/commands/sarif/renderer.js +3 -3
  54. package/dist/commands/sarif/renderer.js.map +1 -1
  55. package/dist/commands/sarif/upload.js +5 -6
  56. package/dist/commands/sarif/upload.js.map +1 -1
  57. package/dist/commands/sbom/constants.d.ts +1 -0
  58. package/dist/commands/sbom/constants.js +2 -1
  59. package/dist/commands/sbom/constants.js.map +1 -1
  60. package/dist/commands/sbom/payload.js +66 -0
  61. package/dist/commands/sbom/payload.js.map +1 -1
  62. package/dist/commands/sbom/types.d.ts +13 -0
  63. package/dist/commands/sourcemaps/upload.js +4 -5
  64. package/dist/commands/sourcemaps/upload.js.map +1 -1
  65. package/dist/commands/sourcemaps/utils.js +2 -2
  66. package/dist/commands/sourcemaps/utils.js.map +1 -1
  67. package/dist/commands/span/cli.js +5 -0
  68. package/dist/commands/span/cli.js.map +1 -0
  69. package/dist/commands/span/span.d.ts +10 -0
  70. package/dist/commands/span/span.js +112 -0
  71. package/dist/commands/span/span.js.map +1 -0
  72. package/dist/commands/synthetics/api.d.ts +1 -1
  73. package/dist/commands/synthetics/api.js +40 -12
  74. package/dist/commands/synthetics/api.js.map +1 -1
  75. package/dist/commands/synthetics/batch.js +12 -11
  76. package/dist/commands/synthetics/batch.js.map +1 -1
  77. package/dist/commands/synthetics/build-and-test.d.ts +20 -3
  78. package/dist/commands/synthetics/build-and-test.js +157 -63
  79. package/dist/commands/synthetics/build-and-test.js.map +1 -1
  80. package/dist/commands/synthetics/interfaces.d.ts +71 -35
  81. package/dist/commands/synthetics/interfaces.js.map +1 -1
  82. package/dist/commands/synthetics/multilocator.js +2 -2
  83. package/dist/commands/synthetics/multilocator.js.map +1 -1
  84. package/dist/commands/synthetics/reporters/default.js +10 -9
  85. package/dist/commands/synthetics/reporters/default.js.map +1 -1
  86. package/dist/commands/synthetics/reporters/junit.js +74 -63
  87. package/dist/commands/synthetics/reporters/junit.js.map +1 -1
  88. package/dist/commands/synthetics/run-tests-command.js +5 -2
  89. package/dist/commands/synthetics/run-tests-command.js.map +1 -1
  90. package/dist/commands/synthetics/test.d.ts +2 -2
  91. package/dist/commands/synthetics/utils/internal.d.ts +3 -5
  92. package/dist/commands/synthetics/utils/internal.js +2 -17
  93. package/dist/commands/synthetics/utils/internal.js.map +1 -1
  94. package/dist/commands/synthetics/utils/public.d.ts +4 -4
  95. package/dist/commands/synthetics/utils/public.js +22 -11
  96. package/dist/commands/synthetics/utils/public.js.map +1 -1
  97. package/dist/commands/trace/helper.d.ts +16 -0
  98. package/dist/commands/trace/helper.js +123 -0
  99. package/dist/commands/trace/helper.js.map +1 -0
  100. package/dist/commands/trace/test-utils.d.ts +4 -0
  101. package/dist/commands/trace/{__tests__/trace.test.js → test-utils.js} +15 -41
  102. package/dist/commands/trace/test-utils.js.map +1 -0
  103. package/dist/commands/trace/trace.d.ts +2 -12
  104. package/dist/commands/trace/trace.js +14 -93
  105. package/dist/commands/trace/trace.js.map +1 -1
  106. package/dist/commands/unity-symbols/upload.js +7 -7
  107. package/dist/commands/unity-symbols/upload.js.map +1 -1
  108. package/dist/helpers/file-finder.js +3 -3
  109. package/dist/helpers/file-finder.js.map +1 -1
  110. package/dist/helpers/flare.js +6 -5
  111. package/dist/helpers/flare.js.map +1 -1
  112. package/dist/helpers/fs.js +3 -3
  113. package/dist/helpers/fs.js.map +1 -1
  114. package/dist/helpers/glob.d.ts +12 -0
  115. package/dist/helpers/glob.js +70 -0
  116. package/dist/helpers/glob.js.map +1 -0
  117. package/dist/helpers/interfaces.d.ts +5 -6
  118. package/dist/helpers/renderer.js +3 -3
  119. package/dist/helpers/renderer.js.map +1 -1
  120. package/dist/helpers/tags.js +3 -3
  121. package/dist/helpers/tags.js.map +1 -1
  122. package/dist/helpers/utils.d.ts +0 -1
  123. package/dist/helpers/utils.js +1 -12
  124. package/dist/helpers/utils.js.map +1 -1
  125. package/package.json +6 -5
  126. package/dist/__tests__/cli.test.js +0 -93
  127. package/dist/__tests__/cli.test.js.map +0 -1
  128. package/dist/commands/cloud-run/__tests__/fixtures.d.ts +0 -2
  129. package/dist/commands/cloud-run/__tests__/fixtures.js +0 -12
  130. package/dist/commands/cloud-run/__tests__/fixtures.js.map +0 -1
  131. package/dist/commands/cloud-run/__tests__/flare.test.d.ts +0 -1
  132. package/dist/commands/cloud-run/__tests__/flare.test.js +0 -557
  133. package/dist/commands/cloud-run/__tests__/flare.test.js.map +0 -1
  134. package/dist/commands/coverage/__tests__/upload.test.d.ts +0 -1
  135. package/dist/commands/coverage/__tests__/upload.test.js +0 -291
  136. package/dist/commands/coverage/__tests__/upload.test.js.map +0 -1
  137. package/dist/commands/coverage/__tests__/utils.test.d.ts +0 -1
  138. package/dist/commands/coverage/__tests__/utils.test.js +0 -47
  139. package/dist/commands/coverage/__tests__/utils.test.js.map +0 -1
  140. package/dist/commands/deployment/__tests__/correlate.test.d.ts +0 -1
  141. package/dist/commands/deployment/__tests__/correlate.test.js +0 -106
  142. package/dist/commands/deployment/__tests__/correlate.test.js.map +0 -1
  143. package/dist/commands/deployment/__tests__/mark.test.d.ts +0 -1
  144. package/dist/commands/deployment/__tests__/mark.test.js +0 -97
  145. package/dist/commands/deployment/__tests__/mark.test.js.map +0 -1
  146. package/dist/commands/dora/__tests__/deployment.test.d.ts +0 -1
  147. package/dist/commands/dora/__tests__/deployment.test.js +0 -203
  148. package/dist/commands/dora/__tests__/deployment.test.js.map +0 -1
  149. package/dist/commands/dsyms/__tests__/upload.test.d.ts +0 -1
  150. package/dist/commands/dsyms/__tests__/upload.test.js +0 -346
  151. package/dist/commands/dsyms/__tests__/upload.test.js.map +0 -1
  152. package/dist/commands/dsyms/__tests__/utils.test.d.ts +0 -1
  153. package/dist/commands/dsyms/__tests__/utils.test.js +0 -100
  154. package/dist/commands/dsyms/__tests__/utils.test.js.map +0 -1
  155. package/dist/commands/elf-symbols/__tests__/elf.test.d.ts +0 -1
  156. package/dist/commands/elf-symbols/__tests__/elf.test.js +0 -822
  157. package/dist/commands/elf-symbols/__tests__/elf.test.js.map +0 -1
  158. package/dist/commands/elf-symbols/__tests__/upload.test.d.ts +0 -1
  159. package/dist/commands/elf-symbols/__tests__/upload.test.js +0 -228
  160. package/dist/commands/elf-symbols/__tests__/upload.test.js.map +0 -1
  161. package/dist/commands/flutter-symbols/__tests__/upload.test.d.ts +0 -1
  162. package/dist/commands/flutter-symbols/__tests__/upload.test.js +0 -617
  163. package/dist/commands/flutter-symbols/__tests__/upload.test.js.map +0 -1
  164. package/dist/commands/gate/__tests__/evaluate.test.d.ts +0 -1
  165. package/dist/commands/gate/__tests__/evaluate.test.js +0 -398
  166. package/dist/commands/gate/__tests__/evaluate.test.js.map +0 -1
  167. package/dist/commands/gate/__tests__/scope.test.d.ts +0 -1
  168. package/dist/commands/gate/__tests__/scope.test.js +0 -29
  169. package/dist/commands/gate/__tests__/scope.test.js.map +0 -1
  170. package/dist/commands/git-metadata/__tests__/git.test.d.ts +0 -1
  171. package/dist/commands/git-metadata/__tests__/git.test.js +0 -132
  172. package/dist/commands/git-metadata/__tests__/git.test.js.map +0 -1
  173. package/dist/commands/git-metadata/__tests__/gitdb.test.d.ts +0 -1
  174. package/dist/commands/git-metadata/__tests__/gitdb.test.js +0 -1386
  175. package/dist/commands/git-metadata/__tests__/gitdb.test.js.map +0 -1
  176. package/dist/commands/git-metadata/__tests__/library.test.d.ts +0 -1
  177. package/dist/commands/git-metadata/__tests__/library.test.js +0 -118
  178. package/dist/commands/git-metadata/__tests__/library.test.js.map +0 -1
  179. package/dist/commands/git-metadata/__tests__/upload.test.d.ts +0 -1
  180. package/dist/commands/git-metadata/__tests__/upload.test.js +0 -52
  181. package/dist/commands/git-metadata/__tests__/upload.test.js.map +0 -1
  182. package/dist/commands/junit/__tests__/upload.test.d.ts +0 -1
  183. package/dist/commands/junit/__tests__/upload.test.js +0 -495
  184. package/dist/commands/junit/__tests__/upload.test.js.map +0 -1
  185. package/dist/commands/lambda/__tests__/fixtures.d.ts +0 -51
  186. package/dist/commands/lambda/__tests__/fixtures.js +0 -146
  187. package/dist/commands/lambda/__tests__/fixtures.js.map +0 -1
  188. package/dist/commands/lambda/__tests__/flare.test.d.ts +0 -1
  189. package/dist/commands/lambda/__tests__/flare.test.js +0 -730
  190. package/dist/commands/lambda/__tests__/flare.test.js.map +0 -1
  191. package/dist/commands/lambda/__tests__/functions/commons.test.d.ts +0 -1
  192. package/dist/commands/lambda/__tests__/functions/commons.test.js +0 -791
  193. package/dist/commands/lambda/__tests__/functions/commons.test.js.map +0 -1
  194. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.d.ts +0 -1
  195. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js +0 -386
  196. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js.map +0 -1
  197. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.d.ts +0 -1
  198. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js +0 -728
  199. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js.map +0 -1
  200. package/dist/commands/lambda/__tests__/functions/uninstrument.test.d.ts +0 -1
  201. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js +0 -513
  202. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js.map +0 -1
  203. package/dist/commands/lambda/__tests__/functions/versionChecker.test.d.ts +0 -1
  204. package/dist/commands/lambda/__tests__/functions/versionChecker.test.js +0 -33
  205. package/dist/commands/lambda/__tests__/functions/versionChecker.test.js.map +0 -1
  206. package/dist/commands/lambda/__tests__/instrument.test.d.ts +0 -1
  207. package/dist/commands/lambda/__tests__/instrument.test.js +0 -1599
  208. package/dist/commands/lambda/__tests__/instrument.test.js.map +0 -1
  209. package/dist/commands/lambda/__tests__/loggroup.test.d.ts +0 -1
  210. package/dist/commands/lambda/__tests__/loggroup.test.js +0 -340
  211. package/dist/commands/lambda/__tests__/loggroup.test.js.map +0 -1
  212. package/dist/commands/lambda/__tests__/prompt.test.d.ts +0 -1
  213. package/dist/commands/lambda/__tests__/prompt.test.js +0 -206
  214. package/dist/commands/lambda/__tests__/prompt.test.js.map +0 -1
  215. package/dist/commands/lambda/__tests__/tags.test.d.ts +0 -1
  216. package/dist/commands/lambda/__tests__/tags.test.js +0 -305
  217. package/dist/commands/lambda/__tests__/tags.test.js.map +0 -1
  218. package/dist/commands/lambda/__tests__/uninstrument.test.d.ts +0 -1
  219. package/dist/commands/lambda/__tests__/uninstrument.test.js +0 -722
  220. package/dist/commands/lambda/__tests__/uninstrument.test.js.map +0 -1
  221. package/dist/commands/measure/__tests__/measure.test.d.ts +0 -1
  222. package/dist/commands/measure/__tests__/measure.test.js +0 -102
  223. package/dist/commands/measure/__tests__/measure.test.js.map +0 -1
  224. package/dist/commands/pe-symbols/__tests__/pe.test.d.ts +0 -1
  225. package/dist/commands/pe-symbols/__tests__/pe.test.js +0 -81
  226. package/dist/commands/pe-symbols/__tests__/pe.test.js.map +0 -1
  227. package/dist/commands/react-native/__tests__/codepush.test.d.ts +0 -1
  228. package/dist/commands/react-native/__tests__/codepush.test.js +0 -161
  229. package/dist/commands/react-native/__tests__/codepush.test.js.map +0 -1
  230. package/dist/commands/react-native/__tests__/interfaces.test.d.ts +0 -1
  231. package/dist/commands/react-native/__tests__/interfaces.test.js +0 -33
  232. package/dist/commands/react-native/__tests__/interfaces.test.js.map +0 -1
  233. package/dist/commands/react-native/__tests__/upload.test.d.ts +0 -1
  234. package/dist/commands/react-native/__tests__/upload.test.js +0 -238
  235. package/dist/commands/react-native/__tests__/upload.test.js.map +0 -1
  236. package/dist/commands/react-native/__tests__/utils.test.d.ts +0 -1
  237. package/dist/commands/react-native/__tests__/utils.test.js +0 -27
  238. package/dist/commands/react-native/__tests__/utils.test.js.map +0 -1
  239. package/dist/commands/react-native/__tests__/xcode.test.d.ts +0 -1
  240. package/dist/commands/react-native/__tests__/xcode.test.js +0 -465
  241. package/dist/commands/react-native/__tests__/xcode.test.js.map +0 -1
  242. package/dist/commands/sarif/__tests__/upload.test.d.ts +0 -1
  243. package/dist/commands/sarif/__tests__/upload.test.js +0 -291
  244. package/dist/commands/sarif/__tests__/upload.test.js.map +0 -1
  245. package/dist/commands/sarif/__tests__/utils.test.d.ts +0 -1
  246. package/dist/commands/sarif/__tests__/utils.test.js +0 -26
  247. package/dist/commands/sarif/__tests__/utils.test.js.map +0 -1
  248. package/dist/commands/sarif/__tests__/validation.test.d.ts +0 -1
  249. package/dist/commands/sarif/__tests__/validation.test.js +0 -19
  250. package/dist/commands/sarif/__tests__/validation.test.js.map +0 -1
  251. package/dist/commands/sbom/__tests__/payload.test.d.ts +0 -1
  252. package/dist/commands/sbom/__tests__/payload.test.js +0 -436
  253. package/dist/commands/sbom/__tests__/payload.test.js.map +0 -1
  254. package/dist/commands/sbom/__tests__/validation.test.d.ts +0 -1
  255. package/dist/commands/sbom/__tests__/validation.test.js +0 -141
  256. package/dist/commands/sbom/__tests__/validation.test.js.map +0 -1
  257. package/dist/commands/sourcemaps/__tests__/upload.test.d.ts +0 -1
  258. package/dist/commands/sourcemaps/__tests__/upload.test.js +0 -270
  259. package/dist/commands/sourcemaps/__tests__/upload.test.js.map +0 -1
  260. package/dist/commands/sourcemaps/__tests__/utils.test.d.ts +0 -1
  261. package/dist/commands/sourcemaps/__tests__/utils.test.js +0 -31
  262. package/dist/commands/sourcemaps/__tests__/utils.test.js.map +0 -1
  263. package/dist/commands/stepfunctions/__tests__/awsCommands.test.d.ts +0 -1
  264. package/dist/commands/stepfunctions/__tests__/awsCommands.test.js +0 -210
  265. package/dist/commands/stepfunctions/__tests__/awsCommands.test.js.map +0 -1
  266. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.d.ts +0 -6
  267. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js +0 -45
  268. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js.map +0 -1
  269. package/dist/commands/stepfunctions/__tests__/fixtures/cli.d.ts +0 -5
  270. package/dist/commands/stepfunctions/__tests__/fixtures/cli.js +0 -19
  271. package/dist/commands/stepfunctions/__tests__/fixtures/cli.js.map +0 -1
  272. package/dist/commands/stepfunctions/__tests__/helpers.test.d.ts +0 -1
  273. package/dist/commands/stepfunctions/__tests__/helpers.test.js +0 -501
  274. package/dist/commands/stepfunctions/__tests__/helpers.test.js.map +0 -1
  275. package/dist/commands/stepfunctions/__tests__/instrument.test.d.ts +0 -1
  276. package/dist/commands/stepfunctions/__tests__/instrument.test.js +0 -431
  277. package/dist/commands/stepfunctions/__tests__/instrument.test.js.map +0 -1
  278. package/dist/commands/stepfunctions/__tests__/uninstrument.test.d.ts +0 -1
  279. package/dist/commands/stepfunctions/__tests__/uninstrument.test.js +0 -166
  280. package/dist/commands/stepfunctions/__tests__/uninstrument.test.js.map +0 -1
  281. package/dist/commands/synthetics/__tests__/api.test.d.ts +0 -1
  282. package/dist/commands/synthetics/__tests__/api.test.js +0 -416
  283. package/dist/commands/synthetics/__tests__/api.test.js.map +0 -1
  284. package/dist/commands/synthetics/__tests__/batch.test.d.ts +0 -1
  285. package/dist/commands/synthetics/__tests__/batch.test.js +0 -907
  286. package/dist/commands/synthetics/__tests__/batch.test.js.map +0 -1
  287. package/dist/commands/synthetics/__tests__/build-and-test.test.d.ts +0 -1
  288. package/dist/commands/synthetics/__tests__/build-and-test.test.js +0 -133
  289. package/dist/commands/synthetics/__tests__/build-and-test.test.js.map +0 -1
  290. package/dist/commands/synthetics/__tests__/cli.test.d.ts +0 -1
  291. package/dist/commands/synthetics/__tests__/cli.test.js +0 -1407
  292. package/dist/commands/synthetics/__tests__/cli.test.js.map +0 -1
  293. package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.d.ts +0 -1
  294. package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.js +0 -112
  295. package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.js.map +0 -1
  296. package/dist/commands/synthetics/__tests__/fixtures.d.ts +0 -123
  297. package/dist/commands/synthetics/__tests__/fixtures.js +0 -493
  298. package/dist/commands/synthetics/__tests__/fixtures.js.map +0 -1
  299. package/dist/commands/synthetics/__tests__/import-tests-lib.test.d.ts +0 -1
  300. package/dist/commands/synthetics/__tests__/import-tests-lib.test.js +0 -186
  301. package/dist/commands/synthetics/__tests__/import-tests-lib.test.js.map +0 -1
  302. package/dist/commands/synthetics/__tests__/mobile.test.d.ts +0 -1
  303. package/dist/commands/synthetics/__tests__/mobile.test.js +0 -376
  304. package/dist/commands/synthetics/__tests__/mobile.test.js.map +0 -1
  305. package/dist/commands/synthetics/__tests__/multilocator.test.d.ts +0 -1
  306. package/dist/commands/synthetics/__tests__/multilocator.test.js +0 -142
  307. package/dist/commands/synthetics/__tests__/multilocator.test.js.map +0 -1
  308. package/dist/commands/synthetics/__tests__/reporters/default.test.d.ts +0 -1
  309. package/dist/commands/synthetics/__tests__/reporters/default.test.js +0 -410
  310. package/dist/commands/synthetics/__tests__/reporters/default.test.js.map +0 -1
  311. package/dist/commands/synthetics/__tests__/reporters/junit.test.d.ts +0 -1
  312. package/dist/commands/synthetics/__tests__/reporters/junit.test.js +0 -354
  313. package/dist/commands/synthetics/__tests__/reporters/junit.test.js.map +0 -1
  314. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.d.ts +0 -1
  315. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js +0 -232
  316. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js.map +0 -1
  317. package/dist/commands/synthetics/__tests__/run-tests-lib.test.d.ts +0 -1
  318. package/dist/commands/synthetics/__tests__/run-tests-lib.test.js +0 -698
  319. package/dist/commands/synthetics/__tests__/run-tests-lib.test.js.map +0 -1
  320. package/dist/commands/synthetics/__tests__/test.test.d.ts +0 -1
  321. package/dist/commands/synthetics/__tests__/test.test.js +0 -268
  322. package/dist/commands/synthetics/__tests__/test.test.js.map +0 -1
  323. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.d.ts +0 -1
  324. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js +0 -21
  325. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js.map +0 -1
  326. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.d.ts +0 -1
  327. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js +0 -80
  328. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js.map +0 -1
  329. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.d.ts +0 -1
  330. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js +0 -109
  331. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js.map +0 -1
  332. package/dist/commands/synthetics/__tests__/utils/internal.test.d.ts +0 -1
  333. package/dist/commands/synthetics/__tests__/utils/internal.test.js +0 -161
  334. package/dist/commands/synthetics/__tests__/utils/internal.test.js.map +0 -1
  335. package/dist/commands/synthetics/__tests__/utils/public.test.d.ts +0 -1
  336. package/dist/commands/synthetics/__tests__/utils/public.test.js +0 -576
  337. package/dist/commands/synthetics/__tests__/utils/public.test.js.map +0 -1
  338. package/dist/commands/tag/__tests__/tag.test.d.ts +0 -1
  339. package/dist/commands/tag/__tests__/tag.test.js +0 -85
  340. package/dist/commands/tag/__tests__/tag.test.js.map +0 -1
  341. package/dist/commands/trace/__tests__/trace.test.d.ts +0 -1
  342. package/dist/commands/trace/__tests__/trace.test.js.map +0 -1
  343. package/dist/commands/unity-symbols/__tests__/upload.test.d.ts +0 -1
  344. package/dist/commands/unity-symbols/__tests__/upload.test.js +0 -369
  345. package/dist/commands/unity-symbols/__tests__/upload.test.js.map +0 -1
  346. package/dist/helpers/__tests__/app.test.d.ts +0 -1
  347. package/dist/helpers/__tests__/app.test.js +0 -31
  348. package/dist/helpers/__tests__/app.test.js.map +0 -1
  349. package/dist/helpers/__tests__/ci.test.d.ts +0 -1
  350. package/dist/helpers/__tests__/ci.test.js +0 -344
  351. package/dist/helpers/__tests__/ci.test.js.map +0 -1
  352. package/dist/helpers/__tests__/env.test.d.ts +0 -1
  353. package/dist/helpers/__tests__/env.test.js +0 -74
  354. package/dist/helpers/__tests__/env.test.js.map +0 -1
  355. package/dist/helpers/__tests__/fips.test.d.ts +0 -1
  356. package/dist/helpers/__tests__/fips.test.js +0 -30
  357. package/dist/helpers/__tests__/fips.test.js.map +0 -1
  358. package/dist/helpers/__tests__/fixtures.d.ts +0 -41
  359. package/dist/helpers/__tests__/fixtures.js +0 -80
  360. package/dist/helpers/__tests__/fixtures.js.map +0 -1
  361. package/dist/helpers/__tests__/flare.test.d.ts +0 -1
  362. package/dist/helpers/__tests__/flare.test.js +0 -226
  363. package/dist/helpers/__tests__/flare.test.js.map +0 -1
  364. package/dist/helpers/__tests__/fs.test.d.ts +0 -1
  365. package/dist/helpers/__tests__/fs.test.js +0 -189
  366. package/dist/helpers/__tests__/fs.test.js.map +0 -1
  367. package/dist/helpers/__tests__/id.test.d.ts +0 -1
  368. package/dist/helpers/__tests__/id.test.js +0 -24
  369. package/dist/helpers/__tests__/id.test.js.map +0 -1
  370. package/dist/helpers/__tests__/plist.test.d.ts +0 -1
  371. package/dist/helpers/__tests__/plist.test.js +0 -43
  372. package/dist/helpers/__tests__/plist.test.js.map +0 -1
  373. package/dist/helpers/__tests__/prompt.test.d.ts +0 -1
  374. package/dist/helpers/__tests__/prompt.test.js +0 -71
  375. package/dist/helpers/__tests__/prompt.test.js.map +0 -1
  376. package/dist/helpers/__tests__/retry.test.d.ts +0 -1
  377. package/dist/helpers/__tests__/retry.test.js +0 -99
  378. package/dist/helpers/__tests__/retry.test.js.map +0 -1
  379. package/dist/helpers/__tests__/tags.test.d.ts +0 -1
  380. package/dist/helpers/__tests__/tags.test.js +0 -362
  381. package/dist/helpers/__tests__/tags.test.js.map +0 -1
  382. package/dist/helpers/__tests__/upload.test.d.ts +0 -1
  383. package/dist/helpers/__tests__/upload.test.js +0 -231
  384. package/dist/helpers/__tests__/upload.test.js.map +0 -1
  385. package/dist/helpers/__tests__/user-provided-git.test.d.ts +0 -1
  386. package/dist/helpers/__tests__/user-provided-git.test.js +0 -119
  387. package/dist/helpers/__tests__/user-provided-git.test.js.map +0 -1
  388. package/dist/helpers/__tests__/utils.test.d.ts +0 -1
  389. package/dist/helpers/__tests__/utils.test.js +0 -429
  390. package/dist/helpers/__tests__/utils.test.js.map +0 -1
  391. package/dist/helpers/__tests__/validation.test.d.ts +0 -1
  392. package/dist/helpers/__tests__/validation.test.js +0 -25
  393. package/dist/helpers/__tests__/validation.test.js.map +0 -1
  394. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.d.ts +0 -1
  395. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js +0 -103
  396. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js.map +0 -1
  397. package/dist/helpers/git/__tests__/format-git-span-data.test.d.ts +0 -1
  398. package/dist/helpers/git/__tests__/format-git-span-data.test.js +0 -121
  399. package/dist/helpers/git/__tests__/format-git-span-data.test.js.map +0 -1
  400. package/dist/helpers/git/__tests__/get-git-data.test.d.ts +0 -1
  401. package/dist/helpers/git/__tests__/get-git-data.test.js +0 -72
  402. package/dist/helpers/git/__tests__/get-git-data.test.js.map +0 -1
  403. /package/dist/{__tests__/cli.test.d.ts → commands/span/cli.d.ts} +0 -0
@@ -1,722 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- jest.mock('fs');
36
- jest.mock('@aws-sdk/credential-providers', () => (Object.assign(Object.assign({}, jest.requireActual('@aws-sdk/credential-providers')), { fromIni: jest.fn() })));
37
- jest.mock('../prompt');
38
- jest.mock('../renderers/instrument-uninstrument-renderer');
39
- jest.mock('../../../helpers/prompt');
40
- jest.mock('../../../../package.json', () => ({ version: 'XXXX' }));
41
- const fs = __importStar(require("fs"));
42
- const client_lambda_1 = require("@aws-sdk/client-lambda");
43
- const credential_providers_1 = require("@aws-sdk/credential-providers");
44
- const aws_sdk_client_mock_1 = require("aws-sdk-client-mock");
45
- const constants_1 = require("../../../constants");
46
- const fixtures_1 = require("../../../helpers/__tests__/fixtures");
47
- const prompt_1 = require("../../../helpers/prompt");
48
- require("aws-sdk-client-mock-jest");
49
- const constants_2 = require("../constants");
50
- const prompt_2 = require("../prompt");
51
- const uninstrument_1 = require("../uninstrument");
52
- const fixtures_2 = require("./fixtures");
53
- describe('lambda', () => {
54
- const lambdaClientMock = (0, aws_sdk_client_mock_1.mockClient)(client_lambda_1.LambdaClient);
55
- describe('uninstrument', () => {
56
- describe('execute', () => {
57
- const OLD_ENV = process.env;
58
- beforeEach(() => {
59
- lambdaClientMock.reset();
60
- (0, fixtures_2.mockLambdaClientCommands)(lambdaClientMock);
61
- jest.resetModules();
62
- process.env = {};
63
- });
64
- afterAll(() => {
65
- process.env = OLD_ENV;
66
- });
67
- test('prints dry run data for a valid uninstrumentation', () => __awaiter(void 0, void 0, void 0, function* () {
68
- ;
69
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
70
- (0, fixtures_2.mockLambdaConfigurations)(lambdaClientMock, {
71
- 'arn:aws:lambda:us-east-1:000000000000:function:uninstrument': {
72
- config: {
73
- Architectures: ['x86_64'],
74
- Environment: {
75
- Variables: {
76
- [constants_1.ENVIRONMENT_ENV_VAR]: 'staging',
77
- [constants_2.FLUSH_TO_LOG_ENV_VAR]: 'true',
78
- [constants_2.LAMBDA_HANDLER_ENV_VAR]: 'lambda_function.lambda_handler',
79
- [constants_2.LOG_LEVEL_ENV_VAR]: 'debug',
80
- [constants_2.MERGE_XRAY_TRACES_ENV_VAR]: 'false',
81
- [constants_1.SERVICE_ENV_VAR]: 'middletier',
82
- [constants_1.SITE_ENV_VAR]: 'datadoghq.com',
83
- [constants_2.TRACE_ENABLED_ENV_VAR]: 'true',
84
- [constants_1.VERSION_ENV_VAR]: '0.2',
85
- [constants_2.APM_FLUSH_DEADLINE_MILLISECONDS_ENV_VAR]: '42',
86
- USER_VARIABLE: 'shouldnt be deleted by uninstrumentation',
87
- },
88
- },
89
- FunctionArn: 'arn:aws:lambda:us-east-1:000000000000:function:uninstrument',
90
- Handler: 'datadog_lambda.handler.handler',
91
- Layers: [
92
- {
93
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Extension:11',
94
- CodeSize: 0,
95
- SigningJobArn: 'some-signing-job-arn',
96
- SigningProfileVersionArn: 'some-signing-profile',
97
- },
98
- {
99
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Python38:49',
100
- CodeSize: 0,
101
- SigningJobArn: 'some-signing-job-arn',
102
- SigningProfileVersionArn: 'some-signing-profile',
103
- },
104
- ],
105
- Runtime: 'python3.8',
106
- },
107
- },
108
- });
109
- const cli = (0, fixtures_2.makeCli)();
110
- const context = (0, fixtures_1.createMockContext)();
111
- const functionARN = 'arn:aws:lambda:us-east-1:000000000000:function:uninstrument';
112
- process.env.DATADOG_API_KEY = '1234';
113
- const code = yield cli.run(['lambda', 'uninstrument', '-f', functionARN, '-r', 'us-east-1', '-d'], context);
114
- const output = context.stdout.toString();
115
- expect(code).toBe(0);
116
- expect(output).toMatchInlineSnapshot(`
117
- "
118
- [Dry Run] 🐶 Uninstrumenting Lambda function
119
-
120
- [!] Functions to be updated:
121
- - arn:aws:lambda:us-east-1:000000000000:function:uninstrument
122
-
123
- [Dry Run] Will apply the following updates:
124
- UpdateFunctionConfiguration -> arn:aws:lambda:us-east-1:000000000000:function:uninstrument
125
- {
126
- "FunctionName": "arn:aws:lambda:us-east-1:000000000000:function:uninstrument",
127
- "Handler": "lambda_function.lambda_handler",
128
- "Environment": {
129
- "Variables": {
130
- "USER_VARIABLE": "sh**********tion"
131
- }
132
- },
133
- "Layers": []
134
- }
135
- "
136
- `);
137
- }));
138
- test('runs function update command for valid uninstrumentation', () => __awaiter(void 0, void 0, void 0, function* () {
139
- ;
140
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
141
- (0, fixtures_2.mockLambdaConfigurations)(lambdaClientMock, {
142
- 'arn:aws:lambda:us-east-1:000000000000:function:uninstrument': {
143
- config: {
144
- Environment: {
145
- Variables: {
146
- [constants_1.ENVIRONMENT_ENV_VAR]: 'staging',
147
- [constants_2.FLUSH_TO_LOG_ENV_VAR]: 'true',
148
- [constants_2.LAMBDA_HANDLER_ENV_VAR]: 'lambda_function.lambda_handler',
149
- [constants_2.LOG_LEVEL_ENV_VAR]: 'debug',
150
- [constants_2.MERGE_XRAY_TRACES_ENV_VAR]: 'false',
151
- [constants_1.SERVICE_ENV_VAR]: 'middletier',
152
- [constants_1.SITE_ENV_VAR]: 'datadoghq.com',
153
- [constants_2.TRACE_ENABLED_ENV_VAR]: 'true',
154
- [constants_1.VERSION_ENV_VAR]: '0.2',
155
- USER_VARIABLE: 'shouldnt be deleted by uninstrumentation',
156
- },
157
- },
158
- FunctionArn: 'arn:aws:lambda:us-east-1:000000000000:function:uninstrument',
159
- Handler: 'datadog_lambda.handler.handler',
160
- Layers: [
161
- {
162
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Extension:11',
163
- CodeSize: 0,
164
- SigningJobArn: 'some-signing-job-arn',
165
- SigningProfileVersionArn: 'some-signing-profile',
166
- },
167
- {
168
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Python38:49',
169
- CodeSize: 0,
170
- SigningJobArn: 'some-signing-job-arn',
171
- SigningProfileVersionArn: 'some-signing-profile',
172
- },
173
- ],
174
- Runtime: 'python3.8',
175
- },
176
- },
177
- });
178
- const cli = (0, fixtures_2.makeCli)();
179
- const context = (0, fixtures_1.createMockContext)();
180
- const functionARN = 'arn:aws:lambda:us-east-1:000000000000:function:uninstrument';
181
- process.env.DATADOG_API_KEY = '1234';
182
- yield cli.run(['lambda', 'uninstrument', '-f', functionARN, '-r', 'us-east-1'], context);
183
- expect(lambdaClientMock).toHaveReceivedCommand(client_lambda_1.UpdateFunctionConfigurationCommand);
184
- }));
185
- test('aborts early when the aws-sdk throws an error', () => __awaiter(void 0, void 0, void 0, function* () {
186
- ;
187
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
188
- lambdaClientMock.on(client_lambda_1.GetFunctionCommand).rejects('Lambda Failed');
189
- process.env = {};
190
- const command = (0, fixtures_1.createCommand)(uninstrument_1.UninstrumentCommand);
191
- command['functions'] = ['my-func'];
192
- command['region'] = 'us-east-1';
193
- const code = yield command['execute']();
194
- const output = command.context.stdout.toString();
195
- expect(code).toBe(1);
196
- expect(output).toMatchInlineSnapshot(`
197
- "
198
- 🐶 Uninstrumenting Lambda function
199
- [Error] Couldn't fetch Lambda functions. Error: Lambda Failed
200
- "
201
- `);
202
- }));
203
- test("aborts early when function regions can't be found", () => __awaiter(void 0, void 0, void 0, function* () {
204
- ;
205
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
206
- const cli = (0, fixtures_2.makeCli)();
207
- const context = (0, fixtures_1.createMockContext)();
208
- const code = yield cli.run(['lambda', 'uninstrument', '--function', 'my-func'], context);
209
- const output = context.stdout.toString();
210
- expect(code).toBe(1);
211
- expect(output).toMatch('No default region specified for ["my-func"]. Use -r, --region, or use a full functionARN');
212
- }));
213
- test('aborts early when no functions are specified', () => __awaiter(void 0, void 0, void 0, function* () {
214
- ;
215
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
216
- const cli = (0, fixtures_2.makeCli)();
217
- const context = (0, fixtures_1.createMockContext)();
218
- const code = yield cli.run(['lambda', 'uninstrument'], context);
219
- const output = context.stdout.toString();
220
- expect(code).toBe(1);
221
- expect(output).toMatchInlineSnapshot(`
222
- "
223
- 🐶 Uninstrumenting Lambda function
224
- [Error] No functions specified to remove instrumentation.
225
- "
226
- `);
227
- }));
228
- test('aborts early when no functions are specified while using config file', () => __awaiter(void 0, void 0, void 0, function* () {
229
- ;
230
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
231
- process.env = {};
232
- const command = (0, fixtures_1.createCommand)(uninstrument_1.UninstrumentCommand);
233
- command['config']['region'] = 'ap-southeast-1';
234
- yield command['execute']();
235
- const output = command.context.stdout.toString();
236
- expect(output).toMatchInlineSnapshot(`
237
- "
238
- 🐶 Uninstrumenting Lambda function
239
- [Error] No functions specified to remove instrumentation.
240
- "
241
- `);
242
- }));
243
- test('aborts if functions and a pattern are set at the same time', () => __awaiter(void 0, void 0, void 0, function* () {
244
- ;
245
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
246
- process.env = {};
247
- let command = (0, fixtures_1.createCommand)(uninstrument_1.UninstrumentCommand);
248
- command['config']['region'] = 'ap-southeast-1';
249
- command['config']['functions'] = ['arn:aws:lambda:ap-southeast-1:123456789012:function:lambda-hello-world'];
250
- command['regExPattern'] = 'valid-pattern';
251
- yield command['execute']();
252
- let output = command.context.stdout.toString();
253
- expect(output).toMatch('Functions in config file and "--functions-regex" should not be used at the same time.\n');
254
- command = (0, fixtures_1.createCommand)(uninstrument_1.UninstrumentCommand);
255
- command['region'] = 'ap-southeast-1';
256
- command['functions'] = ['arn:aws:lambda:ap-southeast-1:123456789012:function:lambda-hello-world'];
257
- command['regExPattern'] = 'valid-pattern';
258
- yield command['execute']();
259
- output = command.context.stdout.toString();
260
- expect(output).toMatch('"--functions" and "--functions-regex" should not be used at the same time.\n');
261
- }));
262
- test('aborts if the regEx pattern is an ARN', () => __awaiter(void 0, void 0, void 0, function* () {
263
- ;
264
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
265
- process.env = {};
266
- const command = (0, fixtures_1.createCommand)(uninstrument_1.UninstrumentCommand);
267
- command['region'] = 'ap-southeast-1';
268
- command['regExPattern'] = 'arn:aws:lambda:ap-southeast-1:123456789012:function:*';
269
- const code = yield command['execute']();
270
- const output = command.context.stdout.toString();
271
- expect(code).toBe(1);
272
- expect(output).toMatch(`"--functions-regex" isn't meant to be used with ARNs.\n`);
273
- }));
274
- test('aborts if the regEx pattern is set but no region is specified', () => __awaiter(void 0, void 0, void 0, function* () {
275
- ;
276
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
277
- process.env = {};
278
- const command = (0, fixtures_1.createCommand)(uninstrument_1.UninstrumentCommand);
279
- command['regExPattern'] = 'my-function';
280
- const code = yield command['execute']();
281
- const output = command.context.stdout.toString();
282
- expect(code).toBe(1);
283
- expect(output).toMatch('No default region specified. [-r,--region]');
284
- }));
285
- test('aborts if the the aws-sdk fails', () => __awaiter(void 0, void 0, void 0, function* () {
286
- ;
287
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
288
- process.env = {};
289
- lambdaClientMock.on(client_lambda_1.ListFunctionsCommand).rejects('ListFunctionsError');
290
- const command = (0, fixtures_1.createCommand)(uninstrument_1.UninstrumentCommand);
291
- command['region'] = 'ap-southeast-1';
292
- command['regExPattern'] = 'my-function';
293
- const code = yield command['execute']();
294
- const output = command.context.stdout.toString();
295
- expect(code).toBe(1);
296
- expect(output).toMatchInlineSnapshot(`
297
- "
298
- 🐶 Uninstrumenting Lambda function
299
- [Error] Couldn't fetch Lambda functions. Error: ListFunctionsError
300
- "
301
- `);
302
- }));
303
- test('uninstrument multiple functions interactively', () => __awaiter(void 0, void 0, void 0, function* () {
304
- ;
305
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
306
- (0, fixtures_2.mockLambdaConfigurations)(lambdaClientMock, {
307
- 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world': {
308
- config: {
309
- Architectures: ['x86_64'],
310
- Environment: {
311
- Variables: {
312
- [constants_1.ENVIRONMENT_ENV_VAR]: 'staging',
313
- [constants_2.FLUSH_TO_LOG_ENV_VAR]: 'true',
314
- [constants_2.LAMBDA_HANDLER_ENV_VAR]: 'lambda_function.lambda_handler',
315
- [constants_2.LOG_LEVEL_ENV_VAR]: 'debug',
316
- [constants_2.MERGE_XRAY_TRACES_ENV_VAR]: 'false',
317
- [constants_1.SERVICE_ENV_VAR]: 'middletier',
318
- [constants_1.SITE_ENV_VAR]: 'datadoghq.com',
319
- [constants_2.TRACE_ENABLED_ENV_VAR]: 'true',
320
- [constants_1.VERSION_ENV_VAR]: '0.2',
321
- USER_VARIABLE: 'shouldnt be deleted by uninstrumentation',
322
- },
323
- },
324
- FunctionArn: 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world',
325
- FunctionName: 'lambda-hello-world',
326
- Handler: 'datadog_lambda.handler.handler',
327
- Layers: [
328
- {
329
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Extension:11',
330
- CodeSize: 0,
331
- SigningJobArn: 'some-signing-job-arn',
332
- SigningProfileVersionArn: 'some-signing-profile',
333
- },
334
- {
335
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Python38:49',
336
- CodeSize: 0,
337
- SigningJobArn: 'some-signing-job-arn',
338
- SigningProfileVersionArn: 'some-signing-profile',
339
- },
340
- ],
341
- Runtime: 'python3.8',
342
- },
343
- },
344
- 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2': {
345
- config: {
346
- Architectures: ['x86_64'],
347
- Environment: {
348
- Variables: {
349
- [constants_1.ENVIRONMENT_ENV_VAR]: 'staging',
350
- [constants_2.FLUSH_TO_LOG_ENV_VAR]: 'true',
351
- [constants_2.LAMBDA_HANDLER_ENV_VAR]: 'lambda_function.lambda_handler',
352
- [constants_2.LOG_LEVEL_ENV_VAR]: 'debug',
353
- [constants_2.MERGE_XRAY_TRACES_ENV_VAR]: 'false',
354
- [constants_1.SERVICE_ENV_VAR]: 'middletier',
355
- [constants_1.SITE_ENV_VAR]: 'datadoghq.com',
356
- [constants_2.TRACE_ENABLED_ENV_VAR]: 'true',
357
- [constants_1.VERSION_ENV_VAR]: '0.2',
358
- },
359
- },
360
- FunctionArn: 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2',
361
- FunctionName: 'lambda-hello-world-2',
362
- Handler: 'datadog_lambda.handler.handler',
363
- Layers: [
364
- {
365
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Extension:11',
366
- CodeSize: 0,
367
- SigningJobArn: 'some-signing-job-arn',
368
- SigningProfileVersionArn: 'some-signing-profile',
369
- },
370
- {
371
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Python39:49',
372
- CodeSize: 0,
373
- SigningJobArn: 'some-signing-job-arn',
374
- SigningProfileVersionArn: 'some-signing-profile',
375
- },
376
- ],
377
- Runtime: 'python3.9',
378
- },
379
- },
380
- });
381
- prompt_2.requestAWSCredentials.mockImplementation(() => {
382
- process.env[constants_2.AWS_ACCESS_KEY_ID_ENV_VAR] = fixtures_2.mockAwsAccessKeyId;
383
- process.env[constants_2.AWS_SECRET_ACCESS_KEY_ENV_VAR] = fixtures_2.mockAwsSecretAccessKey;
384
- process.env[constants_2.AWS_DEFAULT_REGION_ENV_VAR] = 'sa-east-1';
385
- });
386
- prompt_2.requestFunctionSelection.mockImplementation(() => [
387
- 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world',
388
- 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2',
389
- ]);
390
- prompt_1.requestConfirmation.mockImplementation(() => true);
391
- const cli = (0, fixtures_2.makeCli)();
392
- const context = (0, fixtures_1.createMockContext)();
393
- const code = yield cli.run(['lambda', 'uninstrument', '-i'], context);
394
- const output = context.stdout.toString();
395
- expect(code).toBe(0);
396
- expect(output).toMatchSnapshot();
397
- }));
398
- test('uninstrument multiple specified functions interactively', () => __awaiter(void 0, void 0, void 0, function* () {
399
- ;
400
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
401
- (0, fixtures_2.mockLambdaConfigurations)(lambdaClientMock, {
402
- 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world': {
403
- config: {
404
- Architectures: ['x86_64'],
405
- Environment: {
406
- Variables: {
407
- [constants_1.ENVIRONMENT_ENV_VAR]: 'staging',
408
- [constants_2.FLUSH_TO_LOG_ENV_VAR]: 'true',
409
- [constants_2.LAMBDA_HANDLER_ENV_VAR]: 'lambda_function.lambda_handler',
410
- [constants_2.LOG_LEVEL_ENV_VAR]: 'debug',
411
- [constants_2.MERGE_XRAY_TRACES_ENV_VAR]: 'false',
412
- [constants_1.SERVICE_ENV_VAR]: 'middletier',
413
- [constants_1.SITE_ENV_VAR]: 'datadoghq.com',
414
- [constants_2.TRACE_ENABLED_ENV_VAR]: 'true',
415
- [constants_1.VERSION_ENV_VAR]: '0.2',
416
- USER_VARIABLE: 'shouldnt be deleted by uninstrumentation',
417
- },
418
- },
419
- FunctionArn: 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world',
420
- FunctionName: 'lambda-hello-world',
421
- Handler: 'datadog_lambda.handler.handler',
422
- Layers: [
423
- {
424
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Extension:11',
425
- CodeSize: 0,
426
- SigningJobArn: 'some-signing-job-arn',
427
- SigningProfileVersionArn: 'some-signing-profile',
428
- },
429
- {
430
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Python38:49',
431
- CodeSize: 0,
432
- SigningJobArn: 'some-signing-job-arn',
433
- SigningProfileVersionArn: 'some-signing-profile',
434
- },
435
- ],
436
- Runtime: 'python3.8',
437
- },
438
- },
439
- 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2': {
440
- config: {
441
- Architectures: ['x86_64'],
442
- Environment: {
443
- Variables: {
444
- [constants_1.ENVIRONMENT_ENV_VAR]: 'staging',
445
- [constants_2.FLUSH_TO_LOG_ENV_VAR]: 'true',
446
- [constants_2.LAMBDA_HANDLER_ENV_VAR]: 'lambda_function.lambda_handler',
447
- [constants_2.LOG_LEVEL_ENV_VAR]: 'debug',
448
- [constants_2.MERGE_XRAY_TRACES_ENV_VAR]: 'false',
449
- [constants_1.SERVICE_ENV_VAR]: 'middletier',
450
- [constants_1.SITE_ENV_VAR]: 'datadoghq.com',
451
- [constants_2.TRACE_ENABLED_ENV_VAR]: 'true',
452
- [constants_1.VERSION_ENV_VAR]: '0.2',
453
- },
454
- },
455
- FunctionArn: 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2',
456
- FunctionName: 'lambda-hello-world-2',
457
- Handler: 'datadog_lambda.handler.handler',
458
- Layers: [
459
- {
460
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Extension:11',
461
- CodeSize: 0,
462
- SigningJobArn: 'some-signing-job-arn',
463
- SigningProfileVersionArn: 'some-signing-profile',
464
- },
465
- {
466
- Arn: 'arn:aws:lambda:sa-east-1:000000000000:layer:Datadog-Python39:49',
467
- CodeSize: 0,
468
- SigningJobArn: 'some-signing-job-arn',
469
- SigningProfileVersionArn: 'some-signing-profile',
470
- },
471
- ],
472
- Runtime: 'python3.9',
473
- },
474
- },
475
- });
476
- prompt_2.requestAWSCredentials.mockImplementation(() => {
477
- process.env[constants_2.AWS_ACCESS_KEY_ID_ENV_VAR] = fixtures_2.mockAwsAccessKeyId;
478
- process.env[constants_2.AWS_SECRET_ACCESS_KEY_ENV_VAR] = fixtures_2.mockAwsSecretAccessKey;
479
- process.env[constants_2.AWS_DEFAULT_REGION_ENV_VAR] = 'sa-east-1';
480
- });
481
- prompt_2.requestFunctionSelection.mockImplementation(() => [
482
- 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world',
483
- 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2',
484
- ]);
485
- prompt_1.requestConfirmation.mockImplementation(() => true);
486
- const cli = (0, fixtures_2.makeCli)();
487
- const context = (0, fixtures_1.createMockContext)();
488
- const code = yield cli.run([
489
- 'lambda',
490
- 'uninstrument',
491
- '-i',
492
- '-f',
493
- 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world',
494
- '-f',
495
- 'arn:aws:lambda:sa-east-1:123456789012:function:lambda-hello-world-2',
496
- ], context);
497
- const output = context.stdout.toString();
498
- expect(code).toBe(0);
499
- expect(output).toMatchSnapshot();
500
- }));
501
- test('aborts if a problem occurs while setting the AWS credentials interactively', () => __awaiter(void 0, void 0, void 0, function* () {
502
- ;
503
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
504
- prompt_2.requestAWSCredentials.mockImplementation(() => Promise.reject('Unexpected error'));
505
- const cli = (0, fixtures_2.makeCli)();
506
- const context = (0, fixtures_1.createMockContext)();
507
- const code = yield cli.run(['lambda', 'uninstrument', '-i'], context);
508
- const output = context.stdout.toString();
509
- expect(code).toBe(1);
510
- expect(output).toMatchInlineSnapshot(`
511
- "
512
- 🐶 Uninstrumenting Lambda function
513
- [!] No AWS credentials found, let's set them up! Or you can re-run the command and supply the AWS credentials in the same way when you invoke the AWS CLI.
514
- [Error] Unexpected error
515
- "
516
- `);
517
- }));
518
- test('aborts if there are no functions to uninstrument in the user AWS account', () => __awaiter(void 0, void 0, void 0, function* () {
519
- ;
520
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
521
- process.env = {
522
- [constants_2.AWS_ACCESS_KEY_ID_ENV_VAR]: fixtures_2.mockAwsAccessKeyId,
523
- [constants_2.AWS_SECRET_ACCESS_KEY_ENV_VAR]: fixtures_2.mockAwsSecretAccessKey,
524
- [constants_2.AWS_DEFAULT_REGION_ENV_VAR]: 'sa-east-1',
525
- };
526
- const cli = (0, fixtures_2.makeCli)();
527
- const context = (0, fixtures_1.createMockContext)();
528
- const code = yield cli.run(['lambda', 'uninstrument', '-i'], context);
529
- const output = context.stdout.toString();
530
- expect(code).toBe(1);
531
- expect(output).toMatchInlineSnapshot(`
532
- "
533
- 🐶 Uninstrumenting Lambda function
534
- [Error] Couldn't find any Lambda functions in the specified region.
535
- "
536
- `);
537
- }));
538
- test('aborts early when the aws-sdk throws an error while uninstrumenting interactively', () => __awaiter(void 0, void 0, void 0, function* () {
539
- ;
540
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
541
- process.env = {
542
- [constants_2.AWS_ACCESS_KEY_ID_ENV_VAR]: fixtures_2.mockAwsAccessKeyId,
543
- [constants_2.AWS_SECRET_ACCESS_KEY_ENV_VAR]: fixtures_2.mockAwsSecretAccessKey,
544
- [constants_2.AWS_DEFAULT_REGION_ENV_VAR]: 'sa-east-1',
545
- };
546
- lambdaClientMock.on(client_lambda_1.ListFunctionsCommand).rejects('ListFunctionsError');
547
- const cli = (0, fixtures_2.makeCli)();
548
- const context = (0, fixtures_1.createMockContext)();
549
- const code = yield cli.run(['lambda', 'uninstrument', '-i'], context);
550
- const output = context.stdout.toString();
551
- expect(code).toBe(1);
552
- expect(output).toMatchInlineSnapshot(`
553
- "
554
- 🐶 Uninstrumenting Lambda function
555
- [Error] Couldn't fetch Lambda functions. Error: ListFunctionsError
556
- "
557
- `);
558
- }));
559
- test('prints error when updating aws profile credentials fails', () => __awaiter(void 0, void 0, void 0, function* () {
560
- ;
561
- credential_providers_1.fromIni.mockImplementation(() => {
562
- throw Error('Update failed!');
563
- });
564
- const cli = (0, fixtures_2.makeCli)();
565
- const context = (0, fixtures_1.createMockContext)();
566
- const functionARN = 'arn:aws:lambda:us-east-1:123456789012:function:lambda-hello-world';
567
- const code = yield cli.run(['lambda', 'uninstrument', '-f', functionARN, '--profile', 'SOME-AWS-PROFILE'], context);
568
- const output = context.stdout.toString();
569
- expect(code).toBe(1);
570
- expect(output).toMatchInlineSnapshot(`
571
- "
572
- 🐶 Uninstrumenting Lambda function
573
- [Error] Error: Couldn't set AWS profile credentials. Update failed!
574
- "
575
- `);
576
- }));
577
- test('prints which functions failed to uninstrument without aborting when at least one function was uninstrumented correctly', () => __awaiter(void 0, void 0, void 0, function* () {
578
- ;
579
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
580
- const failingLambdas = [
581
- 'arn:aws:lambda:us-east-1:123456789012:function:lambda-1-us-east-1',
582
- 'arn:aws:lambda:us-east-1:123456789012:function:lambda-2-us-east-1',
583
- 'arn:aws:lambda:us-east-2:123456789012:function:lambda-1-us-east-2',
584
- ];
585
- (0, fixtures_2.mockLambdaConfigurations)(lambdaClientMock, {
586
- 'arn:aws:lambda:us-east-1:123456789012:function:lambda-1-us-east-1': {
587
- config: {
588
- FunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:lambda-1-us-east-1',
589
- FunctionName: 'lambda-1-us-east-1',
590
- Handler: 'index.handler',
591
- Runtime: 'nodejs16.x',
592
- },
593
- },
594
- 'arn:aws:lambda:us-east-1:123456789012:function:lambda-2-us-east-1': {
595
- config: {
596
- FunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:lambda-2-us-east-1',
597
- FunctionName: 'lambda-2-us-east-1',
598
- Handler: 'index.handler',
599
- Runtime: 'nodejs16.x',
600
- },
601
- },
602
- 'arn:aws:lambda:us-east-1:123456789012:function:lambda-3-us-east-1': {
603
- config: {
604
- FunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:lambda-3-us-east-1',
605
- FunctionName: 'lambda-3-us-east-1',
606
- Handler: 'index.handler',
607
- Runtime: 'nodejs16.x',
608
- },
609
- },
610
- 'arn:aws:lambda:us-east-2:123456789012:function:lambda-1-us-east-2': {
611
- config: {
612
- FunctionArn: 'arn:aws:lambda:us-east-2:123456789012:function:lambda-1-us-east-2',
613
- FunctionName: 'lambda-1-us-east-2',
614
- Handler: 'index.handler',
615
- Runtime: 'nodejs18.x',
616
- },
617
- },
618
- 'arn:aws:lambda:us-east-2:123456789012:function:lambda-2-us-east-2': {
619
- config: {
620
- FunctionArn: 'arn:aws:lambda:us-east-2:123456789012:function:lambda-2-us-east-2',
621
- FunctionName: 'lambda-2-us-east-2',
622
- Handler: 'index.handler',
623
- Runtime: 'nodejs18.x',
624
- },
625
- },
626
- 'arn:aws:lambda:us-east-2:123456789012:function:lambda-3-us-east-2': {
627
- config: {
628
- FunctionArn: 'arn:aws:lambda:us-east-2:123456789012:function:lambda-3-us-east-2',
629
- FunctionName: 'lambda-3-us-east-2',
630
- Handler: 'index.handler',
631
- Runtime: 'nodejs20.x',
632
- },
633
- },
634
- });
635
- for (const failingLambda of failingLambdas) {
636
- lambdaClientMock
637
- .on(client_lambda_1.UpdateFunctionConfigurationCommand, { FunctionName: failingLambda })
638
- .rejects('Unexpected error updating request');
639
- }
640
- const cli = (0, fixtures_2.makeCli)();
641
- const context = (0, fixtures_1.createMockContext)();
642
- const code = yield cli.run([
643
- 'lambda',
644
- 'instrument',
645
- '-f',
646
- 'arn:aws:lambda:us-east-1:123456789012:function:lambda-1-us-east-1',
647
- '-f',
648
- 'arn:aws:lambda:us-east-1:123456789012:function:lambda-2-us-east-1',
649
- '-f',
650
- 'arn:aws:lambda:us-east-1:123456789012:function:lambda-3-us-east-1',
651
- '-f',
652
- 'arn:aws:lambda:us-east-2:123456789012:function:lambda-1-us-east-2',
653
- '-f',
654
- 'arn:aws:lambda:us-east-2:123456789012:function:lambda-2-us-east-2',
655
- '-f',
656
- 'arn:aws:lambda:us-east-2:123456789012:function:lambda-3-us-east-2',
657
- ], context);
658
- const output = context.stdout.toString();
659
- expect(code).toBe(0);
660
- expect(output).toMatchSnapshot();
661
- }));
662
- test('aborts when every lambda function fails to update on uninstrument', () => __awaiter(void 0, void 0, void 0, function* () {
663
- ;
664
- fs.readFile.mockImplementation((a, b, callback) => callback({ code: 'ENOENT' }));
665
- const failingLambdas = [
666
- 'arn:aws:lambda:us-east-1:123456789012:function:lambda-1-us-east-1',
667
- 'arn:aws:lambda:us-east-2:123456789012:function:lambda-1-us-east-2',
668
- ];
669
- (0, fixtures_2.mockLambdaConfigurations)(lambdaClientMock, {
670
- 'arn:aws:lambda:us-east-1:123456789012:function:lambda-1-us-east-1': {
671
- config: {
672
- FunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:lambda-1-us-east-1',
673
- FunctionName: 'lambda-1-us-east-1',
674
- Handler: 'index.handler',
675
- Runtime: 'nodejs16.x',
676
- },
677
- },
678
- 'arn:aws:lambda:us-east-2:123456789012:function:lambda-1-us-east-2': {
679
- config: {
680
- FunctionArn: 'arn:aws:lambda:us-east-2:123456789012:function:lambda-1-us-east-2',
681
- FunctionName: 'lambda-1-us-east-2',
682
- Handler: 'index.handler',
683
- Runtime: 'nodejs18.x',
684
- },
685
- },
686
- });
687
- for (const failingLambda of failingLambdas) {
688
- lambdaClientMock
689
- .on(client_lambda_1.UpdateFunctionConfigurationCommand, { FunctionName: failingLambda })
690
- .rejects('Unexpected error updating request');
691
- }
692
- const cli = (0, fixtures_2.makeCli)();
693
- const context = (0, fixtures_1.createMockContext)();
694
- const code = yield cli.run([
695
- 'lambda',
696
- 'instrument',
697
- '-f',
698
- 'arn:aws:lambda:us-east-1:123456789012:function:lambda-1-us-east-1',
699
- '-f',
700
- 'arn:aws:lambda:us-east-2:123456789012:function:lambda-1-us-east-2',
701
- ], context);
702
- const output = context.stdout.toString();
703
- expect(code).toBe(1);
704
- expect(output).toMatchSnapshot();
705
- }));
706
- });
707
- describe('printPlannedActions', () => {
708
- test('prints no output when list is empty', () => {
709
- process.env = {};
710
- const command = (0, fixtures_1.createCommand)(uninstrument_1.UninstrumentCommand);
711
- command['printPlannedActions']([]);
712
- const output = command.context.stdout.toString();
713
- expect(output).toMatchInlineSnapshot(`
714
- "
715
- No updates will be applied.
716
- "
717
- `);
718
- });
719
- });
720
- });
721
- });
722
- //# sourceMappingURL=uninstrument.test.js.map