@aws-cdk-testing/cli-integ 3.4.5 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/lib/aws.js +6 -9
  2. package/lib/cli/query-github.js +2 -3
  3. package/lib/cli/run-suite.js +2 -3
  4. package/lib/cli/stage-distribution.js +4 -4
  5. package/lib/eventually.js +3 -3
  6. package/lib/files.js +2 -3
  7. package/lib/github.js +5 -6
  8. package/lib/integ-test.js +58 -3
  9. package/lib/package-sources/release-source.d.ts +1 -1
  10. package/lib/package-sources/release-source.js +2 -3
  11. package/lib/package-sources/repo-source.d.ts +1 -1
  12. package/lib/package-sources/repo-source.js +1 -1
  13. package/lib/package-sources/repo-tools/npm.js +4 -5
  14. package/lib/package-sources/subprocess.d.ts +1 -1
  15. package/lib/package-sources/subprocess.js +1 -1
  16. package/lib/process.js +5 -6
  17. package/lib/proxy.d.ts +1 -1
  18. package/lib/proxy.js +2 -2
  19. package/lib/resource-pool.js +5 -3
  20. package/lib/shell.d.ts +3 -3
  21. package/lib/shell.js +8 -12
  22. package/lib/staging/codeartifact.js +8 -11
  23. package/lib/staging/maven.d.ts +2 -2
  24. package/lib/staging/maven.js +3 -5
  25. package/lib/staging/npm.d.ts +2 -2
  26. package/lib/staging/npm.js +1 -1
  27. package/lib/staging/nuget.d.ts +2 -2
  28. package/lib/staging/nuget.js +1 -1
  29. package/lib/staging/parallel-shell.js +2 -2
  30. package/lib/staging/pypi.d.ts +2 -2
  31. package/lib/staging/pypi.js +1 -1
  32. package/lib/with-aws.d.ts +2 -2
  33. package/lib/with-aws.js +5 -4
  34. package/lib/with-cdk-app.d.ts +7 -5
  35. package/lib/with-cdk-app.js +30 -33
  36. package/lib/with-cli-lib.d.ts +4 -3
  37. package/lib/with-cli-lib.js +2 -1
  38. package/lib/with-packages.d.ts +1 -1
  39. package/lib/with-packages.js +1 -1
  40. package/lib/with-sam.d.ts +3 -3
  41. package/lib/with-sam.js +5 -7
  42. package/lib/with-temporary-directory.d.ts +1 -1
  43. package/lib/with-temporary-directory.js +1 -1
  44. package/lib/xpmutex.js +5 -3
  45. package/npm-shrinkwrap.json +8722 -0
  46. package/package.json +11 -7
  47. package/resources/cdk-apps/refactoring/cdk.json +7 -0
  48. package/resources/cdk-apps/refactoring/refactoring.js +18 -0
  49. package/test-reports/junit.xml +15 -0
  50. package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.js +11 -11
  51. package/tests/cli-integ-tests/cdk-assets/smoketest.integtest.js +9 -9
  52. package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.js +2 -3
  53. package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.js +2 -3
  54. package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.js +2 -3
  55. package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.js +2 -3
  56. package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.js +2 -3
  57. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.js +4 -6
  58. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.js +2 -3
  59. package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.js +4 -5
  60. package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.js +2 -3
  61. package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.js +1 -1
  62. package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.js +2 -3
  63. package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.js +3 -4
  64. package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.js +3 -4
  65. package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.js +2 -3
  66. package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.js +2 -3
  67. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.js +2 -3
  68. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.js +2 -3
  69. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.js +2 -3
  70. package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.js +3 -4
  71. package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.js +2 -3
  72. package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.js +2 -3
  73. package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.js +2 -3
  74. package/tests/cli-integ-tests/cdk-deploy.integtest.js +2 -3
  75. package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.js +6 -7
  76. package/tests/cli-integ-tests/cdk-fast-deploy.integtest.js +4 -5
  77. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.js +2 -2
  78. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.js +6 -5
  79. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.js +2 -3
  80. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.js +3 -4
  81. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.js +3 -4
  82. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.js +3 -4
  83. package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.js +5 -6
  84. package/tests/cli-integ-tests/cdk-import-interactive.integtest.js +5 -6
  85. package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.js +2 -3
  86. package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.js +1 -2
  87. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.js +1 -1
  88. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.js +1 -1
  89. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.js +1 -1
  90. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.js +1 -1
  91. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.js +1 -1
  92. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.js +1 -1
  93. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.js +1 -1
  94. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.js +1 -1
  95. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.js +1 -1
  96. package/tests/cli-integ-tests/cdk-migrate/testcase.d.ts +1 -1
  97. package/tests/cli-integ-tests/cdk-migrate/testcase.js +4 -6
  98. package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.js +2 -3
  99. package/tests/cli-integ-tests/cdk-refactor-dry-run.integtest.d.ts +1 -0
  100. package/tests/cli-integ-tests/cdk-refactor-dry-run.integtest.js +41 -0
  101. package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.js +2 -3
  102. package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.js +5 -6
  103. package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.js +4 -4
  104. package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.js +5 -6
  105. package/tests/cli-integ-tests/proxy.integtest.js +2 -3
  106. package/tests/init-go/init-go.integtest.js +2 -3
  107. package/tests/init-typescript-app/init-typescript-app.integtest.js +1 -1
  108. package/tests/tool-integrations/amplify.integtest.js +4 -4
  109. package/tests/tool-integrations/with-tool-context.d.ts +5 -5
  110. package/tests/tool-integrations/with-tool-context.js +1 -1
  111. package/.eslintrc.js +0 -9
  112. package/lib/aws.ts +0 -303
  113. package/lib/cli/query-github.ts +0 -56
  114. package/lib/cli/run-suite.ts +0 -153
  115. package/lib/cli/stage-distribution.ts +0 -262
  116. package/lib/cli/test-root.ts +0 -3
  117. package/lib/corking.ts +0 -33
  118. package/lib/eventually.ts +0 -42
  119. package/lib/files.ts +0 -80
  120. package/lib/github.ts +0 -43
  121. package/lib/index.ts +0 -13
  122. package/lib/integ-test.ts +0 -110
  123. package/lib/lists.ts +0 -9
  124. package/lib/memoize.ts +0 -14
  125. package/lib/npm.ts +0 -41
  126. package/lib/package-sources/release-source.ts +0 -82
  127. package/lib/package-sources/repo-source.ts +0 -112
  128. package/lib/package-sources/repo-tools/npm.ts +0 -48
  129. package/lib/package-sources/source.ts +0 -35
  130. package/lib/package-sources/subprocess.ts +0 -15
  131. package/lib/process.ts +0 -154
  132. package/lib/proxy.ts +0 -64
  133. package/lib/resource-pool.ts +0 -140
  134. package/lib/resources.ts +0 -4
  135. package/lib/shell.ts +0 -331
  136. package/lib/staging/codeartifact.ts +0 -387
  137. package/lib/staging/maven.ts +0 -95
  138. package/lib/staging/npm.ts +0 -62
  139. package/lib/staging/nuget.ts +0 -75
  140. package/lib/staging/parallel-shell.ts +0 -51
  141. package/lib/staging/pypi.ts +0 -50
  142. package/lib/staging/usage-dir.ts +0 -99
  143. package/lib/with-aws.ts +0 -111
  144. package/lib/with-cdk-app.ts +0 -845
  145. package/lib/with-cli-lib.ts +0 -149
  146. package/lib/with-packages.ts +0 -15
  147. package/lib/with-sam.ts +0 -294
  148. package/lib/with-temporary-directory.ts +0 -35
  149. package/lib/with-timeout.ts +0 -33
  150. package/lib/xpmutex.ts +0 -218
  151. package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/nested-stack.js +0 -19
  152. package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js +0 -134
  153. package/tests/cli-integ-tests/cdk---exclusively-selects-only-selected-stack.integtest.ts +0 -29
  154. package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.ts +0 -92
  155. package/tests/cli-integ-tests/cdk-assets/smoketest.integtest.ts +0 -82
  156. package/tests/cli-integ-tests/cdk-automatic-ordering-with-concurrency.integtest.ts +0 -15
  157. package/tests/cli-integ-tests/cdk-automatic-ordering.integtest.ts +0 -15
  158. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and---no-rollback-is-removed-from-flags.integtest.ts +0 -40
  159. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and-change-contains-a-replacement.integtest.ts +0 -40
  160. package/tests/cli-integ-tests/cdk-automatic-rollback-if-replacement-and---no-rollback-is-removed-from-flags.integtest.ts +0 -29
  161. package/tests/cli-integ-tests/cdk-bootstrap-a-customized-template-vendor-will-not-overwrite-the-default-template.integtest.ts +0 -42
  162. package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.ts +0 -26
  163. package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.ts +0 -28
  164. package/tests/cli-integ-tests/cdk-bootstrap-can-and-deploy-if-omitting-execution-policies.integtest.ts +0 -21
  165. package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.ts +0 -22
  166. package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.ts +0 -21
  167. package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.ts +0 -27
  168. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-modern-synthesized-stack-even-if-bootstrap-stack-name-is-unknown.integtest.ts +0 -24
  169. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-with-session-tags-on-the-deploy.integtest.ts +0 -25
  170. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-without-execution-role-and-with-session-tags-on-deploy-role.integtest.ts +0 -22
  171. package/tests/cli-integ-tests/cdk-bootstrap-can-dump-the-template.integtest.ts +0 -32
  172. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.ts +0 -77
  173. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.ts +0 -30
  174. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-(with-slashes)-to-bootstrap.integtest.ts +0 -15
  175. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-to-bootstrap.integtest.ts +0 -15
  176. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-default-permissions-boundary-to-bootstrap.integtest.ts +0 -15
  177. package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.ts +0 -34
  178. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap-(with-docker-image).integtest.ts +0 -22
  179. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap.integtest.ts +0 -22
  180. package/tests/cli-integ-tests/cdk-bootstrap-deploy-old-style-synthesis-to-new-style-bootstrap.integtest.ts +0 -21
  181. package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.ts +0 -24
  182. package/tests/cli-integ-tests/cdk-bootstrap-upgrade-legacy-bootstrap-stack-to-new-bootstrap-stack-while-in-use.integtest.ts +0 -47
  183. package/tests/cli-integ-tests/cdk-can-still-load-old-assemblies.integtest.ts +0 -57
  184. package/tests/cli-integ-tests/cdk-cdk-diff---fail-on-multiple-stacks-exits-with-error-if-any-of-the-stacks-contains-a-diff.integtest.ts +0 -22
  185. package/tests/cli-integ-tests/cdk-cdk-diff---fail-with-multiple-stack-exits-with-if-any-of-the-stacks-contains-a-diff.integtest.ts +0 -22
  186. package/tests/cli-integ-tests/cdk-cdk-diff---quiet-does-not-print-there-were-no-differences-message-for-stacks-which-have-no-differences.integtest.ts +0 -19
  187. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-changes-are-present.integtest.ts +0 -14
  188. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-access-control-config.integtest.ts +0 -13
  189. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-assignment.integtest.ts +0 -13
  190. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-with-managed-policy.integtest.ts +0 -13
  191. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-without-managed-policy.integtest.ts +0 -13
  192. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-access-control-information.integtest.ts +0 -35
  193. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-assignment-information.integtest.ts +0 -37
  194. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-with-managed-policy-information.integtest.ts +0 -35
  195. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-without-managed-policy-information.integtest.ts +0 -37
  196. package/tests/cli-integ-tests/cdk-cdk-diff-doesnt-show-resource-metadata-changes.integtest.ts +0 -23
  197. package/tests/cli-integ-tests/cdk-cdk-diff-shows-resource-metadata-changes-with---no-change-set.integtest.ts +0 -23
  198. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-and-custom-toolkit-stack-name-and-qualifier-does-not-fail.integtest.ts +0 -39
  199. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-does-not-fail.integtest.ts +0 -28
  200. package/tests/cli-integ-tests/cdk-cdk-diff.integtest.ts +0 -18
  201. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json---long.integtest.ts +0 -50
  202. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json.integtest.ts +0 -95
  203. package/tests/cli-integ-tests/cdk-cdk-ls.integtest.ts +0 -36
  204. package/tests/cli-integ-tests/cdk-cdk-notices-are-displayed-correctly.integtest.ts +0 -42
  205. package/tests/cli-integ-tests/cdk-cdk-notices-with---unacknowledged.integtest.ts +0 -14
  206. package/tests/cli-integ-tests/cdk-cdk-synth-add-the-metadata-properties-expected-by-sam.integtest.ts +0 -126
  207. package/tests/cli-integ-tests/cdk-cdk-synth-bundled-functions-as-expected.integtest.ts +0 -80
  208. package/tests/cli-integ-tests/cdk-cdk-synth.integtest.ts +0 -53
  209. package/tests/cli-integ-tests/cdk-ci-output-to-stderr.integtest.ts +0 -19
  210. package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.ts +0 -28
  211. package/tests/cli-integ-tests/cdk-construct-with-builtin-lambda-function.integtest.ts +0 -14
  212. package/tests/cli-integ-tests/cdk-context-in-stage-propagates-to-top.integtest.ts +0 -20
  213. package/tests/cli-integ-tests/cdk-context-setting.integtest.ts +0 -33
  214. package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.ts +0 -23
  215. package/tests/cli-integ-tests/cdk-deploy-all-concurrently.integtest.ts +0 -17
  216. package/tests/cli-integ-tests/cdk-deploy-all.integtest.ts +0 -14
  217. package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.ts +0 -31
  218. package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.ts +0 -50
  219. package/tests/cli-integ-tests/cdk-deploy-no-stacks-error.integtest.ts +0 -18
  220. package/tests/cli-integ-tests/cdk-deploy-no-stacks-with---ignore-no-stacks.integtest.ts +0 -17
  221. package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.ts +0 -51
  222. package/tests/cli-integ-tests/cdk-deploy-stack-with-docker-asset.integtest.ts +0 -11
  223. package/tests/cli-integ-tests/cdk-deploy-stack-with-lambda-asset-to-object-lock-enabled-asset-bucket.integtest.ts +0 -42
  224. package/tests/cli-integ-tests/cdk-deploy-stack-without-resource.integtest.ts +0 -32
  225. package/tests/cli-integ-tests/cdk-deploy-wildcard-with-outputs.integtest.ts +0 -28
  226. package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.ts +0 -29
  227. package/tests/cli-integ-tests/cdk-deploy-with-method-direct-and-import-existing-resources-fails.integtest.ts +0 -17
  228. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.ts +0 -36
  229. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.ts +0 -45
  230. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.ts +0 -37
  231. package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.ts +0 -33
  232. package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.ts +0 -26
  233. package/tests/cli-integ-tests/cdk-deploy-with-role.integtest.ts +0 -119
  234. package/tests/cli-integ-tests/cdk-deploy-with-wildcard-and-parameters.integtest.ts +0 -22
  235. package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.ts +0 -36
  236. package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.ts +0 -28
  237. package/tests/cli-integ-tests/cdk-deploy.integtest.ts +0 -20
  238. package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.ts +0 -36
  239. package/tests/cli-integ-tests/cdk-doubly-nested-stack.integtest.ts +0 -12
  240. package/tests/cli-integ-tests/cdk-enablediffnofail.integtest.ts +0 -44
  241. package/tests/cli-integ-tests/cdk-failed-deploy-does-not-hang.integtest.ts +0 -12
  242. package/tests/cli-integ-tests/cdk-fast-deploy.integtest.ts +0 -41
  243. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-ecr-images.integtest.ts +0 -48
  244. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-s3-objects.integtest.ts +0 -51
  245. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-ecr-images.integtest.ts +0 -48
  246. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-s3-objects.integtest.ts +0 -52
  247. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-ecr-images.integtest.ts +0 -47
  248. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-s3-objects.integtest.ts +0 -63
  249. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-ecr-images.integtest.ts +0 -55
  250. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.ts +0 -63
  251. package/tests/cli-integ-tests/cdk-generating-and-loading-assembly.integtest.ts +0 -52
  252. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-detects-failed-deployment-and-errors.integtest.ts +0 -29
  253. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.ts +0 -45
  254. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.ts +0 -36
  255. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.ts +0 -41
  256. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.ts +0 -53
  257. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.ts +0 -43
  258. package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.ts +0 -59
  259. package/tests/cli-integ-tests/cdk-iam-diff.integtest.ts +0 -23
  260. package/tests/cli-integ-tests/cdk-import-interactive.integtest.ts +0 -57
  261. package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.ts +0 -32
  262. package/tests/cli-integ-tests/cdk-lib-cli-lib-list.integtest.ts +0 -12
  263. package/tests/cli-integ-tests/cdk-lib-cli-lib-synth.integtest.ts +0 -27
  264. package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.ts +0 -32
  265. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.ts +0 -13
  266. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.ts +0 -14
  267. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.ts +0 -13
  268. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.ts +0 -13
  269. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.ts +0 -15
  270. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.ts +0 -15
  271. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.ts +0 -15
  272. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.ts +0 -15
  273. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.ts +0 -20
  274. package/tests/cli-integ-tests/cdk-migrate/testcase.ts +0 -69
  275. package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.ts +0 -28
  276. package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.ts +0 -39
  277. package/tests/cli-integ-tests/cdk-sam-can-locally-test-the-synthesized-cdk-application.integtest.ts +0 -25
  278. package/tests/cli-integ-tests/cdk-security-related-changes-without-a-cli-are-expected-to-fail.integtest.ts +0 -30
  279. package/tests/cli-integ-tests/cdk-skips-notice-refresh.integtest.ts +0 -26
  280. package/tests/cli-integ-tests/cdk-ssm-parameter-provider-error.integtest.ts +0 -18
  281. package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.ts +0 -59
  282. package/tests/cli-integ-tests/cdk-stage-with-bundled-lambda-function.integtest.ts +0 -13
  283. package/tests/cli-integ-tests/cdk-synth---quiet-can-be-specified-in-cdk.json.integtest.ts +0 -20
  284. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-can-be-suppressed.integtest.ts +0 -15
  285. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-leads-to-failure.integtest.ts +0 -18
  286. package/tests/cli-integ-tests/cdk-templates-on-disk-contain-metadata-resource.integtest.ts +0 -25
  287. package/tests/cli-integ-tests/cdk-termination-protection.integtest.ts +0 -19
  288. package/tests/cli-integ-tests/cdk-test-cdk-rollback---force.integtest.ts +0 -48
  289. package/tests/cli-integ-tests/cdk-test-cdk-rollback.integtest.ts +0 -38
  290. package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.ts +0 -56
  291. package/tests/cli-integ-tests/cdk-test-resource-import-with-construct-that-requires-bundling.integtest.ts +0 -74
  292. package/tests/cli-integ-tests/cdk-test-resource-import.integtest.ts +0 -64
  293. package/tests/cli-integ-tests/cdk-two-ways-of-showing-the-version.integtest.ts +0 -14
  294. package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.ts +0 -47
  295. package/tests/cli-integ-tests/cdk-vpc-lookup.integtest.ts +0 -26
  296. package/tests/cli-integ-tests/proxy.integtest.ts +0 -168
  297. package/tests/init-csharp/init-csharp.integtest.ts +0 -15
  298. package/tests/init-fsharp/init-fsharp.integtest.ts +0 -15
  299. package/tests/init-go/init-go.integtest.ts +0 -28
  300. package/tests/init-java/init-java.integtest.ts +0 -14
  301. package/tests/init-javascript/init-javascript.integtest.ts +0 -58
  302. package/tests/init-python/init-python.integtest.ts +0 -20
  303. package/tests/init-typescript-app/init-typescript-app.integtest.ts +0 -67
  304. package/tests/init-typescript-lib/init-typescript-lib.integtest.ts +0 -13
  305. package/tests/tool-integrations/amplify.integtest.ts +0 -117
  306. package/tests/tool-integrations/with-tool-context.ts +0 -14
  307. package/tests/uberpackage/uberpackage.integtest.ts +0 -11
