@aws-cdk-testing/cli-integ 3.5.0 → 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 +28 -33
  36. package/lib/with-cli-lib.d.ts +4 -3
  37. package/lib/with-cli-lib.js +1 -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 +4 -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 -847
  145. package/lib/with-cli-lib.ts +0 -150
  146. package/lib/with-packages.ts +0 -15
  147. package/lib/with-sam.ts +0 -295
  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,150 +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
- await fixture.ecrPublicLogin();
31
-
32
- let success = true;
33
- try {
34
- const installationVersion = fixture.packages.requestedFrameworkVersion();
35
-
36
- if (fixture.packages.majorVersion() === '1') {
37
- throw new Error('This test suite is only compatible with AWS CDK v2');
38
- }
39
-
40
- const alphaInstallationVersion = fixture.packages.requestedAlphaVersion();
41
-
42
- // cli-lib-alpha has a magic alpha version in the old release pipeline,
43
- // but will just mirror the CLI version in the new pipeline.
44
- const cliLibVersion = process.env.CLI_LIB_VERSION_MIRRORS_CLI
45
- ? `${fixture.packages.requestedCliVersion()}-alpha.0`
46
- : alphaInstallationVersion;
47
-
48
- await installNpmPackages(fixture, {
49
- 'aws-cdk-lib': installationVersion,
50
- '@aws-cdk/cli-lib-alpha': cliLibVersion,
51
- '@aws-cdk/aws-lambda-go-alpha': alphaInstallationVersion,
52
- '@aws-cdk/aws-lambda-python-alpha': alphaInstallationVersion,
53
- 'constructs': '^10',
54
- });
55
-
56
- if (!context.disableBootstrap) {
57
- await ensureBootstrapped(fixture);
58
- }
59
-
60
- await block(fixture);
61
- } catch (e: any) {
62
- // We survive certain cases involving gopkg.in
63
- if (errorCausedByGoPkg(e.message)) {
64
- return;
65
- }
66
- success = false;
67
- throw e;
68
- } finally {
69
- if (process.env.INTEG_NO_CLEAN) {
70
- context.log(`Left test directory in '${integTestDir}' ($INTEG_NO_CLEAN)\n`);
71
- } else {
72
- await fixture.dispose(success);
73
- }
74
- }
75
- };
76
- }
77
-
78
- /**
79
- * Return whether or not the error is being caused by gopkg.in being down
80
- *
81
- * Our Go build depends on https://gopkg.in/, which has errors pretty often
82
- * (every couple of days). It is run by a single volunteer.
83
- */
84
- function errorCausedByGoPkg(error: string) {
85
- // The error is different depending on what request fails. Messages recognized:
86
- ////////////////////////////////////////////////////////////////////
87
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
88
- // 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:
89
- // 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)
90
- // fatal: unable to access 'https://gopkg.in/yaml.v3/': The requested URL returned error: 502
91
- ////////////////////////////////////////////////////////////////////
92
- // go: downloading github.com/aws/aws-lambda-go v1.28.0
93
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
94
- // 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
95
- // 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)
96
- ////////////////////////////////////////////////////////////////////
97
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
98
- // 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:
99
- // error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502
100
- // fatal: the remote end hung up unexpectedly
101
- ////////////////////////////////////////////////////////////////////
102
-
103
- return (error.includes('gopkg\.in.*invalid version.*exit status 128')
104
- || error.match(/unrecognized import path[^\n]gopkg\.in/));
105
- }
106
-
107
- /**
108
- * SAM Integration test fixture for CDK - SAM integration test cases
109
- */
110
- export function withCliLibFixture(block: (context: CliLibIntegrationTestFixture) => Promise<void>) {
111
- return withAws(withTimeout(DEFAULT_TEST_TIMEOUT_S, withCliLibIntegrationCdkApp(block)));
112
- }
113
-
114
- export class CliLibIntegrationTestFixture extends TestFixture {
115
- /**
116
- *
117
- */
118
- public async cdk(args: string[], options: CdkCliOptions = {}) {
119
- const action = args[0];
120
- const stackName = args[1];
121
-
122
- const cliOpts: Record<string, any> = {
123
- stacks: stackName ? [stackName] : undefined,
124
- };
125
-
126
- if (action === 'deploy') {
127
- cliOpts.requireApproval = options.neverRequireApproval ? 'never' : 'broadening';
128
- }
129
-
130
- return this.shell(['node', '--input-type=module', `<<__EOS__
131
- import { AwsCdkCli } from '@aws-cdk/cli-lib-alpha';
132
- const cli = AwsCdkCli.fromCdkAppDirectory();
133
-
134
- await cli.${action}(${JSON.stringify(cliOpts)});
135
- __EOS__`], {
136
- ...options,
137
- modEnv: {
138
- ...this.cdkShellEnv(),
139
- AWS_REGION: this.aws.region,
140
- AWS_DEFAULT_REGION: this.aws.region,
141
- STACK_NAME_PREFIX: this.stackNamePrefix,
142
- PACKAGE_LAYOUT_VERSION: this.packages.majorVersion(),
143
- // In these tests we want to make a distinction between stdout and sterr
144
- CI: 'false',
145
- ...options.modEnv,
146
- },
147
- });
148
- }
149
- }
150
-
@@ -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,295 +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
- await fixture.ecrPublicLogin();
39
-
40
- let success = true;
41
- try {
42
- const installationVersion = fixture.packages.requestedFrameworkVersion();
43
-
44
- if (fixture.packages.majorVersion() === '1') {
45
- await installNpmPackages(fixture, {
46
- '@aws-cdk/aws-iam': installationVersion,
47
- '@aws-cdk/aws-apigateway': installationVersion,
48
- '@aws-cdk/aws-lambda': installationVersion,
49
- '@aws-cdk/aws-lambda-go': installationVersion,
50
- '@aws-cdk/aws-lambda-nodejs': installationVersion,
51
- '@aws-cdk/aws-lambda-python': installationVersion,
52
- '@aws-cdk/aws-logs': installationVersion,
53
- '@aws-cdk/core': installationVersion,
54
- 'constructs': '^3',
55
- });
56
- } else {
57
- const alphaInstallationVersion = fixture.packages.requestedAlphaVersion();
58
- await installNpmPackages(fixture, {
59
- 'aws-cdk-lib': installationVersion,
60
- '@aws-cdk/aws-lambda-go-alpha': alphaInstallationVersion,
61
- '@aws-cdk/aws-lambda-python-alpha': alphaInstallationVersion,
62
- 'constructs': '^10',
63
- });
64
- }
65
- await block(fixture);
66
- } catch (e: any) {
67
- // We survive certain cases involving gopkg.in
68
- if (errorCausedByGoPkg(e.message)) {
69
- return;
70
- }
71
- success = false;
72
- throw e;
73
- } finally {
74
- if (process.env.INTEG_NO_CLEAN) {
75
- context.log(`Left test directory in '${integTestDir}' ($INTEG_NO_CLEAN)\n`);
76
- } else {
77
- await fixture.dispose(success);
78
- }
79
- }
80
- };
81
- }
82
-
83
- /**
84
- * Return whether or not the error is being caused by gopkg.in being down
85
- *
86
- * Our Go build depends on https://gopkg.in/, which has errors pretty often
87
- * (every couple of days). It is run by a single volunteer.
88
- */
89
- function errorCausedByGoPkg(error: string) {
90
- // The error is different depending on what request fails. Messages recognized:
91
- ////////////////////////////////////////////////////////////////////
92
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
93
- // 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:
94
- // 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)
95
- // fatal: unable to access 'https://gopkg.in/yaml.v3/': The requested URL returned error: 502
96
- ////////////////////////////////////////////////////////////////////
97
- // go: downloading github.com/aws/aws-lambda-go v1.28.0
98
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
99
- // 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
100
- // 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)
101
- ////////////////////////////////////////////////////////////////////
102
- // go: github.com/aws/aws-lambda-go@v1.28.0 requires
103
- // 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:
104
- // error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502
105
- // fatal: the remote end hung up unexpectedly
106
- ////////////////////////////////////////////////////////////////////
107
-
108
- return (error.includes('gopkg\.in.*invalid version.*exit status 128')
109
- || error.match(/unrecognized import path[^\n]gopkg\.in/));
110
- }
111
-
112
- /**
113
- * SAM Integration test fixture for CDK - SAM integration test cases
114
- */
115
- export function withSamIntegrationFixture(block: (context: SamIntegrationTestFixture) => Promise<void>) {
116
- return withAws(withTimeout(DEFAULT_TEST_TIMEOUT_S, withSamIntegrationCdkApp(block)));
117
- }
118
-
119
- export class SamIntegrationTestFixture extends TestFixture {
120
- public async samShell(command: string[], filter?: string, action?: () => any, options: Omit<ShellOptions, 'cwd' | 'output'> = {}): Promise<ActionOutput> {
121
- return shellWithAction(command, filter, action, {
122
- outputs: [this.output],
123
- cwd: path.join(this.integTestDir, 'cdk.out').toString(),
124
- ...options,
125
- });
126
- }
127
-
128
- public async samBuild(stackName: string) {
129
- const fullStackName = this.fullStackName(stackName);
130
- const templatePath = path.join(this.integTestDir, 'cdk.out', `${fullStackName}.template.json`);
131
- const args = ['--template', templatePath.toString()];
132
- return this.samShell(['sam', 'build', ...args]);
133
- }
134
-
135
- public async samLocalStartApi(stackName: string, isBuilt: boolean, port: number, apiPath: string): Promise<ActionOutput> {
136
- const fullStackName = this.fullStackName(stackName);
137
- const templatePath = path.join(this.integTestDir, 'cdk.out', `${fullStackName}.template.json`);
138
- const args = isBuilt? [] : ['--template', templatePath.toString()];
139
- args.push('--port');
140
- args.push(port.toString());
141
-
142
- // https://github.com/aws/aws-sam-cli/pull/7892
143
- args.push('--no-memory-limit')
144
-
145
- // "Press Ctrl+C to quit" looks to be printed by a Flask server built into SAM CLI.
146
- return this.samShell(['sam', 'local', 'start-api', ...args], 'Press CTRL+C to quit', ()=>{
147
- return new Promise<ActionOutput>((resolve, reject) => {
148
- axios.get(`http://127.0.0.1:${port}${apiPath}`).then( resp => {
149
- resolve(resp.data);
150
- }).catch( error => {
151
- reject(new Error(`Failed to invoke api path ${apiPath} on port ${port} with error ${error}`));
152
- });
153
- });
154
- });
155
- }
156
-
157
- /**
158
- * Cleanup leftover stacks and buckets
159
- */
160
- public async dispose(success: boolean) {
161
- // If the tests completed successfully, happily delete the fixture
162
- // (otherwise leave it for humans to inspect)
163
- if (success) {
164
- const cleaned = rimraf(this.integTestDir);
165
- if (!cleaned) {
166
- // eslint-disable-next-line no-console
167
- console.error(`Failed to clean up ${this.integTestDir} due to permissions issues (Docker running as root?)`);
168
- }
169
- }
170
- }
171
- }
172
-
173
- export function randomInteger(min: number, max: number) {
174
- return Math.floor(Math.random() * (max - min) + min);
175
- }
176
-
177
- /**
178
- * A shell command that does what you want
179
- *
180
- * Is platform-aware, handles errors nicely.
181
- */
182
- export async function shellWithAction(
183
- command: string[],
184
- filter?: string,
185
- action?: () => Promise<any>,
186
- options: ShellOptions = {},
187
- actionTimeoutSeconds: number = 600,
188
- ): Promise<ActionOutput> {
189
- if (options.modEnv && options.env) {
190
- throw new Error('Use either env or modEnv but not both');
191
- }
192
-
193
- const writeToOutputs = (x: string) => {
194
- for (const output of options.outputs ?? []) {
195
- output.write(x);
196
- }
197
- };
198
- writeToOutputs(`💻 ${command.join(' ')}\n`);
199
-
200
- const env = options.env ?? (options.modEnv ? { ...process.env, ...options.modEnv } : undefined);
201
-
202
- const child = child_process.spawn(command[0], command.slice(1), {
203
- ...options,
204
- env,
205
- // Need this for Windows where we want .cmd and .bat to be found as well.
206
- shell: true,
207
- stdio: ['ignore', 'pipe', 'pipe'],
208
- });
209
-
210
- return new Promise<ActionOutput>((resolve, reject) => {
211
- const out = new Array<Buffer>();
212
- const stdout = new Array<Buffer>();
213
- const stderr = new Array<Buffer>();
214
- let actionSucceeded = false;
215
- let actionOutput: any;
216
- let actionExecuted = false;
217
-
218
- async function maybeExecuteAction(chunk: any) {
219
- out.push(Buffer.from(chunk));
220
- if (!actionExecuted && typeof filter === 'string' && Buffer.concat(out).toString('utf-8').includes(filter) && typeof action === 'function') {
221
- actionExecuted = true;
222
- writeToOutputs('before executing action\n');
223
- try {
224
- const output = await action();
225
- writeToOutputs(`action output is ${JSON.stringify(output)}\n`);
226
- actionOutput = output;
227
- actionSucceeded = true;
228
- } catch (error: any) {
229
- writeToOutputs(`action error is ${error}\n`);
230
- actionSucceeded = false;
231
- actionOutput = error;
232
- } finally {
233
- writeToOutputs('terminate sam sub process\n');
234
- killSubProcess(child, command.join(' '));
235
- }
236
- }
237
- }
238
-
239
- if (typeof filter === 'string' && typeof action === 'function') {
240
- // Reject with an error if an action is configured, but the filter failed
241
- // to show up in the output before the timeout occurred.
242
- setTimeout(
243
- () => {
244
- if (!actionExecuted) {
245
- 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')}`));
246
- killSubProcess(child, command.join(' '));
247
- }
248
- }, actionTimeoutSeconds * 1_000,
249
- ).unref();
250
- }
251
-
252
- child.stdout!.on('data', chunk => {
253
- writeToOutputs(chunk);
254
- stdout.push(chunk);
255
- void maybeExecuteAction(chunk);
256
- });
257
-
258
- child.stderr!.on('data', chunk => {
259
- writeToOutputs(chunk);
260
- if (options.captureStderr ?? true) {
261
- stderr.push(chunk);
262
- }
263
- void maybeExecuteAction(chunk);
264
- });
265
-
266
- child.once('error', reject);
267
-
268
- // Wait for 'exit' instead of close, don't care about reading the streams all the way to the end
269
- child.once('exit', (code, signal) => {
270
- writeToOutputs(`Subprocess has exited with code ${code}, signal ${signal}\n`);
271
- const output = (Buffer.concat(stdout).toString('utf-8') + Buffer.concat(stderr).toString('utf-8')).trim();
272
- if (code == null || code === 0 || options.allowErrExit) {
273
- let result = new Array<string>();
274
- result.push(actionOutput);
275
- result.push(output);
276
- resolve({
277
- actionSucceeded: actionSucceeded,
278
- actionOutput: actionOutput,
279
- shellOutput: output,
280
- });
281
- } else {
282
- reject(new Error(`'${command.join(' ')}' exited with error code ${code}. Output: \n${output}`));
283
- }
284
- });
285
- });
286
- }
287
-
288
- function killSubProcess(child: child_process.ChildProcess, command: string) {
289
- /**
290
- * Check if the sub process is running in container, so child_process.spawn will
291
- * create multiple processes, and to kill all of them we need to run different logic
292
- */
293
- child.kill('SIGINT');
294
- child_process.exec(`for pid in $(ps -ef | grep "${command}" | awk '{print $2}'); do kill -2 $pid; done`);
295
- }
@@ -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
- }