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