@@ -1,149 +0,0 @@
1
- import * as os from 'os';
2
- import * as path from 'path';
3
- import { TestContext } from './integ-test';
4
- import { RESOURCES_DIR } from './resources';
5
- import { AwsContext, withAws } from './with-aws';
6
- import { cloneDirectory, installNpmPackages, TestFixture, DEFAULT_TEST_TIMEOUT_S, CdkCliOptions, DisableBootstrapContext, ensureBootstrapped } from './with-cdk-app';
7
- import { withTimeout } from './with-timeout';
8
-
9
- /**
10
- * Higher order function to execute a block with a CliLib Integration CDK app fixture
11
- */
12
- export function withCliLibIntegrationCdkApp<A extends TestContext & AwsContext & DisableBootstrapContext>(
13
- block: (context: CliLibIntegrationTestFixture) => Promise<void>) {
14
- return async (context: A) => {
15
- const randy = context.randomString;
16
- const stackNamePrefix = `cdktest-${randy}`;
17
- const integTestDir = path.join(os.tmpdir(), `cdk-integ-${randy}`);
18
-
19
- context.log(` Stack prefix: ${stackNamePrefix}\n`);
20
- context.log(` Test directory: ${integTestDir}\n`);
21
- context.log(` Region: ${context.aws.region}\n`);
22
-
23
- await cloneDirectory(path.join(RESOURCES_DIR, 'cdk-apps', 'simple-app'), integTestDir, context.output);
24
- const fixture = new CliLibIntegrationTestFixture(
25
- integTestDir,
26
- stackNamePrefix,
27
- context.output,
28
- context.aws,
29
- context.randomString);
30
-
31
- let success = true;
32
- try {
33
- const installationVersion = fixture.packages.requestedFrameworkVersion();
34
-
35
- if (fixture.packages.majorVersion() === '1') {
36
- throw new Error('This test suite is only compatible with AWS CDK v2');
37
- }
38
-
39
- const alphaInstallationVersion = fixture.packages.requestedAlphaVersion();
40
-
41
- // cli-lib-alpha has a magic alpha version in the old release pipeline,
42
- // but will just mirror the CLI version in the new pipeline.
43
- const cliLibVersion = process.env.CLI_LIB_VERSION_MIRRORS_CLI
44
- ? `${fixture.packages.requestedCliVersion()}-alpha.0`
45
- : alphaInstallationVersion;
46
-
47
- await installNpmPackages(fixture, {
48
- 'aws-cdk-lib': installationVersion,
49
- '@aws-cdk/cli-lib-alpha': cliLibVersion,
50
- '@aws-cdk/aws-lambda-go-alpha': alphaInstallationVersion,
51
- '@aws-cdk/aws-lambda-python-alpha': alphaInstallationVersion,
52
- 'constructs': '^10',
53
- });
54
-
55
- if (!context.disableBootstrap) {
56
- await ensureBootstrapped(fixture);
57
- }
58
-
59
- await block(fixture);
60
- } catch (e: any) {
61
- // We survive certain cases involving gopkg.in
62
- if (errorCausedByGoPkg(e.message)) {
63
- return;
64
- }
65
- success = false;
66
- throw e;
67
- } finally {
68
- if (process.env.INTEG_NO_CLEAN) {
69
- context.log(`Left test directory in '${integTestDir}' ($INTEG_NO_CLEAN)\n`);
70
- } else {
71
- await fixture.dispose(success);
72
- }
73
- }
74
- };
75
- }
76
-
77
- /**
78
- * Return whether or not the error is being caused by gopkg.in being down
79
- *
80
- * Our Go build depends on https://gopkg.in/, which has errors pretty often
81
- * (every couple of days). It is run by a single volunteer.
82
- */
83
- function errorCausedByGoPkg(error: string) {
84
- // The error is different depending on what request fails. Messages recognized:
85
- ////////////////////////////////////////////////////////////////////
86
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
87
- // gopkg.in/yaml.v3@v3.0.0-20200615113413-eeeca48fe776: invalid version: git ls-remote -q origin in /go/pkg/mod/cache/vcs/0901dc1ef67fcce1c9b3ae51078740de4a0e2dc673e720584ac302973af82f36: exit status 128:
88
- // remote: Cannot obtain refs from GitHub: cannot talk to GitHub: Get https://github.com/go-yaml/yaml.git/info/refs?service=git-upload-pack: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
89
- // fatal: unable to access 'https://gopkg.in/yaml.v3/': The requested URL returned error: 502
90
- ////////////////////////////////////////////////////////////////////
91
- // go: downloading github.com/aws/aws-lambda-go v1.28.0
92
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
93
- // gopkg.in/yaml.v3@v3.0.0-20200615113413-eeeca48fe776: unrecognized import path "gopkg.in/yaml.v3": reading https://gopkg.in/yaml.v3?go-get=1: 502 Bad Gateway
94
- // server response: Cannot obtain refs from GitHub: cannot talk to GitHub: Get https://github.com/go-yaml/yaml.git/info/refs?service=git-upload-pack: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
95
- ////////////////////////////////////////////////////////////////////
96
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
97
- // gopkg.in/yaml.v3@v3.0.0-20200615113413-eeeca48fe776: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/0901dc1ef67fcce1c9b3ae51078740de4a0e2dc673e720584ac302973af82f36: exit status 128:
98
- // error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502
99
- // fatal: the remote end hung up unexpectedly
100
- ////////////////////////////////////////////////////////////////////
101
-
102
- return (error.includes('gopkg\.in.*invalid version.*exit status 128')
103
- || error.match(/unrecognized import path[^\n]gopkg\.in/));
104
- }
105
-
106
- /**
107
- * SAM Integration test fixture for CDK - SAM integration test cases
108
- */
109
- export function withCliLibFixture(block: (context: CliLibIntegrationTestFixture) => Promise<void>) {
110
- return withAws(withTimeout(DEFAULT_TEST_TIMEOUT_S, withCliLibIntegrationCdkApp(block)));
111
- }
112
-
113
- export class CliLibIntegrationTestFixture extends TestFixture {
114
- /**
115
- *
116
- */
117
- public async cdk(args: string[], options: CdkCliOptions = {}) {
118
- const action = args[0];
119
- const stackName = args[1];
120
-
121
- const cliOpts: Record<string, any> = {
122
- stacks: stackName ? [stackName] : undefined,
123
- };
124
-
125
- if (action === 'deploy') {
126
- cliOpts.requireApproval = options.neverRequireApproval ? 'never' : 'broadening';
127
- }
128
-
129
- return this.shell(['node', '--input-type=module', `<<__EOS__
130
- import { AwsCdkCli } from '@aws-cdk/cli-lib-alpha';
131
- const cli = AwsCdkCli.fromCdkAppDirectory();
132
-
133
- await cli.${action}(${JSON.stringify(cliOpts)});
134
- __EOS__`], {
135
- ...options,
136
- modEnv: {
137
- ...this.cdkShellEnv(),
138
- AWS_REGION: this.aws.region,
139
- AWS_DEFAULT_REGION: this.aws.region,
140
- STACK_NAME_PREFIX: this.stackNamePrefix,
141
- PACKAGE_LAYOUT_VERSION: this.packages.majorVersion(),
142
- // In these tests we want to make a distinction between stdout and sterr
143
- CI: 'false',
144
- ...options.modEnv,
145
- },
146
- });
147
- }
148
- }
149
-
@@ -1,15 +0,0 @@
1
- import { IPackageSource } from './package-sources/source';
2
- import { packageSourceInSubprocess } from './package-sources/subprocess';
3
-
4
- export interface PackageContext {
5
- readonly packages: IPackageSource;
6
- }
7
-
8
- export function withPackages<A extends object>(block: (context: A & PackageContext) => Promise<void>) {
9
- return async (context: A) => {
10
- return block({
11
- ...context,
12
- packages: packageSourceInSubprocess(),
13
- });
14
- };
15
- }
package/lib/with-sam.ts DELETED
@@ -1,294 +0,0 @@
1
- import * as child_process from 'child_process';
2
- import * as os from 'os';
3
- import * as path from 'path';
4
- import axios from 'axios';
5
- import { TestContext } from './integ-test';
6
- import { RESOURCES_DIR } from './resources';
7
- import { ShellOptions, rimraf } from './shell';
8
- import { AwsContext, withAws } from './with-aws';
9
- import { cloneDirectory, installNpmPackages, TestFixture, DEFAULT_TEST_TIMEOUT_S } from './with-cdk-app';
10
- import { withTimeout } from './with-timeout';
11
-
12
- export interface ActionOutput {
13
- actionSucceeded?: boolean;
14
- actionOutput?: any;
15
- shellOutput?: string;
16
- }
17
-
18
- /**
19
- * Higher order function to execute a block with a SAM Integration CDK app fixture
20
- */
21
- export function withSamIntegrationCdkApp<A extends TestContext & AwsContext>(block: (context: SamIntegrationTestFixture) => Promise<void>) {
22
- return async (context: A) => {
23
- const randy = context.randomString;
24
- const stackNamePrefix = `cdktest-${randy}`;
25
- const integTestDir = path.join(os.tmpdir(), `cdk-integ-${randy}`);
26
-
27
- context.log(` Stack prefix: ${stackNamePrefix}\n`);
28
- context.log(` Test directory: ${integTestDir}\n`);
29
- context.log(` Region: ${context.aws.region}\n`);
30
-
31
- await cloneDirectory(path.join(RESOURCES_DIR, 'cdk-apps', 'sam_cdk_integ_app'), integTestDir, context.output);
32
- const fixture = new SamIntegrationTestFixture(
33
- integTestDir,
34
- stackNamePrefix,
35
- context.output,
36
- context.aws,
37
- context.randomString);
38
-
39
- let success = true;
40
- try {
41
- const installationVersion = fixture.packages.requestedFrameworkVersion();
42
-
43
- if (fixture.packages.majorVersion() === '1') {
44
- await installNpmPackages(fixture, {
45
- '@aws-cdk/aws-iam': installationVersion,
46
- '@aws-cdk/aws-apigateway': installationVersion,
47
- '@aws-cdk/aws-lambda': installationVersion,
48
- '@aws-cdk/aws-lambda-go': installationVersion,
49
- '@aws-cdk/aws-lambda-nodejs': installationVersion,
50
- '@aws-cdk/aws-lambda-python': installationVersion,
51
- '@aws-cdk/aws-logs': installationVersion,
52
- '@aws-cdk/core': installationVersion,
53
- 'constructs': '^3',
54
- });
55
- } else {
56
- const alphaInstallationVersion = fixture.packages.requestedAlphaVersion();
57
- await installNpmPackages(fixture, {
58
- 'aws-cdk-lib': installationVersion,
59
- '@aws-cdk/aws-lambda-go-alpha': alphaInstallationVersion,
60
- '@aws-cdk/aws-lambda-python-alpha': alphaInstallationVersion,
61
- 'constructs': '^10',
62
- });
63
- }
64
- await block(fixture);
65
- } catch (e: any) {
66
- // We survive certain cases involving gopkg.in
67
- if (errorCausedByGoPkg(e.message)) {
68
- return;
69
- }
70
- success = false;
71
- throw e;
72
- } finally {
73
- if (process.env.INTEG_NO_CLEAN) {
74
- context.log(`Left test directory in '${integTestDir}' ($INTEG_NO_CLEAN)\n`);
75
- } else {
76
- await fixture.dispose(success);
77
- }
78
- }
79
- };
80
- }
81
-
82
- /**
83
- * Return whether or not the error is being caused by gopkg.in being down
84
- *
85
- * Our Go build depends on https://gopkg.in/, which has errors pretty often
86
- * (every couple of days). It is run by a single volunteer.
87
- */
88
- function errorCausedByGoPkg(error: string) {
89
- // The error is different depending on what request fails. Messages recognized:
90
- ////////////////////////////////////////////////////////////////////
91
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
92
- // gopkg.in/yaml.v3@v3.0.0-20200615113413-eeeca48fe776: invalid version: git ls-remote -q origin in /go/pkg/mod/cache/vcs/0901dc1ef67fcce1c9b3ae51078740de4a0e2dc673e720584ac302973af82f36: exit status 128:
93
- // remote: Cannot obtain refs from GitHub: cannot talk to GitHub: Get https://github.com/go-yaml/yaml.git/info/refs?service=git-upload-pack: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
94
- // fatal: unable to access 'https://gopkg.in/yaml.v3/': The requested URL returned error: 502
95
- ////////////////////////////////////////////////////////////////////
96
- // go: downloading github.com/aws/aws-lambda-go v1.28.0
97
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
98
- // gopkg.in/yaml.v3@v3.0.0-20200615113413-eeeca48fe776: unrecognized import path "gopkg.in/yaml.v3": reading https://gopkg.in/yaml.v3?go-get=1: 502 Bad Gateway
99
- // server response: Cannot obtain refs from GitHub: cannot talk to GitHub: Get https://github.com/go-yaml/yaml.git/info/refs?service=git-upload-pack: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
100
- ////////////////////////////////////////////////////////////////////
101
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
102
- // gopkg.in/yaml.v3@v3.0.0-20200615113413-eeeca48fe776: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/0901dc1ef67fcce1c9b3ae51078740de4a0e2dc673e720584ac302973af82f36: exit status 128:
103
- // error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502
104
- // fatal: the remote end hung up unexpectedly
105
- ////////////////////////////////////////////////////////////////////
106
-
107
- return (error.includes('gopkg\.in.*invalid version.*exit status 128')
108
- || error.match(/unrecognized import path[^\n]gopkg\.in/));
109
- }
110
-
111
- /**
112
- * SAM Integration test fixture for CDK - SAM integration test cases
113
- */
114
- export function withSamIntegrationFixture(block: (context: SamIntegrationTestFixture) => Promise<void>) {
115
- return withAws(withTimeout(DEFAULT_TEST_TIMEOUT_S, withSamIntegrationCdkApp(block)));
116
- }
117
-
118
- export class SamIntegrationTestFixture extends TestFixture {
119
- public async samShell(command: string[], filter?: string, action?: () => any, options: Omit<ShellOptions, 'cwd' | 'output'> = {}): Promise<ActionOutput> {
120
- return shellWithAction(command, filter, action, {
121
- outputs: [this.output],
122
- cwd: path.join(this.integTestDir, 'cdk.out').toString(),
123
- ...options,
124
- });
125
- }
126
-
127
- public async samBuild(stackName: string) {
128
- const fullStackName = this.fullStackName(stackName);
129
- const templatePath = path.join(this.integTestDir, 'cdk.out', `${fullStackName}.template.json`);
130
- const args = ['--template', templatePath.toString()];
131
- return this.samShell(['sam', 'build', ...args]);
132
- }
133
-
134
- public async samLocalStartApi(stackName: string, isBuilt: boolean, port: number, apiPath: string): Promise<ActionOutput> {
135
- const fullStackName = this.fullStackName(stackName);
136
- const templatePath = path.join(this.integTestDir, 'cdk.out', `${fullStackName}.template.json`);
137
- const args = isBuilt? [] : ['--template', templatePath.toString()];
138
- args.push('--port');
139
- args.push(port.toString());
140
-
141
- // https://github.com/aws/aws-sam-cli/pull/7892
142
- args.push('--no-memory-limit')
143
-
144
- // "Press Ctrl+C to quit" looks to be printed by a Flask server built into SAM CLI.
145
- return this.samShell(['sam', 'local', 'start-api', ...args], 'Press CTRL+C to quit', ()=>{
146
- return new Promise<ActionOutput>((resolve, reject) => {
147
- axios.get(`http://127.0.0.1:${port}${apiPath}`).then( resp => {
148
- resolve(resp.data);
149
- }).catch( error => {
150
- reject(new Error(`Failed to invoke api path ${apiPath} on port ${port} with error ${error}`));
151
- });
152
- });
153
- });
154
- }
155
-
156
- /**
157
- * Cleanup leftover stacks and buckets
158
- */
159
- public async dispose(success: boolean) {
160
- // If the tests completed successfully, happily delete the fixture
161
- // (otherwise leave it for humans to inspect)
162
- if (success) {
163
- const cleaned = rimraf(this.integTestDir);
164
- if (!cleaned) {
165
- // eslint-disable-next-line no-console
166
- console.error(`Failed to clean up ${this.integTestDir} due to permissions issues (Docker running as root?)`);
167
- }
168
- }
169
- }
170
- }
171
-
172
- export function randomInteger(min: number, max: number) {
173
- return Math.floor(Math.random() * (max - min) + min);
174
- }
175
-
176
- /**
177
- * A shell command that does what you want
178
- *
179
- * Is platform-aware, handles errors nicely.
180
- */
181
- export async function shellWithAction(
182
- command: string[],
183
- filter?: string,
184
- action?: () => Promise<any>,
185
- options: ShellOptions = {},
186
- actionTimeoutSeconds: number = 600,
187
- ): Promise<ActionOutput> {
188
- if (options.modEnv && options.env) {
189
- throw new Error('Use either env or modEnv but not both');
190
- }
191
-
192
- const writeToOutputs = (x: string) => {
193
- for (const output of options.outputs ?? []) {
194
- output.write(x);
195
- }
196
- };
197
- writeToOutputs(`💻 ${command.join(' ')}\n`);
198
-
199
- const env = options.env ?? (options.modEnv ? { ...process.env, ...options.modEnv } : undefined);
200
-
201
- const child = child_process.spawn(command[0], command.slice(1), {
202
- ...options,
203
- env,
204
- // Need this for Windows where we want .cmd and .bat to be found as well.
205
- shell: true,
206
- stdio: ['ignore', 'pipe', 'pipe'],
207
- });
208
-
209
- return new Promise<ActionOutput>((resolve, reject) => {
210
- const out = new Array<Buffer>();
211
- const stdout = new Array<Buffer>();
212
- const stderr = new Array<Buffer>();
213
- let actionSucceeded = false;
214
- let actionOutput: any;
215
- let actionExecuted = false;
216
-
217
- async function maybeExecuteAction(chunk: any) {
218
- out.push(Buffer.from(chunk));
219
- if (!actionExecuted && typeof filter === 'string' && Buffer.concat(out).toString('utf-8').includes(filter) && typeof action === 'function') {
220
- actionExecuted = true;
221
- writeToOutputs('before executing action\n');
222
- try {
223
- const output = await action();
224
- writeToOutputs(`action output is ${JSON.stringify(output)}\n`);
225
- actionOutput = output;
226
- actionSucceeded = true;
227
- } catch (error: any) {
228
- writeToOutputs(`action error is ${error}\n`);
229
- actionSucceeded = false;
230
- actionOutput = error;
231
- } finally {
232
- writeToOutputs('terminate sam sub process\n');
233
- killSubProcess(child, command.join(' '));
234
- }
235
- }
236
- }
237
-
238
- if (typeof filter === 'string' && typeof action === 'function') {
239
- // Reject with an error if an action is configured, but the filter failed
240
- // to show up in the output before the timeout occurred.
241
- setTimeout(
242
- () => {
243
- if (!actionExecuted) {
244
- reject(new Error(`Timed out waiting for filter ${JSON.stringify(filter)} to appear in command output after ${actionTimeoutSeconds} seconds\nOutput so far:\n${Buffer.concat(out).toString('utf-8')}`));
245
- killSubProcess(child, command.join(' '));
246
- }
247
- }, actionTimeoutSeconds * 1_000,
248
- ).unref();
249
- }
250
-
251
- child.stdout!.on('data', chunk => {
252
- writeToOutputs(chunk);
253
- stdout.push(chunk);
254
- void maybeExecuteAction(chunk);
255
- });
256
-
257
- child.stderr!.on('data', chunk => {
258
- writeToOutputs(chunk);
259
- if (options.captureStderr ?? true) {
260
- stderr.push(chunk);
261
- }
262
- void maybeExecuteAction(chunk);
263
- });
264
-
265
- child.once('error', reject);
266
-
267
- // Wait for 'exit' instead of close, don't care about reading the streams all the way to the end
268
- child.once('exit', (code, signal) => {
269
- writeToOutputs(`Subprocess has exited with code ${code}, signal ${signal}\n`);
270
- const output = (Buffer.concat(stdout).toString('utf-8') + Buffer.concat(stderr).toString('utf-8')).trim();
271
- if (code == null || code === 0 || options.allowErrExit) {
272
- let result = new Array<string>();
273
- result.push(actionOutput);
274
- result.push(output);
275
- resolve({
276
- actionSucceeded: actionSucceeded,
277
- actionOutput: actionOutput,
278
- shellOutput: output,
279
- });
280
- } else {
281
- reject(new Error(`'${command.join(' ')}' exited with error code ${code}. Output: \n${output}`));
282
- }
283
- });
284
- });
285
- }
286
-
287
- function killSubProcess(child: child_process.ChildProcess, command: string) {
288
- /**
289
- * Check if the sub process is running in container, so child_process.spawn will
290
- * create multiple processes, and to kill all of them we need to run different logic
291
- */
292
- child.kill('SIGINT');
293
- child_process.exec(`for pid in $(ps -ef | grep "${command}" | awk '{print $2}'); do kill -2 $pid; done`);
294
- }
@@ -1,35 +0,0 @@
1
- import * as fs from 'fs';
2
- import * as os from 'os';
3
- import * as path from 'path';
4
- import { TestContext } from './integ-test';
5
- import { rimraf } from './shell';
6
-
7
- export interface TemporaryDirectoryContext {
8
- readonly integTestDir: string;
9
- }
10
-
11
- export function withTemporaryDirectory<A extends TestContext>(block: (context: A & TemporaryDirectoryContext) => Promise<void>) {
12
- return async (context: A) => {
13
- const integTestDir = path.join(os.tmpdir(), `cdk-integ-${context.randomString}`);
14
-
15
- fs.mkdirSync(integTestDir, { recursive: true });
16
-
17
- try {
18
- await block({
19
- ...context,
20
- integTestDir,
21
- });
22
-
23
- // Clean up in case of success
24
- if (process.env.SKIP_CLEANUP) {
25
- context.log(`Left test directory in '${integTestDir}' ($SKIP_CLEANUP)\n`);
26
- } else {
27
- rimraf(integTestDir);
28
- }
29
- } catch (e) {
30
- context.log(`Left test directory in '${integTestDir}'\n`);
31
- throw e;
32
- }
33
- };
34
- }
35
-
@@ -1,33 +0,0 @@
1
- /**
2
- * Run a block with a timeout
3
- *
4
- * We can't use the jest timeout feature:
5
- *
6
- * - `jest.concurrent()` does not do any concurrency management. It starts all
7
- * tests at the same time.
8
- * - Our tests use locking to make sure only one test is running at a time per
9
- * region.
10
- *
11
- * The wait time for the locks is included in the jest test timeout. We therefore
12
- * need to set it unreasonably high (as long as the last test may need to wait
13
- * if all tests are executed using only 1 region, and they effectively execute
14
- * sequentially), which makes it not useful to detect stuck tests.
15
- *
16
- * The `withTimeout()` modifier makes it possible to measure only a specific
17
- * block of code. In our case: the effective test code, excluding the wait time.
18
- */
19
- export function withTimeout<A>(seconds: number, block: (x: A) => Promise<void>) {
20
- return (x: A) => {
21
- const timeOut = new Promise<void>((_ok, ko) => {
22
- const timerHandle = setTimeout(
23
- () => ko(new Error(`Timeout: test took more than ${seconds}s to complete`)),
24
- seconds * 1000);
25
- timerHandle.unref();
26
- });
27
-
28
- return Promise.race([
29
- block(x),
30
- timeOut,
31
- ]);
32
- };
33
- }