@aws-cdk-testing/cli-integ 3.3.0 → 3.3.2

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 (442) hide show
  1. package/lib/cli/run-suite.js +6 -1
  2. package/lib/cli/run-suite.ts +6 -0
  3. package/lib/integ-test.js +3 -13
  4. package/lib/integ-test.ts +2 -13
  5. package/lib/with-aws.js +1 -3
  6. package/lib/with-aws.ts +0 -3
  7. package/lib/with-cli-lib.js +2 -1
  8. package/lib/with-cli-lib.ts +1 -0
  9. package/package.json +4 -4
  10. package/resources/integ.jest.config.js +2 -3
  11. package/tests/cli-integ-tests/cdk---exclusively-selects-only-selected-stack.integtest.js +24 -0
  12. package/tests/cli-integ-tests/cdk---exclusively-selects-only-selected-stack.integtest.ts +29 -0
  13. package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.js +80 -0
  14. package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.ts +92 -0
  15. package/tests/cli-integ-tests/cdk-automatic-ordering-with-concurrency.integtest.js +11 -0
  16. package/tests/cli-integ-tests/cdk-automatic-ordering-with-concurrency.integtest.ts +15 -0
  17. package/tests/cli-integ-tests/cdk-automatic-ordering.integtest.js +11 -0
  18. package/tests/cli-integ-tests/cdk-automatic-ordering.integtest.ts +15 -0
  19. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and---no-rollback-is-removed-from-flags.integtest.d.ts +1 -0
  20. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and---no-rollback-is-removed-from-flags.integtest.js +35 -0
  21. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and---no-rollback-is-removed-from-flags.integtest.ts +40 -0
  22. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and-change-contains-a-replacement.integtest.d.ts +1 -0
  23. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and-change-contains-a-replacement.integtest.js +35 -0
  24. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and-change-contains-a-replacement.integtest.ts +40 -0
  25. package/tests/cli-integ-tests/cdk-automatic-rollback-if-replacement-and---no-rollback-is-removed-from-flags.integtest.d.ts +1 -0
  26. package/tests/cli-integ-tests/cdk-automatic-rollback-if-replacement-and---no-rollback-is-removed-from-flags.integtest.js +26 -0
  27. package/tests/cli-integ-tests/cdk-automatic-rollback-if-replacement-and---no-rollback-is-removed-from-flags.integtest.ts +29 -0
  28. package/tests/cli-integ-tests/cdk-bootstrap-a-customized-template-vendor-will-not-overwrite-the-default-template.integtest.d.ts +1 -0
  29. package/tests/cli-integ-tests/cdk-bootstrap-a-customized-template-vendor-will-not-overwrite-the-default-template.integtest.js +39 -0
  30. package/tests/cli-integ-tests/cdk-bootstrap-a-customized-template-vendor-will-not-overwrite-the-default-template.integtest.ts +42 -0
  31. package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.d.ts +1 -0
  32. package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.js +25 -0
  33. package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.ts +26 -0
  34. package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.d.ts +1 -0
  35. package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.js +27 -0
  36. package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.ts +28 -0
  37. package/tests/cli-integ-tests/cdk-bootstrap-can-and-deploy-if-omitting-execution-policies.integtest.d.ts +1 -0
  38. package/tests/cli-integ-tests/cdk-bootstrap-can-and-deploy-if-omitting-execution-policies.integtest.js +19 -0
  39. package/tests/cli-integ-tests/cdk-bootstrap-can-and-deploy-if-omitting-execution-policies.integtest.ts +21 -0
  40. package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.d.ts +1 -0
  41. package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.js +18 -0
  42. package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.ts +22 -0
  43. package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.d.ts +1 -0
  44. package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.js +20 -0
  45. package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.ts +21 -0
  46. package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.d.ts +1 -0
  47. package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.js +26 -0
  48. package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.ts +27 -0
  49. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-modern-synthesized-stack-even-if-bootstrap-stack-name-is-unknown.integtest.d.ts +1 -0
  50. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-modern-synthesized-stack-even-if-bootstrap-stack-name-is-unknown.integtest.js +22 -0
  51. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-modern-synthesized-stack-even-if-bootstrap-stack-name-is-unknown.integtest.ts +24 -0
  52. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-with-session-tags-on-the-deploy.integtest.d.ts +1 -0
  53. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-with-session-tags-on-the-deploy.integtest.js +23 -0
  54. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-with-session-tags-on-the-deploy.integtest.ts +25 -0
  55. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-without-execution-role-and-with-session-tags-on-deploy-role.integtest.d.ts +1 -0
  56. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-without-execution-role-and-with-session-tags-on-deploy-role.integtest.js +20 -0
  57. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-without-execution-role-and-with-session-tags-on-deploy-role.integtest.ts +22 -0
  58. package/tests/cli-integ-tests/cdk-bootstrap-can-dump-the-template.integtest.d.ts +1 -0
  59. package/tests/cli-integ-tests/cdk-bootstrap-can-dump-the-template.integtest.js +29 -0
  60. package/tests/cli-integ-tests/cdk-bootstrap-can-dump-the-template.integtest.ts +32 -0
  61. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.d.ts +1 -0
  62. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.js +61 -0
  63. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.ts +77 -0
  64. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.d.ts +1 -0
  65. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.js +25 -0
  66. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.ts +30 -0
  67. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-(with-slashes)-to-bootstrap.integtest.d.ts +1 -0
  68. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-(with-slashes)-to-bootstrap.integtest.js +14 -0
  69. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-(with-slashes)-to-bootstrap.integtest.ts +15 -0
  70. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-to-bootstrap.integtest.d.ts +1 -0
  71. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-to-bootstrap.integtest.js +14 -0
  72. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-to-bootstrap.integtest.ts +15 -0
  73. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-default-permissions-boundary-to-bootstrap.integtest.d.ts +1 -0
  74. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-default-permissions-boundary-to-bootstrap.integtest.js +14 -0
  75. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-default-permissions-boundary-to-bootstrap.integtest.ts +15 -0
  76. package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.d.ts +1 -0
  77. package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.js +27 -0
  78. package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.ts +34 -0
  79. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap-(with-docker-image).integtest.d.ts +1 -0
  80. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap-(with-docker-image).integtest.js +20 -0
  81. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap-(with-docker-image).integtest.ts +22 -0
  82. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap.integtest.d.ts +1 -0
  83. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap.integtest.js +20 -0
  84. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap.integtest.ts +22 -0
  85. package/tests/cli-integ-tests/cdk-bootstrap-deploy-old-style-synthesis-to-new-style-bootstrap.integtest.d.ts +1 -0
  86. package/tests/cli-integ-tests/cdk-bootstrap-deploy-old-style-synthesis-to-new-style-bootstrap.integtest.js +19 -0
  87. package/tests/cli-integ-tests/cdk-bootstrap-deploy-old-style-synthesis-to-new-style-bootstrap.integtest.ts +21 -0
  88. package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.d.ts +1 -0
  89. package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.js +23 -0
  90. package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.ts +24 -0
  91. package/tests/cli-integ-tests/cdk-bootstrap-upgrade-legacy-bootstrap-stack-to-new-bootstrap-stack-while-in-use.integtest.d.ts +1 -0
  92. package/tests/cli-integ-tests/cdk-bootstrap-upgrade-legacy-bootstrap-stack-to-new-bootstrap-stack-while-in-use.integtest.js +42 -0
  93. package/tests/cli-integ-tests/cdk-bootstrap-upgrade-legacy-bootstrap-stack-to-new-bootstrap-stack-while-in-use.integtest.ts +47 -0
  94. package/tests/cli-integ-tests/cdk-can-still-load-old-assemblies.integtest.d.ts +1 -0
  95. package/tests/cli-integ-tests/cdk-can-still-load-old-assemblies.integtest.js +49 -0
  96. package/tests/cli-integ-tests/cdk-can-still-load-old-assemblies.integtest.ts +57 -0
  97. package/tests/cli-integ-tests/cdk-cdk-diff---fail-on-multiple-stacks-exits-with-error-if-any-of-the-stacks-contains-a-diff.integtest.d.ts +1 -0
  98. package/tests/cli-integ-tests/cdk-cdk-diff---fail-on-multiple-stacks-exits-with-error-if-any-of-the-stacks-contains-a-diff.integtest.js +15 -0
  99. 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 +22 -0
  100. package/tests/cli-integ-tests/cdk-cdk-diff---fail-with-multiple-stack-exits-with-if-any-of-the-stacks-contains-a-diff.integtest.d.ts +1 -0
  101. package/tests/cli-integ-tests/cdk-cdk-diff---fail-with-multiple-stack-exits-with-if-any-of-the-stacks-contains-a-diff.integtest.js +15 -0
  102. package/tests/cli-integ-tests/cdk-cdk-diff---fail-with-multiple-stack-exits-with-if-any-of-the-stacks-contains-a-diff.integtest.ts +22 -0
  103. package/tests/cli-integ-tests/cdk-cdk-diff---quiet-does-not-print-there-were-no-differences-message-for-stacks-which-have-no-differences.integtest.d.ts +1 -0
  104. package/tests/cli-integ-tests/cdk-cdk-diff---quiet-does-not-print-there-were-no-differences-message-for-stacks-which-have-no-differences.integtest.js +14 -0
  105. 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 +19 -0
  106. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-changes-are-present.integtest.d.ts +1 -0
  107. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-changes-are-present.integtest.js +9 -0
  108. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-changes-are-present.integtest.ts +14 -0
  109. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-access-control-config.integtest.d.ts +1 -0
  110. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-access-control-config.integtest.js +8 -0
  111. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-access-control-config.integtest.ts +13 -0
  112. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-assignment.integtest.d.ts +1 -0
  113. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-assignment.integtest.js +8 -0
  114. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-assignment.integtest.ts +13 -0
  115. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-with-managed-policy.integtest.d.ts +1 -0
  116. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-with-managed-policy.integtest.js +8 -0
  117. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-with-managed-policy.integtest.ts +13 -0
  118. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-without-managed-policy.integtest.d.ts +1 -0
  119. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-without-managed-policy.integtest.js +8 -0
  120. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-without-managed-policy.integtest.ts +13 -0
  121. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-access-control-information.integtest.d.ts +1 -0
  122. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-access-control-information.integtest.js +30 -0
  123. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-access-control-information.integtest.ts +35 -0
  124. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-assignment-information.integtest.d.ts +1 -0
  125. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-assignment-information.integtest.js +28 -0
  126. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-assignment-information.integtest.ts +37 -0
  127. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-with-managed-policy-information.integtest.d.ts +1 -0
  128. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-with-managed-policy-information.integtest.js +27 -0
  129. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-with-managed-policy-information.integtest.ts +35 -0
  130. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-without-managed-policy-information.integtest.d.ts +1 -0
  131. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-without-managed-policy-information.integtest.js +30 -0
  132. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-without-managed-policy-information.integtest.ts +37 -0
  133. package/tests/cli-integ-tests/cdk-cdk-diff-doesnt-show-resource-metadata-changes.integtest.d.ts +1 -0
  134. package/tests/cli-integ-tests/cdk-cdk-diff-doesnt-show-resource-metadata-changes.integtest.js +18 -0
  135. package/tests/cli-integ-tests/cdk-cdk-diff-doesnt-show-resource-metadata-changes.integtest.ts +23 -0
  136. package/tests/cli-integ-tests/cdk-cdk-diff-shows-resource-metadata-changes-with---no-change-set.integtest.d.ts +1 -0
  137. package/tests/cli-integ-tests/cdk-cdk-diff-shows-resource-metadata-changes-with---no-change-set.integtest.js +18 -0
  138. package/tests/cli-integ-tests/cdk-cdk-diff-shows-resource-metadata-changes-with---no-change-set.integtest.ts +23 -0
  139. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-and-custom-toolkit-stack-name-and-qualifier-does-not-fail.integtest.d.ts +1 -0
  140. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-and-custom-toolkit-stack-name-and-qualifier-does-not-fail.integtest.js +35 -0
  141. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-and-custom-toolkit-stack-name-and-qualifier-does-not-fail.integtest.ts +38 -0
  142. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-does-not-fail.integtest.d.ts +1 -0
  143. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-does-not-fail.integtest.js +23 -0
  144. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-does-not-fail.integtest.ts +28 -0
  145. package/tests/cli-integ-tests/cdk-cdk-diff.integtest.d.ts +1 -0
  146. package/tests/cli-integ-tests/cdk-cdk-diff.integtest.js +13 -0
  147. package/tests/cli-integ-tests/cdk-cdk-diff.integtest.ts +18 -0
  148. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json---long.integtest.d.ts +1 -0
  149. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json---long.integtest.js +45 -0
  150. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json---long.integtest.ts +50 -0
  151. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json.integtest.d.ts +1 -0
  152. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json.integtest.js +75 -0
  153. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json.integtest.ts +95 -0
  154. package/tests/cli-integ-tests/cdk-cdk-ls.integtest.d.ts +1 -0
  155. package/tests/cli-integ-tests/cdk-cdk-ls.integtest.js +32 -0
  156. package/tests/cli-integ-tests/cdk-cdk-ls.integtest.ts +36 -0
  157. package/tests/cli-integ-tests/cdk-cdk-notices-are-displayed-correctly.integtest.d.ts +1 -0
  158. package/tests/cli-integ-tests/cdk-cdk-notices-are-displayed-correctly.integtest.js +38 -0
  159. package/tests/cli-integ-tests/cdk-cdk-notices-are-displayed-correctly.integtest.ts +42 -0
  160. package/tests/cli-integ-tests/cdk-cdk-notices-with---unacknowledged.integtest.d.ts +1 -0
  161. package/tests/cli-integ-tests/cdk-cdk-notices-with---unacknowledged.integtest.js +11 -0
  162. package/tests/cli-integ-tests/cdk-cdk-notices-with---unacknowledged.integtest.ts +14 -0
  163. package/tests/cli-integ-tests/cdk-cdk-synth-add-the-metadata-properties-expected-by-sam.integtest.d.ts +1 -0
  164. package/tests/cli-integ-tests/cdk-cdk-synth-add-the-metadata-properties-expected-by-sam.integtest.js +111 -0
  165. package/tests/cli-integ-tests/cdk-cdk-synth-add-the-metadata-properties-expected-by-sam.integtest.ts +126 -0
  166. package/tests/cli-integ-tests/cdk-cdk-synth-bundled-functions-as-expected.integtest.d.ts +1 -0
  167. package/tests/cli-integ-tests/cdk-cdk-synth-bundled-functions-as-expected.integtest.js +74 -0
  168. package/tests/cli-integ-tests/cdk-cdk-synth-bundled-functions-as-expected.integtest.ts +80 -0
  169. package/tests/cli-integ-tests/cdk-cdk-synth.integtest.d.ts +1 -0
  170. package/tests/cli-integ-tests/cdk-cdk-synth.integtest.js +40 -0
  171. package/tests/cli-integ-tests/cdk-cdk-synth.integtest.ts +53 -0
  172. package/tests/cli-integ-tests/cdk-ci-output-to-stderr.integtest.d.ts +1 -0
  173. package/tests/cli-integ-tests/cdk-ci-output-to-stderr.integtest.js +16 -0
  174. package/tests/cli-integ-tests/cdk-ci-output-to-stderr.integtest.ts +19 -0
  175. package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.d.ts +1 -0
  176. package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.js +24 -0
  177. package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.ts +28 -0
  178. package/tests/cli-integ-tests/cdk-construct-with-builtin-lambda-function.integtest.d.ts +1 -0
  179. package/tests/cli-integ-tests/cdk-construct-with-builtin-lambda-function.integtest.js +11 -0
  180. package/tests/cli-integ-tests/cdk-construct-with-builtin-lambda-function.integtest.ts +14 -0
  181. package/tests/cli-integ-tests/cdk-context-in-stage-propagates-to-top.integtest.d.ts +1 -0
  182. package/tests/cli-integ-tests/cdk-context-in-stage-propagates-to-top.integtest.js +15 -0
  183. package/tests/cli-integ-tests/cdk-context-in-stage-propagates-to-top.integtest.ts +20 -0
  184. package/tests/cli-integ-tests/cdk-context-setting.integtest.d.ts +1 -0
  185. package/tests/cli-integ-tests/cdk-context-setting.integtest.js +26 -0
  186. package/tests/cli-integ-tests/cdk-context-setting.integtest.ts +33 -0
  187. package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.d.ts +1 -0
  188. package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.js +18 -0
  189. package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.ts +23 -0
  190. package/tests/cli-integ-tests/cdk-deploy-all-concurrently.integtest.d.ts +1 -0
  191. package/tests/cli-integ-tests/cdk-deploy-all-concurrently.integtest.js +13 -0
  192. package/tests/cli-integ-tests/cdk-deploy-all-concurrently.integtest.ts +17 -0
  193. package/tests/cli-integ-tests/cdk-deploy-all.integtest.d.ts +1 -0
  194. package/tests/cli-integ-tests/cdk-deploy-all.integtest.js +10 -0
  195. package/tests/cli-integ-tests/cdk-deploy-all.integtest.ts +14 -0
  196. package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.d.ts +1 -0
  197. package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.js +22 -0
  198. package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.ts +31 -0
  199. package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.d.ts +1 -0
  200. package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.js +41 -0
  201. package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.ts +50 -0
  202. package/tests/cli-integ-tests/cdk-deploy-no-stacks-error.integtest.d.ts +1 -0
  203. package/tests/cli-integ-tests/cdk-deploy-no-stacks-error.integtest.js +13 -0
  204. package/tests/cli-integ-tests/cdk-deploy-no-stacks-error.integtest.ts +18 -0
  205. package/tests/cli-integ-tests/cdk-deploy-no-stacks-with---ignore-no-stacks.integtest.d.ts +1 -0
  206. package/tests/cli-integ-tests/cdk-deploy-no-stacks-with---ignore-no-stacks.integtest.js +14 -0
  207. package/tests/cli-integ-tests/cdk-deploy-no-stacks-with---ignore-no-stacks.integtest.ts +17 -0
  208. package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.d.ts +1 -0
  209. package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.js +38 -0
  210. package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.ts +51 -0
  211. package/tests/cli-integ-tests/cdk-deploy-stack-with-docker-asset.integtest.d.ts +1 -0
  212. package/tests/cli-integ-tests/cdk-deploy-stack-with-docker-asset.integtest.js +8 -0
  213. package/tests/cli-integ-tests/cdk-deploy-stack-with-docker-asset.integtest.ts +11 -0
  214. package/tests/cli-integ-tests/cdk-deploy-stack-with-lambda-asset-to-object-lock-enabled-asset-bucket.integtest.d.ts +1 -0
  215. package/tests/cli-integ-tests/cdk-deploy-stack-with-lambda-asset-to-object-lock-enabled-asset-bucket.integtest.js +39 -0
  216. package/tests/cli-integ-tests/cdk-deploy-stack-with-lambda-asset-to-object-lock-enabled-asset-bucket.integtest.ts +42 -0
  217. package/tests/cli-integ-tests/cdk-deploy-stack-without-resource.integtest.d.ts +1 -0
  218. package/tests/cli-integ-tests/cdk-deploy-stack-without-resource.integtest.js +17 -0
  219. package/tests/cli-integ-tests/cdk-deploy-stack-without-resource.integtest.ts +32 -0
  220. package/tests/cli-integ-tests/cdk-deploy-wildcard-with-outputs.integtest.d.ts +1 -0
  221. package/tests/cli-integ-tests/cdk-deploy-wildcard-with-outputs.integtest.js +23 -0
  222. package/tests/cli-integ-tests/cdk-deploy-wildcard-with-outputs.integtest.ts +28 -0
  223. package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.d.ts +1 -0
  224. package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.js +28 -0
  225. package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.ts +29 -0
  226. package/tests/cli-integ-tests/cdk-deploy-with-method-direct-and-import-existing-resources-fails.integtest.d.ts +1 -0
  227. package/tests/cli-integ-tests/cdk-deploy-with-method-direct-and-import-existing-resources-fails.integtest.js +16 -0
  228. package/tests/cli-integ-tests/cdk-deploy-with-method-direct-and-import-existing-resources-fails.integtest.ts +17 -0
  229. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.d.ts +1 -0
  230. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.js +28 -0
  231. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.ts +36 -0
  232. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.d.ts +1 -0
  233. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.js +37 -0
  234. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.ts +45 -0
  235. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.d.ts +1 -0
  236. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.js +31 -0
  237. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.ts +37 -0
  238. package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.d.ts +1 -0
  239. package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.js +26 -0
  240. package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.ts +33 -0
  241. package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.d.ts +1 -0
  242. package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.js +20 -0
  243. package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.ts +26 -0
  244. package/tests/cli-integ-tests/cdk-deploy-with-role.integtest.d.ts +1 -0
  245. package/tests/cli-integ-tests/cdk-deploy-with-role.integtest.js +97 -0
  246. package/tests/cli-integ-tests/cdk-deploy-with-role.integtest.ts +119 -0
  247. package/tests/cli-integ-tests/cdk-deploy-with-wildcard-and-parameters.integtest.d.ts +1 -0
  248. package/tests/cli-integ-tests/cdk-deploy-with-wildcard-and-parameters.integtest.js +19 -0
  249. package/tests/cli-integ-tests/cdk-deploy-with-wildcard-and-parameters.integtest.ts +22 -0
  250. package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.d.ts +1 -0
  251. package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.js +28 -0
  252. package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.ts +36 -0
  253. package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.d.ts +1 -0
  254. package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.js +27 -0
  255. package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.ts +28 -0
  256. package/tests/cli-integ-tests/cdk-deploy.integtest.d.ts +1 -0
  257. package/tests/cli-integ-tests/cdk-deploy.integtest.js +15 -0
  258. package/tests/cli-integ-tests/cdk-deploy.integtest.ts +20 -0
  259. package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.js +1 -1
  260. package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.ts +1 -1
  261. package/tests/cli-integ-tests/cdk-doubly-nested-stack.integtest.d.ts +1 -0
  262. package/tests/cli-integ-tests/cdk-doubly-nested-stack.integtest.js +10 -0
  263. package/tests/cli-integ-tests/cdk-doubly-nested-stack.integtest.ts +12 -0
  264. package/tests/cli-integ-tests/cdk-enablediffnofail.integtest.d.ts +1 -0
  265. package/tests/cli-integ-tests/cdk-enablediffnofail.integtest.js +34 -0
  266. package/tests/cli-integ-tests/cdk-enablediffnofail.integtest.ts +44 -0
  267. package/tests/cli-integ-tests/cdk-failed-deploy-does-not-hang.integtest.d.ts +1 -0
  268. package/tests/cli-integ-tests/cdk-failed-deploy-does-not-hang.integtest.js +9 -0
  269. package/tests/cli-integ-tests/cdk-failed-deploy-does-not-hang.integtest.ts +12 -0
  270. package/tests/cli-integ-tests/cdk-fast-deploy.integtest.d.ts +1 -0
  271. package/tests/cli-integ-tests/cdk-fast-deploy.integtest.js +35 -0
  272. package/tests/cli-integ-tests/cdk-fast-deploy.integtest.ts +41 -0
  273. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-ecr-images.integtest.d.ts +1 -0
  274. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-ecr-images.integtest.js +39 -0
  275. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-ecr-images.integtest.ts +48 -0
  276. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-s3-objects.integtest.d.ts +1 -0
  277. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-s3-objects.integtest.js +43 -0
  278. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-s3-objects.integtest.ts +51 -0
  279. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-ecr-images.integtest.d.ts +1 -0
  280. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-ecr-images.integtest.js +39 -0
  281. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-ecr-images.integtest.ts +48 -0
  282. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-s3-objects.integtest.d.ts +1 -0
  283. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-s3-objects.integtest.js +44 -0
  284. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-s3-objects.integtest.ts +52 -0
  285. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-ecr-images.integtest.d.ts +1 -0
  286. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-ecr-images.integtest.js +38 -0
  287. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-ecr-images.integtest.ts +47 -0
  288. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-s3-objects.integtest.d.ts +1 -0
  289. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-s3-objects.integtest.js +54 -0
  290. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-s3-objects.integtest.ts +63 -0
  291. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-ecr-images.integtest.d.ts +1 -0
  292. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-ecr-images.integtest.js +45 -0
  293. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-ecr-images.integtest.ts +55 -0
  294. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.d.ts +1 -0
  295. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.js +53 -0
  296. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.ts +63 -0
  297. package/tests/cli-integ-tests/cdk-generating-and-loading-assembly.integtest.d.ts +1 -0
  298. package/tests/cli-integ-tests/cdk-generating-and-loading-assembly.integtest.js +44 -0
  299. package/tests/cli-integ-tests/cdk-generating-and-loading-assembly.integtest.ts +52 -0
  300. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-detects-failed-deployment-and-errors.integtest.d.ts +1 -0
  301. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-detects-failed-deployment-and-errors.integtest.js +24 -0
  302. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-detects-failed-deployment-and-errors.integtest.ts +29 -0
  303. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.d.ts +1 -0
  304. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.js +33 -0
  305. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.ts +45 -0
  306. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.d.ts +1 -0
  307. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.js +30 -0
  308. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.ts +36 -0
  309. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.d.ts +1 -0
  310. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.js +33 -0
  311. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.ts +41 -0
  312. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.d.ts +1 -0
  313. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.js +46 -0
  314. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.ts +53 -0
  315. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.d.ts +1 -0
  316. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.js +36 -0
  317. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.ts +43 -0
  318. package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.d.ts +1 -0
  319. package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.js +51 -0
  320. package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.ts +59 -0
  321. package/tests/cli-integ-tests/cdk-iam-diff.integtest.d.ts +1 -0
  322. package/tests/cli-integ-tests/cdk-iam-diff.integtest.js +18 -0
  323. package/tests/cli-integ-tests/cdk-iam-diff.integtest.ts +23 -0
  324. package/tests/cli-integ-tests/cdk-import-interactive.integtest.js +1 -1
  325. package/tests/cli-integ-tests/cdk-import-interactive.integtest.ts +1 -1
  326. package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.d.ts +1 -0
  327. package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.js +27 -0
  328. package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.ts +32 -0
  329. package/tests/cli-integ-tests/cdk-lib-cli-lib-list.integtest.d.ts +1 -0
  330. package/tests/cli-integ-tests/cdk-lib-cli-lib-list.integtest.js +9 -0
  331. package/tests/cli-integ-tests/cdk-lib-cli-lib-list.integtest.ts +12 -0
  332. package/tests/cli-integ-tests/cdk-lib-cli-lib-synth.integtest.d.ts +1 -0
  333. package/tests/cli-integ-tests/cdk-lib-cli-lib-synth.integtest.js +22 -0
  334. package/tests/cli-integ-tests/cdk-lib-cli-lib-synth.integtest.ts +27 -0
  335. package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.d.ts +1 -0
  336. package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.js +20 -0
  337. package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.ts +32 -0
  338. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.d.ts +1 -0
  339. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.js +9 -0
  340. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.ts +11 -0
  341. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.d.ts +1 -0
  342. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.js +9 -0
  343. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.ts +11 -0
  344. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.d.ts +1 -0
  345. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.js +9 -0
  346. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.ts +11 -0
  347. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.d.ts +1 -0
  348. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.js +9 -0
  349. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.ts +11 -0
  350. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.d.ts +1 -0
  351. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.js +9 -0
  352. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.ts +13 -0
  353. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.d.ts +1 -0
  354. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.js +9 -0
  355. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.ts +13 -0
  356. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.d.ts +1 -0
  357. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.js +9 -0
  358. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.ts +13 -0
  359. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.d.ts +1 -0
  360. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.js +9 -0
  361. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.ts +13 -0
  362. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.d.ts +1 -0
  363. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.js +16 -0
  364. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.ts +20 -0
  365. package/tests/cli-integ-tests/cdk-migrate/testcase.d.ts +3 -0
  366. package/tests/cli-integ-tests/cdk-migrate/testcase.js +55 -0
  367. package/tests/cli-integ-tests/cdk-migrate/testcase.ts +69 -0
  368. package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.d.ts +1 -0
  369. package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.js +22 -0
  370. package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.ts +28 -0
  371. package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.d.ts +1 -0
  372. package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.js +36 -0
  373. package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.ts +39 -0
  374. package/tests/cli-integ-tests/cdk-sam-can-locally-test-the-synthesized-cdk-application.integtest.d.ts +1 -0
  375. package/tests/cli-integ-tests/cdk-sam-can-locally-test-the-synthesized-cdk-application.integtest.js +14 -0
  376. package/tests/cli-integ-tests/cdk-sam-can-locally-test-the-synthesized-cdk-application.integtest.ts +25 -0
  377. package/tests/cli-integ-tests/cdk-security-related-changes-without-a-cli-are-expected-to-fail.integtest.d.ts +1 -0
  378. package/tests/cli-integ-tests/cdk-security-related-changes-without-a-cli-are-expected-to-fail.integtest.js +20 -0
  379. package/tests/cli-integ-tests/cdk-security-related-changes-without-a-cli-are-expected-to-fail.integtest.ts +30 -0
  380. package/tests/cli-integ-tests/cdk-skips-notice-refresh.integtest.d.ts +6 -0
  381. package/tests/cli-integ-tests/cdk-skips-notice-refresh.integtest.js +22 -0
  382. package/tests/cli-integ-tests/cdk-skips-notice-refresh.integtest.ts +26 -0
  383. package/tests/cli-integ-tests/cdk-ssm-parameter-provider-error.integtest.d.ts +1 -0
  384. package/tests/cli-integ-tests/cdk-ssm-parameter-provider-error.integtest.js +10 -0
  385. package/tests/cli-integ-tests/cdk-ssm-parameter-provider-error.integtest.ts +18 -0
  386. package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.d.ts +1 -0
  387. package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.js +41 -0
  388. package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.ts +59 -0
  389. package/tests/cli-integ-tests/cdk-stage-with-bundled-lambda-function.integtest.d.ts +1 -0
  390. package/tests/cli-integ-tests/cdk-stage-with-bundled-lambda-function.integtest.js +10 -0
  391. package/tests/cli-integ-tests/cdk-stage-with-bundled-lambda-function.integtest.ts +13 -0
  392. package/tests/cli-integ-tests/cdk-synth---quiet-can-be-specified-in-cdk.json.integtest.d.ts +1 -0
  393. package/tests/cli-integ-tests/cdk-synth---quiet-can-be-specified-in-cdk.json.integtest.js +17 -0
  394. package/tests/cli-integ-tests/cdk-synth---quiet-can-be-specified-in-cdk.json.integtest.ts +20 -0
  395. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-can-be-suppressed.integtest.d.ts +1 -0
  396. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-can-be-suppressed.integtest.js +12 -0
  397. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-can-be-suppressed.integtest.ts +15 -0
  398. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-leads-to-failure.integtest.d.ts +1 -0
  399. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-leads-to-failure.integtest.js +14 -0
  400. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-leads-to-failure.integtest.ts +18 -0
  401. package/tests/cli-integ-tests/cdk-templates-on-disk-contain-metadata-resource.integtest.d.ts +1 -0
  402. package/tests/cli-integ-tests/cdk-templates-on-disk-contain-metadata-resource.integtest.js +18 -0
  403. package/tests/cli-integ-tests/cdk-templates-on-disk-contain-metadata-resource.integtest.ts +25 -0
  404. package/tests/cli-integ-tests/cdk-termination-protection.integtest.d.ts +1 -0
  405. package/tests/cli-integ-tests/cdk-termination-protection.integtest.js +14 -0
  406. package/tests/cli-integ-tests/cdk-termination-protection.integtest.ts +19 -0
  407. package/tests/cli-integ-tests/cdk-test-cdk-rollback---force.integtest.d.ts +1 -0
  408. package/tests/cli-integ-tests/cdk-test-cdk-rollback---force.integtest.js +40 -0
  409. package/tests/cli-integ-tests/cdk-test-cdk-rollback---force.integtest.ts +48 -0
  410. package/tests/cli-integ-tests/cdk-test-cdk-rollback.integtest.d.ts +1 -0
  411. package/tests/cli-integ-tests/cdk-test-cdk-rollback.integtest.js +33 -0
  412. package/tests/cli-integ-tests/cdk-test-cdk-rollback.integtest.ts +38 -0
  413. package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.d.ts +1 -0
  414. package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.js +45 -0
  415. package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.ts +56 -0
  416. package/tests/cli-integ-tests/cdk-test-resource-import-with-construct-that-requires-bundling.integtest.d.ts +6 -0
  417. package/tests/cli-integ-tests/cdk-test-resource-import-with-construct-that-requires-bundling.integtest.js +59 -0
  418. package/tests/cli-integ-tests/cdk-test-resource-import-with-construct-that-requires-bundling.integtest.ts +74 -0
  419. package/tests/cli-integ-tests/cdk-test-resource-import.integtest.d.ts +1 -0
  420. package/tests/cli-integ-tests/cdk-test-resource-import.integtest.js +51 -0
  421. package/tests/cli-integ-tests/cdk-test-resource-import.integtest.ts +64 -0
  422. package/tests/cli-integ-tests/cdk-two-ways-of-showing-the-version.integtest.d.ts +1 -0
  423. package/tests/cli-integ-tests/cdk-two-ways-of-showing-the-version.integtest.js +10 -0
  424. package/tests/cli-integ-tests/cdk-two-ways-of-showing-the-version.integtest.ts +14 -0
  425. package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.d.ts +1 -0
  426. package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.js +34 -0
  427. package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.ts +47 -0
  428. package/tests/cli-integ-tests/cdk-vpc-lookup.integtest.d.ts +1 -0
  429. package/tests/cli-integ-tests/cdk-vpc-lookup.integtest.js +21 -0
  430. package/tests/cli-integ-tests/cdk-vpc-lookup.integtest.ts +26 -0
  431. package/tests/cli-integ-tests/bootstrapping.integtest.js +0 -431
  432. package/tests/cli-integ-tests/bootstrapping.integtest.ts +0 -517
  433. package/tests/cli-integ-tests/cli-lib.integtest.js +0 -62
  434. package/tests/cli-integ-tests/cli-lib.integtest.ts +0 -90
  435. package/tests/cli-integ-tests/cli.integtest.js +0 -2188
  436. package/tests/cli-integ-tests/cli.integtest.ts +0 -2971
  437. package/tests/cli-integ-tests/garbage-collection.integtest.js +0 -314
  438. package/tests/cli-integ-tests/garbage-collection.integtest.ts +0 -392
  439. /package/tests/cli-integ-tests/{bootstrapping.integtest.d.ts → cdk---exclusively-selects-only-selected-stack.integtest.d.ts} +0 -0
  440. /package/tests/cli-integ-tests/{cli-lib.integtest.d.ts → cdk-assets/cdk-assets-uses-profile.integtest.d.ts} +0 -0
  441. /package/tests/cli-integ-tests/{cli.integtest.d.ts → cdk-automatic-ordering-with-concurrency.integtest.d.ts} +0 -0
  442. /package/tests/cli-integ-tests/{garbage-collection.integtest.d.ts → cdk-automatic-ordering.integtest.d.ts} +0 -0
@@ -1,2971 +0,0 @@
1
- import { existsSync, promises as fs } from 'fs';
2
- import * as os from 'os';
3
- import * as path from 'path';
4
- import {
5
- CreateStackCommand,
6
- DescribeStackResourcesCommand,
7
- DescribeStacksCommand,
8
- GetTemplateCommand,
9
- ListChangeSetsCommand,
10
- UpdateStackCommand,
11
- waitUntilStackUpdateComplete,
12
- } from '@aws-sdk/client-cloudformation';
13
- import { DescribeServicesCommand } from '@aws-sdk/client-ecs';
14
- import {
15
- CreateRoleCommand,
16
- DeleteRoleCommand,
17
- DeleteRolePolicyCommand,
18
- ListRolePoliciesCommand,
19
- PutRolePolicyCommand,
20
- } from '@aws-sdk/client-iam';
21
- import { InvokeCommand } from '@aws-sdk/client-lambda';
22
- import { PutObjectLockConfigurationCommand } from '@aws-sdk/client-s3';
23
- import { CreateTopicCommand, DeleteTopicCommand } from '@aws-sdk/client-sns';
24
- import { AssumeRoleCommand, GetCallerIdentityCommand } from '@aws-sdk/client-sts';
25
- import {
26
- CdkCliOptions,
27
- cloneDirectory,
28
- integTest,
29
- randomInteger,
30
- randomString,
31
- RESOURCES_DIR,
32
- retry,
33
- shell,
34
- sleep,
35
- withCDKMigrateFixture,
36
- withDefaultFixture,
37
- withExtendedTimeoutFixture,
38
- withoutBootstrap,
39
- withSamIntegrationFixture,
40
- withSpecificFixture,
41
- } from '../../lib';
42
- import { awsActionsFromRequests, startProxyServer } from '../../lib/proxy';
43
-
44
- jest.setTimeout(2 * 60 * 60_000); // Includes the time to acquire locks, worst-case single-threaded runtime
45
-
46
- describe('ci', () => {
47
- integTest(
48
- 'output to stderr',
49
- withDefaultFixture(async (fixture) => {
50
- const deployOutput = await fixture.cdkDeploy('test-2', { captureStderr: true, onlyStderr: true });
51
- const diffOutput = await fixture.cdk(['diff', fixture.fullStackName('test-2')], {
52
- captureStderr: true,
53
- onlyStderr: true,
54
- });
55
- const destroyOutput = await fixture.cdkDestroy('test-2', { captureStderr: true, onlyStderr: true });
56
- expect(deployOutput).not.toEqual('');
57
- expect(destroyOutput).not.toEqual('');
58
- expect(diffOutput).not.toEqual('');
59
- }),
60
- );
61
- describe('ci=true', () => {
62
- integTest(
63
- 'output to stdout',
64
- withDefaultFixture(async (fixture) => {
65
- const execOptions: CdkCliOptions = {
66
- captureStderr: true,
67
- onlyStderr: true,
68
- modEnv: {
69
- CI: 'true',
70
- JSII_SILENCE_WARNING_KNOWN_BROKEN_NODE_VERSION: 'true',
71
- JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION: 'true',
72
- JSII_SILENCE_WARNING_DEPRECATED_NODE_VERSION: 'true',
73
- },
74
- options: ['--no-notices'],
75
- };
76
-
77
- const deployOutput = await fixture.cdkDeploy('test-2', execOptions);
78
- const diffOutput = await fixture.cdk(['diff', fixture.fullStackName('test-2')], execOptions);
79
- const destroyOutput = await fixture.cdkDestroy('test-2', execOptions);
80
- expect(deployOutput).toEqual('');
81
- expect(destroyOutput).toEqual('');
82
- expect(diffOutput).toEqual('');
83
- }),
84
- );
85
- });
86
- });
87
-
88
- integTest(
89
- 'VPC Lookup',
90
- withDefaultFixture(async (fixture) => {
91
- fixture.log('Making sure we are clean before starting.');
92
- await fixture.cdkDestroy('define-vpc', { modEnv: { ENABLE_VPC_TESTING: 'DEFINE' } });
93
-
94
- fixture.log('Setting up: creating a VPC with known tags');
95
- await fixture.cdkDeploy('define-vpc', { modEnv: { ENABLE_VPC_TESTING: 'DEFINE' } });
96
- fixture.log('Setup complete!');
97
-
98
- fixture.log('Verifying we can now import that VPC');
99
- await fixture.cdkDeploy('import-vpc', { modEnv: { ENABLE_VPC_TESTING: 'IMPORT' } });
100
- }),
101
- );
102
-
103
- // testing a construct with a builtin Nodejs Lambda Function.
104
- // In this case we are testing the s3.Bucket construct with the
105
- // autoDeleteObjects prop set to true, which creates a Lambda backed
106
- // CustomResource. Since the compiled Lambda code (e.g. __entrypoint__.js)
107
- // is bundled as part of the CDK package, we want to make sure we don't
108
- // introduce changes to the compiled code that could prevent the Lambda from
109
- // executing. If we do, this test will timeout and fail.
110
- integTest(
111
- 'Construct with builtin Lambda function',
112
- withDefaultFixture(async (fixture) => {
113
- await fixture.cdkDeploy('builtin-lambda-function');
114
- fixture.log('Setup complete!');
115
- await fixture.cdkDestroy('builtin-lambda-function');
116
- }),
117
- );
118
-
119
- // this is to ensure that asset bundling for apps under a stage does not break
120
- integTest(
121
- 'Stage with bundled Lambda function',
122
- withDefaultFixture(async (fixture) => {
123
- await fixture.cdkDeploy('bundling-stage/BundlingStack');
124
- fixture.log('Setup complete!');
125
- await fixture.cdkDestroy('bundling-stage/BundlingStack');
126
- }),
127
- );
128
-
129
- integTest(
130
- 'Two ways of showing the version',
131
- withDefaultFixture(async (fixture) => {
132
- const version1 = await fixture.cdk(['version'], { verbose: false });
133
- const version2 = await fixture.cdk(['--version'], { verbose: false });
134
-
135
- expect(version1).toEqual(version2);
136
- }),
137
- );
138
-
139
- integTest(
140
- 'Termination protection',
141
- withDefaultFixture(async (fixture) => {
142
- const stackName = 'termination-protection';
143
- await fixture.cdkDeploy(stackName);
144
-
145
- // Try a destroy that should fail
146
- await expect(fixture.cdkDestroy(stackName)).rejects.toThrow('exited with error');
147
-
148
- // Can update termination protection even though the change set doesn't contain changes
149
- await fixture.cdkDeploy(stackName, { modEnv: { TERMINATION_PROTECTION: 'FALSE' } });
150
- await fixture.cdkDestroy(stackName);
151
- }),
152
- );
153
-
154
- integTest(
155
- 'cdk synth',
156
- withDefaultFixture(async (fixture) => {
157
- await fixture.cdk(['synth', fixture.fullStackName('test-1')]);
158
- expect(fixture.template('test-1')).toEqual(
159
- expect.objectContaining({
160
- Resources: {
161
- topic69831491: {
162
- Type: 'AWS::SNS::Topic',
163
- Metadata: {
164
- 'aws:cdk:path': `${fixture.stackNamePrefix}-test-1/topic/Resource`,
165
- },
166
- },
167
- },
168
- }),
169
- );
170
-
171
- expect(
172
- await fixture.cdkSynth({
173
- options: [fixture.fullStackName('test-1')],
174
- }),
175
- ).not.toEqual(
176
- expect.stringContaining(`
177
- Rules:
178
- CheckBootstrapVersion:`),
179
- );
180
-
181
- await fixture.cdk(['synth', fixture.fullStackName('test-2')], { verbose: false });
182
- expect(fixture.template('test-2')).toEqual(
183
- expect.objectContaining({
184
- Resources: {
185
- topic152D84A37: {
186
- Type: 'AWS::SNS::Topic',
187
- Metadata: {
188
- 'aws:cdk:path': `${fixture.stackNamePrefix}-test-2/topic1/Resource`,
189
- },
190
- },
191
- topic2A4FB547F: {
192
- Type: 'AWS::SNS::Topic',
193
- Metadata: {
194
- 'aws:cdk:path': `${fixture.stackNamePrefix}-test-2/topic2/Resource`,
195
- },
196
- },
197
- },
198
- }),
199
- );
200
- }),
201
- );
202
-
203
- integTest(
204
- 'ssm parameter provider error',
205
- withDefaultFixture(async (fixture) => {
206
- await expect(
207
- fixture.cdk(
208
- ['synth', fixture.fullStackName('missing-ssm-parameter'), '-c', 'test:ssm-parameter-name=/does/not/exist'],
209
- {
210
- allowErrExit: true,
211
- },
212
- ),
213
- ).resolves.toContain('SSM parameter not available in account');
214
- }),
215
- );
216
-
217
- integTest(
218
- 'automatic ordering',
219
- withDefaultFixture(async (fixture) => {
220
- // Deploy the consuming stack which will include the producing stack
221
- await fixture.cdkDeploy('order-consuming');
222
-
223
- // Destroy the providing stack which will include the consuming stack
224
- await fixture.cdkDestroy('order-providing');
225
- }),
226
- );
227
-
228
- integTest(
229
- 'automatic ordering with concurrency',
230
- withDefaultFixture(async (fixture) => {
231
- // Deploy the consuming stack which will include the producing stack
232
- await fixture.cdkDeploy('order-consuming', { options: ['--concurrency', '2'] });
233
-
234
- // Destroy the providing stack which will include the consuming stack
235
- await fixture.cdkDestroy('order-providing');
236
- }),
237
- );
238
-
239
- integTest(
240
- '--exclusively selects only selected stack',
241
- withDefaultFixture(async (fixture) => {
242
- // Deploy the "depends-on-failed" stack, with --exclusively. It will NOT fail (because
243
- // of --exclusively) and it WILL create an output we can check for to confirm that it did
244
- // get deployed.
245
- const outputsFile = path.join(fixture.integTestDir, 'outputs', 'outputs.json');
246
- await fs.mkdir(path.dirname(outputsFile), { recursive: true });
247
-
248
- await fixture.cdkDeploy('depends-on-failed', {
249
- options: ['--exclusively', '--outputs-file', outputsFile],
250
- });
251
-
252
- // Verify the output to see that the stack deployed
253
- const outputs = JSON.parse((await fs.readFile(outputsFile, { encoding: 'utf-8' })).toString());
254
- expect(outputs).toEqual({
255
- [`${fixture.stackNamePrefix}-depends-on-failed`]: {
256
- TopicName: `${fixture.stackNamePrefix}-depends-on-failedMyTopic`,
257
- },
258
- });
259
- }),
260
- );
261
-
262
- integTest(
263
- 'context setting',
264
- withDefaultFixture(async (fixture) => {
265
- await fs.writeFile(
266
- path.join(fixture.integTestDir, 'cdk.context.json'),
267
- JSON.stringify({
268
- contextkey: 'this is the context value',
269
- }),
270
- );
271
- try {
272
- await expect(fixture.cdk(['context'])).resolves.toContain('this is the context value');
273
-
274
- // Test that deleting the contextkey works
275
- await fixture.cdk(['context', '--reset', 'contextkey']);
276
- await expect(fixture.cdk(['context'])).resolves.not.toContain('this is the context value');
277
-
278
- // Test that forced delete of the context key does not throw
279
- await fixture.cdk(['context', '-f', '--reset', 'contextkey']);
280
- } finally {
281
- await fs.unlink(path.join(fixture.integTestDir, 'cdk.context.json'));
282
- }
283
- }),
284
- );
285
-
286
- // bootstrapping also performs synthesis. As it turns out, bootstrap-stage synthesis still causes the lookups to be cached, meaning that the lookup never
287
- // happens when we actually call `cdk synth --no-lookups`. This results in the error never being thrown, because it never tries to lookup anything.
288
- // Fix this by not trying to bootstrap; there's no need to bootstrap anyway, since the test never tries to deploy anything.
289
- integTest(
290
- 'context in stage propagates to top',
291
- withoutBootstrap(async (fixture) => {
292
- await expect(
293
- fixture.cdkSynth({
294
- // This will make it error to prove that the context bubbles up, and also that we can fail on command
295
- options: ['--no-lookups'],
296
- modEnv: {
297
- INTEG_STACK_SET: 'stage-using-context',
298
- },
299
- allowErrExit: true,
300
- }),
301
- ).resolves.toContain('Context lookups have been disabled');
302
- }),
303
- );
304
-
305
- integTest(
306
- 'deploy',
307
- withDefaultFixture(async (fixture) => {
308
- const stackArn = await fixture.cdkDeploy('test-2', { captureStderr: false });
309
-
310
- // verify the number of resources in the stack
311
- const response = await fixture.aws.cloudFormation.send(
312
- new DescribeStackResourcesCommand({
313
- StackName: stackArn,
314
- }),
315
- );
316
- expect(response.StackResources?.length).toEqual(2);
317
- }),
318
- );
319
-
320
- integTest(
321
- 'deploy --method=direct',
322
- withDefaultFixture(async (fixture) => {
323
- const stackArn = await fixture.cdkDeploy('test-2', {
324
- options: ['--method=direct'],
325
- captureStderr: false,
326
- });
327
-
328
- // verify the number of resources in the stack
329
- const response = await fixture.aws.cloudFormation.send(
330
- new DescribeStackResourcesCommand({
331
- StackName: stackArn,
332
- }),
333
- );
334
- expect(response.StackResources?.length).toBeGreaterThan(0);
335
- }),
336
- );
337
-
338
- integTest(
339
- 'deploy all',
340
- withDefaultFixture(async (fixture) => {
341
- const arns = await fixture.cdkDeploy('test-*', { captureStderr: false });
342
-
343
- // verify that we only deployed both stacks (there are 2 ARNs in the output)
344
- expect(arns.split('\n').length).toEqual(2);
345
- }),
346
- );
347
-
348
- integTest(
349
- 'deploy all concurrently',
350
- withDefaultFixture(async (fixture) => {
351
- const arns = await fixture.cdkDeploy('test-*', {
352
- captureStderr: false,
353
- options: ['--concurrency', '2'],
354
- });
355
-
356
- // verify that we only deployed both stacks (there are 2 ARNs in the output)
357
- expect(arns.split('\n').length).toEqual(2);
358
- }),
359
- );
360
-
361
- integTest('doubly nested stack',
362
- withDefaultFixture(async (fixture) => {
363
- await fixture.cdkDeploy('with-doubly-nested-stack', {
364
- captureStderr: false,
365
- });
366
- }),
367
- );
368
-
369
- integTest(
370
- 'nested stack with parameters',
371
- withDefaultFixture(async (fixture) => {
372
- // STACK_NAME_PREFIX is used in MyTopicParam to allow multiple instances
373
- // of this test to run in parallel, othewise they will attempt to create the same SNS topic.
374
- const stackArn = await fixture.cdkDeploy('with-nested-stack-using-parameters', {
375
- options: ['--parameters', `MyTopicParam=${fixture.stackNamePrefix}ThereIsNoSpoon`],
376
- captureStderr: false,
377
- });
378
-
379
- // verify that we only deployed a single stack (there's a single ARN in the output)
380
- expect(stackArn.split('\n').length).toEqual(1);
381
-
382
- // verify the number of resources in the stack
383
- const response = await fixture.aws.cloudFormation.send(
384
- new DescribeStackResourcesCommand({
385
- StackName: stackArn,
386
- }),
387
- );
388
- expect(response.StackResources?.length).toEqual(1);
389
- }),
390
- );
391
-
392
- integTest(
393
- 'deploy without execute a named change set',
394
- withDefaultFixture(async (fixture) => {
395
- const changeSetName = 'custom-change-set-name';
396
- const stackArn = await fixture.cdkDeploy('test-2', {
397
- options: ['--no-execute', '--change-set-name', changeSetName],
398
- captureStderr: false,
399
- });
400
- // verify that we only deployed a single stack (there's a single ARN in the output)
401
- expect(stackArn.split('\n').length).toEqual(1);
402
-
403
- const response = await fixture.aws.cloudFormation.send(
404
- new DescribeStacksCommand({
405
- StackName: stackArn,
406
- }),
407
- );
408
- expect(response.Stacks?.[0].StackStatus).toEqual('REVIEW_IN_PROGRESS');
409
-
410
- // verify a change set was created with the provided name
411
- const changeSetResponse = await fixture.aws.cloudFormation.send(
412
- new ListChangeSetsCommand({
413
- StackName: stackArn,
414
- }),
415
- );
416
- const changeSets = changeSetResponse.Summaries || [];
417
- expect(changeSets.length).toEqual(1);
418
- expect(changeSets[0].ChangeSetName).toEqual(changeSetName);
419
- expect(changeSets[0].Status).toEqual('CREATE_COMPLETE');
420
- }),
421
- );
422
-
423
- integTest(
424
- 'security related changes without a CLI are expected to fail',
425
- withDefaultFixture(async (fixture) => {
426
- // redirect /dev/null to stdin, which means there will not be tty attached
427
- // since this stack includes security-related changes, the deployment should
428
- // immediately fail because we can't confirm the changes
429
- const stackName = 'iam-test';
430
- await expect(
431
- fixture.cdkDeploy(stackName, {
432
- options: ['<', '/dev/null'], // H4x, this only works because I happen to know we pass shell: true.
433
- neverRequireApproval: false,
434
- }),
435
- ).rejects.toThrow('exited with error');
436
-
437
- // Ensure stack was not deployed
438
- await expect(
439
- fixture.aws.cloudFormation.send(
440
- new DescribeStacksCommand({
441
- StackName: fixture.fullStackName(stackName),
442
- }),
443
- ),
444
- ).rejects.toThrow('does not exist');
445
- }),
446
- );
447
-
448
- integTest(
449
- 'deploy wildcard with outputs',
450
- withDefaultFixture(async (fixture) => {
451
- const outputsFile = path.join(fixture.integTestDir, 'outputs', 'outputs.json');
452
- await fs.mkdir(path.dirname(outputsFile), { recursive: true });
453
-
454
- await fixture.cdkDeploy(['outputs-test-*'], {
455
- options: ['--outputs-file', outputsFile],
456
- });
457
-
458
- const outputs = JSON.parse((await fs.readFile(outputsFile, { encoding: 'utf-8' })).toString());
459
- expect(outputs).toEqual({
460
- [`${fixture.stackNamePrefix}-outputs-test-1`]: {
461
- TopicName: `${fixture.stackNamePrefix}-outputs-test-1MyTopic`,
462
- },
463
- [`${fixture.stackNamePrefix}-outputs-test-2`]: {
464
- TopicName: `${fixture.stackNamePrefix}-outputs-test-2MyOtherTopic`,
465
- },
466
- });
467
- }),
468
- );
469
-
470
- integTest(
471
- 'deploy with parameters',
472
- withDefaultFixture(async (fixture) => {
473
- const stackArn = await fixture.cdkDeploy('param-test-1', {
474
- options: ['--parameters', `TopicNameParam=${fixture.stackNamePrefix}bazinga`],
475
- captureStderr: false,
476
- });
477
-
478
- const response = await fixture.aws.cloudFormation.send(
479
- new DescribeStacksCommand({
480
- StackName: stackArn,
481
- }),
482
- );
483
-
484
- expect(response.Stacks?.[0].Parameters).toContainEqual({
485
- ParameterKey: 'TopicNameParam',
486
- ParameterValue: `${fixture.stackNamePrefix}bazinga`,
487
- });
488
- }),
489
- );
490
-
491
- integTest('deploy with import-existing-resources true', withDefaultFixture(async (fixture) => {
492
- const stackArn = await fixture.cdkDeploy('test-2', {
493
- options: ['--no-execute', '--import-existing-resources'],
494
- captureStderr: false,
495
- });
496
- // verify that we only deployed a single stack (there's a single ARN in the output)
497
- expect(stackArn.split('\n').length).toEqual(1);
498
-
499
- const response = await fixture.aws.cloudFormation.send(new DescribeStacksCommand({
500
- StackName: stackArn,
501
- }));
502
- expect(response.Stacks?.[0].StackStatus).toEqual('REVIEW_IN_PROGRESS');
503
-
504
- // verify a change set was successfully created
505
- // Here, we do not test whether a resource is actually imported, because that is a CloudFormation feature, not a CDK feature.
506
- const changeSetResponse = await fixture.aws.cloudFormation.send(new ListChangeSetsCommand({
507
- StackName: stackArn,
508
- }));
509
- const changeSets = changeSetResponse.Summaries || [];
510
- expect(changeSets.length).toEqual(1);
511
- expect(changeSets[0].Status).toEqual('CREATE_COMPLETE');
512
- expect(changeSets[0].ImportExistingResources).toEqual(true);
513
- }));
514
-
515
- integTest('deploy without import-existing-resources', withDefaultFixture(async (fixture) => {
516
- const stackArn = await fixture.cdkDeploy('test-2', {
517
- options: ['--no-execute'],
518
- captureStderr: false,
519
- });
520
- // verify that we only deployed a single stack (there's a single ARN in the output)
521
- expect(stackArn.split('\n').length).toEqual(1);
522
-
523
- const response = await fixture.aws.cloudFormation.send(new DescribeStacksCommand({
524
- StackName: stackArn,
525
- }));
526
- expect(response.Stacks?.[0].StackStatus).toEqual('REVIEW_IN_PROGRESS');
527
-
528
- // verify a change set was successfully created and ImportExistingResources = false
529
- const changeSetResponse = await fixture.aws.cloudFormation.send(new ListChangeSetsCommand({
530
- StackName: stackArn,
531
- }));
532
- const changeSets = changeSetResponse.Summaries || [];
533
- expect(changeSets.length).toEqual(1);
534
- expect(changeSets[0].Status).toEqual('CREATE_COMPLETE');
535
- expect(changeSets[0].ImportExistingResources).toEqual(false);
536
- }));
537
-
538
- integTest('deploy with method=direct and import-existing-resources fails', withDefaultFixture(async (fixture) => {
539
- const stackName = 'iam-test';
540
- await expect(fixture.cdkDeploy(stackName, {
541
- options: ['--import-existing-resources', '--method=direct'],
542
- })).rejects.toThrow('exited with error');
543
-
544
- // Ensure stack was not deployed
545
- await expect(fixture.aws.cloudFormation.send(new DescribeStacksCommand({
546
- StackName: fixture.fullStackName(stackName),
547
- }))).rejects.toThrow('does not exist');
548
- }));
549
-
550
- integTest(
551
- 'update to stack in ROLLBACK_COMPLETE state will delete stack and create a new one',
552
- withDefaultFixture(async (fixture) => {
553
- // GIVEN
554
- await expect(
555
- fixture.cdkDeploy('param-test-1', {
556
- options: ['--parameters', `TopicNameParam=${fixture.stackNamePrefix}@aww`],
557
- captureStderr: false,
558
- }),
559
- ).rejects.toThrow('exited with error');
560
-
561
- const response = await fixture.aws.cloudFormation.send(
562
- new DescribeStacksCommand({
563
- StackName: fixture.fullStackName('param-test-1'),
564
- }),
565
- );
566
-
567
- const stackArn = response.Stacks?.[0].StackId;
568
- expect(response.Stacks?.[0].StackStatus).toEqual('ROLLBACK_COMPLETE');
569
-
570
- // WHEN
571
- const newStackArn = await fixture.cdkDeploy('param-test-1', {
572
- options: ['--parameters', `TopicNameParam=${fixture.stackNamePrefix}allgood`],
573
- captureStderr: false,
574
- });
575
-
576
- const newStackResponse = await fixture.aws.cloudFormation.send(
577
- new DescribeStacksCommand({
578
- StackName: newStackArn,
579
- }),
580
- );
581
-
582
- // THEN
583
- expect(stackArn).not.toEqual(newStackArn); // new stack was created
584
- expect(newStackResponse.Stacks?.[0].StackStatus).toEqual('CREATE_COMPLETE');
585
- expect(newStackResponse.Stacks?.[0].Parameters).toContainEqual({
586
- ParameterKey: 'TopicNameParam',
587
- ParameterValue: `${fixture.stackNamePrefix}allgood`,
588
- });
589
- }),
590
- );
591
-
592
- integTest(
593
- 'stack in UPDATE_ROLLBACK_COMPLETE state can be updated',
594
- withDefaultFixture(async (fixture) => {
595
- // GIVEN
596
- const stackArn = await fixture.cdkDeploy('param-test-1', {
597
- options: ['--parameters', `TopicNameParam=${fixture.stackNamePrefix}nice`],
598
- captureStderr: false,
599
- });
600
-
601
- let response = await fixture.aws.cloudFormation.send(
602
- new DescribeStacksCommand({
603
- StackName: stackArn,
604
- }),
605
- );
606
-
607
- expect(response.Stacks?.[0].StackStatus).toEqual('CREATE_COMPLETE');
608
-
609
- // bad parameter name with @ will put stack into UPDATE_ROLLBACK_COMPLETE
610
- await expect(
611
- fixture.cdkDeploy('param-test-1', {
612
- options: ['--parameters', `TopicNameParam=${fixture.stackNamePrefix}@aww`],
613
- captureStderr: false,
614
- }),
615
- ).rejects.toThrow('exited with error');
616
-
617
- response = await fixture.aws.cloudFormation.send(
618
- new DescribeStacksCommand({
619
- StackName: stackArn,
620
- }),
621
- );
622
-
623
- expect(response.Stacks?.[0].StackStatus).toEqual('UPDATE_ROLLBACK_COMPLETE');
624
-
625
- // WHEN
626
- await fixture.cdkDeploy('param-test-1', {
627
- options: ['--parameters', `TopicNameParam=${fixture.stackNamePrefix}allgood`],
628
- captureStderr: false,
629
- });
630
-
631
- response = await fixture.aws.cloudFormation.send(
632
- new DescribeStacksCommand({
633
- StackName: stackArn,
634
- }),
635
- );
636
-
637
- // THEN
638
- expect(response.Stacks?.[0].StackStatus).toEqual('UPDATE_COMPLETE');
639
- expect(response.Stacks?.[0].Parameters).toContainEqual({
640
- ParameterKey: 'TopicNameParam',
641
- ParameterValue: `${fixture.stackNamePrefix}allgood`,
642
- });
643
- }),
644
- );
645
-
646
- integTest(
647
- 'deploy with wildcard and parameters',
648
- withDefaultFixture(async (fixture) => {
649
- await fixture.cdkDeploy('param-test-*', {
650
- options: [
651
- '--parameters',
652
- `${fixture.stackNamePrefix}-param-test-1:TopicNameParam=${fixture.stackNamePrefix}bazinga`,
653
- '--parameters',
654
- `${fixture.stackNamePrefix}-param-test-2:OtherTopicNameParam=${fixture.stackNamePrefix}ThatsMySpot`,
655
- '--parameters',
656
- `${fixture.stackNamePrefix}-param-test-3:DisplayNameParam=${fixture.stackNamePrefix}HeyThere`,
657
- '--parameters',
658
- `${fixture.stackNamePrefix}-param-test-3:OtherDisplayNameParam=${fixture.stackNamePrefix}AnotherOne`,
659
- ],
660
- });
661
- }),
662
- );
663
-
664
- integTest(
665
- 'deploy with parameters multi',
666
- withDefaultFixture(async (fixture) => {
667
- const paramVal1 = `${fixture.stackNamePrefix}bazinga`;
668
- const paramVal2 = `${fixture.stackNamePrefix}=jagshemash`;
669
-
670
- const stackArn = await fixture.cdkDeploy('param-test-3', {
671
- options: ['--parameters', `DisplayNameParam=${paramVal1}`, '--parameters', `OtherDisplayNameParam=${paramVal2}`],
672
- captureStderr: false,
673
- });
674
-
675
- const response = await fixture.aws.cloudFormation.send(
676
- new DescribeStacksCommand({
677
- StackName: stackArn,
678
- }),
679
- );
680
-
681
- expect(response.Stacks?.[0].Parameters).toContainEqual({
682
- ParameterKey: 'DisplayNameParam',
683
- ParameterValue: paramVal1,
684
- });
685
- expect(response.Stacks?.[0].Parameters).toContainEqual({
686
- ParameterKey: 'OtherDisplayNameParam',
687
- ParameterValue: paramVal2,
688
- });
689
- }),
690
- );
691
-
692
- integTest(
693
- 'deploy with notification ARN as flag',
694
- withDefaultFixture(async (fixture) => {
695
- const topicName = `${fixture.stackNamePrefix}-test-topic-flag`;
696
-
697
- const response = await fixture.aws.sns.send(new CreateTopicCommand({ Name: topicName }));
698
- const topicArn = response.TopicArn!;
699
-
700
- try {
701
- await fixture.cdkDeploy('notification-arns', {
702
- options: ['--notification-arns', topicArn],
703
- });
704
-
705
- // verify that the stack we deployed has our notification ARN
706
- const describeResponse = await fixture.aws.cloudFormation.send(
707
- new DescribeStacksCommand({
708
- StackName: fixture.fullStackName('notification-arns'),
709
- }),
710
- );
711
- expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([topicArn]);
712
- } finally {
713
- await fixture.aws.sns.send(
714
- new DeleteTopicCommand({
715
- TopicArn: topicArn,
716
- }),
717
- );
718
- }
719
- }),
720
- );
721
-
722
- integTest('deploy with notification ARN as prop', withDefaultFixture(async (fixture) => {
723
- const topicName = `${fixture.stackNamePrefix}-test-topic-prop`;
724
-
725
- const response = await fixture.aws.sns.send(new CreateTopicCommand({ Name: topicName }));
726
- const topicArn = response.TopicArn!;
727
-
728
- try {
729
- await fixture.cdkDeploy('notification-arns', {
730
- modEnv: {
731
- INTEG_NOTIFICATION_ARNS: topicArn,
732
-
733
- },
734
- });
735
-
736
- // verify that the stack we deployed has our notification ARN
737
- const describeResponse = await fixture.aws.cloudFormation.send(
738
- new DescribeStacksCommand({
739
- StackName: fixture.fullStackName('notification-arns'),
740
- }),
741
- );
742
- expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([topicArn]);
743
- } finally {
744
- await fixture.aws.sns.send(
745
- new DeleteTopicCommand({
746
- TopicArn: topicArn,
747
- }),
748
- );
749
- }
750
- }));
751
-
752
- // https://github.com/aws/aws-cdk/issues/32153
753
- integTest('deploy preserves existing notification arns when not specified', withDefaultFixture(async (fixture) => {
754
- const topicName = `${fixture.stackNamePrefix}-topic`;
755
-
756
- const response = await fixture.aws.sns.send(new CreateTopicCommand({ Name: topicName }));
757
- const topicArn = response.TopicArn!;
758
-
759
- try {
760
- await fixture.cdkDeploy('notification-arns');
761
-
762
- // add notification arns externally to cdk
763
- await fixture.aws.cloudFormation.send(
764
- new UpdateStackCommand({
765
- StackName: fixture.fullStackName('notification-arns'),
766
- UsePreviousTemplate: true,
767
- NotificationARNs: [topicArn],
768
- }),
769
- );
770
-
771
- await waitUntilStackUpdateComplete(
772
- {
773
- client: fixture.aws.cloudFormation,
774
- maxWaitTime: 600,
775
- },
776
- { StackName: fixture.fullStackName('notification-arns') },
777
- );
778
-
779
- // deploy again
780
- await fixture.cdkDeploy('notification-arns');
781
-
782
- // make sure the notification arn is preserved
783
- const describeResponse = await fixture.aws.cloudFormation.send(
784
- new DescribeStacksCommand({
785
- StackName: fixture.fullStackName('notification-arns'),
786
- }),
787
- );
788
- expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([topicArn]);
789
- } finally {
790
- await fixture.aws.sns.send(
791
- new DeleteTopicCommand({
792
- TopicArn: topicArn,
793
- }),
794
- );
795
- }
796
- }));
797
-
798
- integTest('deploy deletes ALL notification arns when empty array is passed', withDefaultFixture(async (fixture) => {
799
- const topicName = `${fixture.stackNamePrefix}-topic`;
800
-
801
- const response = await fixture.aws.sns.send(new CreateTopicCommand({ Name: topicName }));
802
- const topicArn = response.TopicArn!;
803
-
804
- try {
805
- await fixture.cdkDeploy('notification-arns', {
806
- modEnv: {
807
- INTEG_NOTIFICATION_ARNS: topicArn,
808
- },
809
- });
810
-
811
- // make sure the arn was added
812
- let describeResponse = await fixture.aws.cloudFormation.send(
813
- new DescribeStacksCommand({
814
- StackName: fixture.fullStackName('notification-arns'),
815
- }),
816
- );
817
- expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([topicArn]);
818
-
819
- // deploy again with empty array
820
- await fixture.cdkDeploy('notification-arns', {
821
- modEnv: {
822
- INTEG_NOTIFICATION_ARNS: '',
823
- },
824
- });
825
-
826
- // make sure the arn was deleted
827
- describeResponse = await fixture.aws.cloudFormation.send(
828
- new DescribeStacksCommand({
829
- StackName: fixture.fullStackName('notification-arns'),
830
- }),
831
- );
832
- expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([]);
833
- } finally {
834
- await fixture.aws.sns.send(
835
- new DeleteTopicCommand({
836
- TopicArn: topicArn,
837
- }),
838
- );
839
- }
840
- }));
841
-
842
- integTest('deploy with notification ARN as prop and flag', withDefaultFixture(async (fixture) => {
843
- const topic1Name = `${fixture.stackNamePrefix}-topic1`;
844
- const topic2Name = `${fixture.stackNamePrefix}-topic1`;
845
-
846
- const topic1Arn = (await fixture.aws.sns.send(new CreateTopicCommand({ Name: topic1Name }))).TopicArn!;
847
- const topic2Arn = (await fixture.aws.sns.send(new CreateTopicCommand({ Name: topic2Name }))).TopicArn!;
848
-
849
- try {
850
- await fixture.cdkDeploy('notification-arns', {
851
- modEnv: {
852
- INTEG_NOTIFICATION_ARNS: topic1Arn,
853
-
854
- },
855
- options: ['--notification-arns', topic2Arn],
856
- });
857
-
858
- // verify that the stack we deployed has our notification ARN
859
- const describeResponse = await fixture.aws.cloudFormation.send(
860
- new DescribeStacksCommand({
861
- StackName: fixture.fullStackName('notification-arns'),
862
- }),
863
- );
864
- expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([topic1Arn, topic2Arn]);
865
- } finally {
866
- await fixture.aws.sns.send(
867
- new DeleteTopicCommand({
868
- TopicArn: topic1Arn,
869
- }),
870
- );
871
- await fixture.aws.sns.send(
872
- new DeleteTopicCommand({
873
- TopicArn: topic2Arn,
874
- }),
875
- );
876
- }
877
- }));
878
-
879
- // NOTE: this doesn't currently work with modern-style synthesis, as the bootstrap
880
- // role by default will not have permission to iam:PassRole the created role.
881
- integTest(
882
- 'deploy with role',
883
- withDefaultFixture(async (fixture) => {
884
- if (fixture.packages.majorVersion() !== '1') {
885
- return; // Nothing to do
886
- }
887
-
888
- const roleName = `${fixture.stackNamePrefix}-test-role`;
889
-
890
- await deleteRole();
891
-
892
- const createResponse = await fixture.aws.iam.send(
893
- new CreateRoleCommand({
894
- RoleName: roleName,
895
- AssumeRolePolicyDocument: JSON.stringify({
896
- Version: '2012-10-17',
897
- Statement: [
898
- {
899
- Action: 'sts:AssumeRole',
900
- Principal: { Service: 'cloudformation.amazonaws.com' },
901
- Effect: 'Allow',
902
- },
903
- {
904
- Action: 'sts:AssumeRole',
905
- Principal: { AWS: (await fixture.aws.sts.send(new GetCallerIdentityCommand({}))).Arn },
906
- Effect: 'Allow',
907
- },
908
- ],
909
- }),
910
- }),
911
- );
912
-
913
- if (!createResponse.Role) {
914
- throw new Error('Role is expected to be present!!');
915
- }
916
-
917
- if (!createResponse.Role.Arn) {
918
- throw new Error('Role arn is expected to be present!!');
919
- }
920
-
921
- const roleArn = createResponse.Role.Arn;
922
- try {
923
- await fixture.aws.iam.send(
924
- new PutRolePolicyCommand({
925
- RoleName: roleName,
926
- PolicyName: 'DefaultPolicy',
927
- PolicyDocument: JSON.stringify({
928
- Version: '2012-10-17',
929
- Statement: [
930
- {
931
- Action: '*',
932
- Resource: '*',
933
- Effect: 'Allow',
934
- },
935
- ],
936
- }),
937
- }),
938
- );
939
-
940
- await retry(fixture.output, 'Trying to assume fresh role', retry.forSeconds(300), async () => {
941
- await fixture.aws.sts.send(
942
- new AssumeRoleCommand({
943
- RoleArn: roleArn,
944
- RoleSessionName: 'testing',
945
- }),
946
- );
947
- });
948
-
949
- // In principle, the role has replicated from 'us-east-1' to wherever we're testing.
950
- // Give it a little more sleep to make sure CloudFormation is not hitting a box
951
- // that doesn't have it yet.
952
- await sleep(5000);
953
-
954
- await fixture.cdkDeploy('test-2', {
955
- options: ['--role-arn', roleArn],
956
- });
957
-
958
- // Immediately delete the stack again before we delete the role.
959
- //
960
- // Since roles are sticky, if we delete the role before the stack, subsequent DeleteStack
961
- // operations will fail when CloudFormation tries to assume the role that's already gone.
962
- await fixture.cdkDestroy('test-2');
963
- } finally {
964
- await deleteRole();
965
- }
966
-
967
- async function deleteRole() {
968
- try {
969
- const response = await fixture.aws.iam.send(new ListRolePoliciesCommand({ RoleName: roleName }));
970
-
971
- if (!response.PolicyNames) {
972
- throw new Error('Policy names cannot be undefined for deleteRole() function');
973
- }
974
-
975
- for (const policyName of response.PolicyNames) {
976
- await fixture.aws.iam.send(
977
- new DeleteRolePolicyCommand({
978
- RoleName: roleName,
979
- PolicyName: policyName,
980
- }),
981
- );
982
- }
983
- await fixture.aws.iam.send(new DeleteRoleCommand({ RoleName: roleName }));
984
- } catch (e: any) {
985
- if (e.message.indexOf('cannot be found') > -1) {
986
- return;
987
- }
988
- throw e;
989
- }
990
- }
991
- }),
992
- );
993
-
994
- // TODO add more testing that ensures the symmetry of the generated constructs to the resources.
995
- ['typescript', 'python', 'csharp', 'java'].forEach((language) => {
996
- integTest(
997
- `cdk migrate ${language} deploys successfully`,
998
- withCDKMigrateFixture(language, async (fixture) => {
999
- if (language === 'python') {
1000
- await fixture.shell(['pip', 'install', '-r', 'requirements.txt']);
1001
- }
1002
-
1003
- const stackArn = await fixture.cdkDeploy(
1004
- fixture.stackNamePrefix,
1005
- { neverRequireApproval: true, verbose: true, captureStderr: false },
1006
- true,
1007
- );
1008
- const response = await fixture.aws.cloudFormation.send(
1009
- new DescribeStacksCommand({
1010
- StackName: stackArn,
1011
- }),
1012
- );
1013
-
1014
- expect(response.Stacks?.[0].StackStatus).toEqual('CREATE_COMPLETE');
1015
- await fixture.cdkDestroy(fixture.stackNamePrefix);
1016
- }),
1017
- );
1018
- });
1019
-
1020
- integTest(
1021
- 'cdk migrate generates migrate.json',
1022
- withCDKMigrateFixture('typescript', async (fixture) => {
1023
- const migrateFile = await fs.readFile(path.join(fixture.integTestDir, 'migrate.json'), 'utf8');
1024
- const expectedFile = `{
1025
- \"//\": \"This file is generated by cdk migrate. It will be automatically deleted after the first successful deployment of this app to the environment of the original resources.\",
1026
- \"Source\": \"localfile\"
1027
- }`;
1028
- expect(JSON.parse(migrateFile)).toEqual(JSON.parse(expectedFile));
1029
- await fixture.cdkDestroy(fixture.stackNamePrefix);
1030
- }),
1031
- );
1032
-
1033
- // integTest('cdk migrate --from-scan with AND/OR filters correctly filters resources', withExtendedTimeoutFixture(async (fixture) => {
1034
- // const stackName = `cdk-migrate-integ-${fixture.randomString}`;
1035
-
1036
- // await fixture.cdkDeploy('migrate-stack', {
1037
- // modEnv: { SAMPLE_RESOURCES: '1' },
1038
- // });
1039
- // await fixture.cdk(
1040
- // ['migrate', '--stack-name', stackName, '--from-scan', 'new', '--filter', 'type=AWS::SNS::Topic,tag-key=tag1', 'type=AWS::SQS::Queue,tag-key=tag3'],
1041
- // { modEnv: { MIGRATE_INTEG_TEST: '1' }, neverRequireApproval: true, verbose: true, captureStderr: false },
1042
- // );
1043
-
1044
- // try {
1045
- // const response = await fixture.aws.cloudFormation('describeGeneratedTemplate', {
1046
- // GeneratedTemplateName: stackName,
1047
- // });
1048
- // const resourceNames = [];
1049
- // for (const resource of response.Resources || []) {
1050
- // if (resource.LogicalResourceId) {
1051
- // resourceNames.push(resource.LogicalResourceId);
1052
- // }
1053
- // }
1054
- // fixture.log(`Resources: ${resourceNames}`);
1055
- // expect(resourceNames.some(ele => ele && ele.includes('migratetopic1'))).toBeTruthy();
1056
- // expect(resourceNames.some(ele => ele && ele.includes('migratequeue1'))).toBeTruthy();
1057
- // } finally {
1058
- // await fixture.cdkDestroy('migrate-stack');
1059
- // await fixture.aws.cloudFormation('deleteGeneratedTemplate', {
1060
- // GeneratedTemplateName: stackName,
1061
- // });
1062
- // }
1063
- // }));
1064
-
1065
- // integTest('cdk migrate --from-scan for resources with Write Only Properties generates warnings', withExtendedTimeoutFixture(async (fixture) => {
1066
- // const stackName = `cdk-migrate-integ-${fixture.randomString}`;
1067
-
1068
- // await fixture.cdkDeploy('migrate-stack', {
1069
- // modEnv: {
1070
- // LAMBDA_RESOURCES: '1',
1071
- // },
1072
- // });
1073
- // await fixture.cdk(
1074
- // ['migrate', '--stack-name', stackName, '--from-scan', 'new', '--filter', 'type=AWS::Lambda::Function,tag-key=lambda-tag'],
1075
- // { modEnv: { MIGRATE_INTEG_TEST: '1' }, neverRequireApproval: true, verbose: true, captureStderr: false },
1076
- // );
1077
-
1078
- // try {
1079
-
1080
- // const response = await fixture.aws.cloudFormation('describeGeneratedTemplate', {
1081
- // GeneratedTemplateName: stackName,
1082
- // });
1083
- // const resourceNames = [];
1084
- // for (const resource of response.Resources || []) {
1085
- // if (resource.LogicalResourceId && resource.ResourceType === 'AWS::Lambda::Function') {
1086
- // resourceNames.push(resource.LogicalResourceId);
1087
- // }
1088
- // }
1089
- // fixture.log(`Resources: ${resourceNames}`);
1090
- // const readmePath = path.join(fixture.integTestDir, stackName, 'README.md');
1091
- // const readme = await fs.readFile(readmePath, 'utf8');
1092
- // expect(readme).toContain('## Warnings');
1093
- // for (const resourceName of resourceNames) {
1094
- // expect(readme).toContain(`### ${resourceName}`);
1095
- // }
1096
- // } finally {
1097
- // await fixture.cdkDestroy('migrate-stack');
1098
- // await fixture.aws.cloudFormation('deleteGeneratedTemplate', {
1099
- // GeneratedTemplateName: stackName,
1100
- // });
1101
- // }
1102
- // }));
1103
-
1104
- ['typescript', 'python', 'csharp', 'java'].forEach((language) => {
1105
- integTest(
1106
- `cdk migrate --from-stack creates deployable ${language} app`,
1107
- withExtendedTimeoutFixture(async (fixture) => {
1108
- const migrateStackName = fixture.fullStackName('migrate-stack');
1109
- await fixture.aws.cloudFormation.send(
1110
- new CreateStackCommand({
1111
- StackName: migrateStackName,
1112
- TemplateBody: await fs.readFile(
1113
- path.join(__dirname, '..', '..', 'resources', 'templates', 'sqs-template.json'),
1114
- 'utf8',
1115
- ),
1116
- }),
1117
- );
1118
- try {
1119
- let stackStatus = 'CREATE_IN_PROGRESS';
1120
- while (stackStatus === 'CREATE_IN_PROGRESS') {
1121
- stackStatus = await (
1122
- await fixture.aws.cloudFormation.send(new DescribeStacksCommand({ StackName: migrateStackName }))
1123
- ).Stacks?.[0].StackStatus!;
1124
- await sleep(1000);
1125
- }
1126
- await fixture.cdk(['migrate', '--stack-name', migrateStackName, '--from-stack'], {
1127
- modEnv: { MIGRATE_INTEG_TEST: '1' },
1128
- neverRequireApproval: true,
1129
- verbose: true,
1130
- captureStderr: false,
1131
- });
1132
- await fixture.shell(['cd', path.join(fixture.integTestDir, migrateStackName)]);
1133
- await fixture.cdk(['deploy', migrateStackName], {
1134
- neverRequireApproval: true,
1135
- verbose: true,
1136
- captureStderr: false,
1137
- });
1138
- const response = await fixture.aws.cloudFormation.send(
1139
- new DescribeStacksCommand({
1140
- StackName: migrateStackName,
1141
- }),
1142
- );
1143
-
1144
- expect(response.Stacks?.[0].StackStatus).toEqual('UPDATE_COMPLETE');
1145
- } finally {
1146
- await fixture.cdkDestroy('migrate-stack');
1147
- }
1148
- }),
1149
- );
1150
- });
1151
-
1152
- integTest(
1153
- 'cdk diff',
1154
- withDefaultFixture(async (fixture) => {
1155
- const diff1 = await fixture.cdk(['diff', fixture.fullStackName('test-1')]);
1156
- expect(diff1).toContain('AWS::SNS::Topic');
1157
-
1158
- const diff2 = await fixture.cdk(['diff', fixture.fullStackName('test-2')]);
1159
- expect(diff2).toContain('AWS::SNS::Topic');
1160
-
1161
- // We can make it fail by passing --fail
1162
- await expect(fixture.cdk(['diff', '--fail', fixture.fullStackName('test-1')])).rejects.toThrow('exited with error');
1163
- }),
1164
- );
1165
-
1166
- integTest(
1167
- 'enableDiffNoFail',
1168
- withDefaultFixture(async (fixture) => {
1169
- await diffShouldSucceedWith({ fail: false, enableDiffNoFail: false });
1170
- await diffShouldSucceedWith({ fail: false, enableDiffNoFail: true });
1171
- await diffShouldFailWith({ fail: true, enableDiffNoFail: false });
1172
- await diffShouldFailWith({ fail: true, enableDiffNoFail: true });
1173
- await diffShouldFailWith({ fail: undefined, enableDiffNoFail: false });
1174
- await diffShouldSucceedWith({ fail: undefined, enableDiffNoFail: true });
1175
-
1176
- async function diffShouldSucceedWith(props: DiffParameters) {
1177
- await expect(diff(props)).resolves.not.toThrow();
1178
- }
1179
-
1180
- async function diffShouldFailWith(props: DiffParameters) {
1181
- await expect(diff(props)).rejects.toThrow('exited with error');
1182
- }
1183
-
1184
- async function diff(props: DiffParameters): Promise<string> {
1185
- await updateContext(props.enableDiffNoFail);
1186
- const flag = props.fail != null ? (props.fail ? '--fail' : '--no-fail') : '';
1187
-
1188
- return fixture.cdk(['diff', flag, fixture.fullStackName('test-1')]);
1189
- }
1190
-
1191
- async function updateContext(enableDiffNoFail: boolean) {
1192
- const cdkJson = JSON.parse(await fs.readFile(path.join(fixture.integTestDir, 'cdk.json'), 'utf8'));
1193
- cdkJson.context = {
1194
- ...cdkJson.context,
1195
- 'aws-cdk:enableDiffNoFail': enableDiffNoFail,
1196
- };
1197
- await fs.writeFile(path.join(fixture.integTestDir, 'cdk.json'), JSON.stringify(cdkJson));
1198
- }
1199
-
1200
- type DiffParameters = { fail?: boolean; enableDiffNoFail: boolean };
1201
- }),
1202
- );
1203
-
1204
- integTest(
1205
- 'cdk diff --fail on multiple stacks exits with error if any of the stacks contains a diff',
1206
- withDefaultFixture(async (fixture) => {
1207
- // GIVEN
1208
- const diff1 = await fixture.cdk(['diff', fixture.fullStackName('test-1')]);
1209
- expect(diff1).toContain('AWS::SNS::Topic');
1210
-
1211
- await fixture.cdkDeploy('test-2');
1212
- const diff2 = await fixture.cdk(['diff', fixture.fullStackName('test-2')]);
1213
- expect(diff2).toContain('There were no differences');
1214
-
1215
- // WHEN / THEN
1216
- await expect(
1217
- fixture.cdk(['diff', '--fail', fixture.fullStackName('test-1'), fixture.fullStackName('test-2')]),
1218
- ).rejects.toThrow('exited with error');
1219
- }),
1220
- );
1221
-
1222
- integTest(
1223
- 'cdk diff --fail with multiple stack exits with if any of the stacks contains a diff',
1224
- withDefaultFixture(async (fixture) => {
1225
- // GIVEN
1226
- await fixture.cdkDeploy('test-1');
1227
- const diff1 = await fixture.cdk(['diff', fixture.fullStackName('test-1')]);
1228
- expect(diff1).toContain('There were no differences');
1229
-
1230
- const diff2 = await fixture.cdk(['diff', fixture.fullStackName('test-2')]);
1231
- expect(diff2).toContain('AWS::SNS::Topic');
1232
-
1233
- // WHEN / THEN
1234
- await expect(
1235
- fixture.cdk(['diff', '--fail', fixture.fullStackName('test-1'), fixture.fullStackName('test-2')]),
1236
- ).rejects.toThrow('exited with error');
1237
- }),
1238
- );
1239
-
1240
- integTest(
1241
- 'cdk diff with large changeset does not fail',
1242
- withDefaultFixture(async (fixture) => {
1243
- // GIVEN - small initial stack with only one IAM role
1244
- await fixture.cdkDeploy('iam-roles', {
1245
- modEnv: {
1246
- NUMBER_OF_ROLES: '1',
1247
- },
1248
- });
1249
-
1250
- // WHEN - adding an additional role with a ton of metadata to create a large diff
1251
- const diff = await fixture.cdk(['diff', fixture.fullStackName('iam-roles')], {
1252
- verbose: true,
1253
- modEnv: {
1254
- NUMBER_OF_ROLES: '2',
1255
- },
1256
- });
1257
-
1258
- // Assert that the CLI assumes the file publishing role:
1259
- expect(diff).toMatch(/Assuming role .*file-publishing-role/);
1260
- expect(diff).toContain('success: Published');
1261
- }),
1262
- );
1263
-
1264
- integTest(
1265
- 'cdk diff doesnt show resource metadata changes',
1266
- withDefaultFixture(async (fixture) => {
1267
- // GIVEN - small initial stack with default resource metadata
1268
- await fixture.cdkDeploy('metadata');
1269
-
1270
- // WHEN - changing resource metadata value
1271
- const diff = await fixture.cdk(['diff', fixture.fullStackName('metadata')], {
1272
- verbose: true,
1273
- modEnv: {
1274
- INTEG_METADATA_VALUE: 'custom',
1275
- },
1276
- });
1277
-
1278
- // Assert there are no changes
1279
- expect(diff).toContain('There were no differences');
1280
- }),
1281
- );
1282
-
1283
- integTest(
1284
- 'cdk diff shows resource metadata changes with --no-change-set',
1285
- withDefaultFixture(async (fixture) => {
1286
- // GIVEN - small initial stack with default resource metadata
1287
- await fixture.cdkDeploy('metadata');
1288
-
1289
- // WHEN - changing resource metadata value
1290
- const diff = await fixture.cdk(['diff --no-change-set', fixture.fullStackName('metadata')], {
1291
- verbose: true,
1292
- modEnv: {
1293
- INTEG_METADATA_VALUE: 'custom',
1294
- },
1295
- });
1296
-
1297
- // Assert there are changes
1298
- expect(diff).not.toContain('There were no differences');
1299
- }),
1300
- );
1301
-
1302
- integTest('cdk diff with large changeset and custom toolkit stack name and qualifier does not fail', withoutBootstrap(async (fixture) => {
1303
- // Bootstrapping with custom toolkit stack name and qualifier
1304
- const qualifier = 'abc1111';
1305
- const toolkitStackName = 'custom-stack2';
1306
- await fixture.cdkBootstrapModern({
1307
- verbose: true,
1308
- toolkitStackName: toolkitStackName,
1309
- qualifier: qualifier,
1310
- });
1311
-
1312
- // Deploying small initial stack with only one IAM role
1313
- await fixture.cdkDeploy('iam-roles', {
1314
- modEnv: {
1315
- NUMBER_OF_ROLES: '1',
1316
- },
1317
- options: [
1318
- '--toolkit-stack-name', toolkitStackName,
1319
- '--context', `@aws-cdk/core:bootstrapQualifier=${qualifier}`,
1320
- ],
1321
- });
1322
-
1323
- // WHEN - adding a role with a ton of metadata to create a large diff
1324
- const diff = await fixture.cdk(['diff', '--toolkit-stack-name', toolkitStackName, '--context', `@aws-cdk/core:bootstrapQualifier=${qualifier}`, fixture.fullStackName('iam-roles')], {
1325
- verbose: true,
1326
- modEnv: {
1327
- NUMBER_OF_ROLES: '2',
1328
- },
1329
- });
1330
-
1331
- // Assert that the CLI assumes the file publishing role:
1332
- expect(diff).toMatch(/Assuming role .*file-publishing-role/);
1333
- expect(diff).toContain('success: Published');
1334
- }));
1335
-
1336
- integTest(
1337
- 'cdk diff --security-only successfully outputs sso-permission-set-without-managed-policy information',
1338
- withDefaultFixture(async (fixture) => {
1339
- const diff = await fixture.cdk([
1340
- 'diff',
1341
- '--security-only',
1342
- fixture.fullStackName('sso-perm-set-without-managed-policy'),
1343
- ]);
1344
- `┌───┬──────────────────────────────────────────┬──────────────────────────────────┬────────────────────┬───────────────────────────────────┬─────────────────────────────────┐
1345
- │ │ Resource │ InstanceArn │ PermissionSet name │ PermissionsBoundary │ CustomerManagedPolicyReferences │
1346
- ├───┼──────────────────────────────────────────┼──────────────────────────────────┼────────────────────┼───────────────────────────────────┼─────────────────────────────────┤
1347
- │ + │\${permission-set-without-managed-policy} │ arn:aws:sso:::instance/testvalue │ testName │ CustomerManagedPolicyReference: { │ │
1348
- │ │ │ │ │ Name: why, Path: /how/ │ │
1349
- │ │ │ │ │ } │ │
1350
- `;
1351
- expect(diff).toContain('Resource');
1352
- expect(diff).toContain('permission-set-without-managed-policy');
1353
-
1354
- expect(diff).toContain('InstanceArn');
1355
- expect(diff).toContain('arn:aws:sso:::instance/testvalue');
1356
-
1357
- expect(diff).toContain('PermissionSet name');
1358
- expect(diff).toContain('testName');
1359
-
1360
- expect(diff).toContain('PermissionsBoundary');
1361
- expect(diff).toContain('CustomerManagedPolicyReference: {');
1362
- expect(diff).toContain('Name: why, Path: /how/');
1363
- expect(diff).toContain('}');
1364
-
1365
- expect(diff).toContain('CustomerManagedPolicyReferences');
1366
- }),
1367
- );
1368
-
1369
- integTest(
1370
- 'cdk diff --security-only successfully outputs sso-permission-set-with-managed-policy information',
1371
- withDefaultFixture(async (fixture) => {
1372
- const diff = await fixture.cdk([
1373
- 'diff',
1374
- '--security-only',
1375
- fixture.fullStackName('sso-perm-set-with-managed-policy'),
1376
- ]);
1377
- `┌───┬──────────────────────────────────────────┬──────────────────────────────────┬────────────────────┬───────────────────────────────────────────────────────────────┬─────────────────────────────────┐
1378
- │ │ Resource │ InstanceArn │ PermissionSet name │ PermissionsBoundary │ CustomerManagedPolicyReferences │
1379
- ├───┼──────────────────────────────────────────┼──────────────────────────────────┼────────────────────┼───────────────────────────────────────────────────────────────┼─────────────────────────────────┤
1380
- │ + │\${permission-set-with-managed-policy} │ arn:aws:sso:::instance/testvalue │ niceWork │ ManagedPolicyArn: arn:aws:iam::aws:policy/AdministratorAccess │ Name: forSSO, Path: │
1381
- `;
1382
-
1383
- expect(diff).toContain('Resource');
1384
- expect(diff).toContain('permission-set-with-managed-policy');
1385
-
1386
- expect(diff).toContain('InstanceArn');
1387
- expect(diff).toContain('arn:aws:sso:::instance/testvalue');
1388
-
1389
- expect(diff).toContain('PermissionSet name');
1390
- expect(diff).toContain('niceWork');
1391
-
1392
- expect(diff).toContain('PermissionsBoundary');
1393
- expect(diff).toContain('ManagedPolicyArn: arn:aws:iam::aws:policy/AdministratorAccess');
1394
-
1395
- expect(diff).toContain('CustomerManagedPolicyReferences');
1396
- expect(diff).toContain('Name: forSSO, Path:');
1397
- }),
1398
- );
1399
-
1400
- integTest(
1401
- 'cdk diff --security-only successfully outputs sso-assignment information',
1402
- withDefaultFixture(async (fixture) => {
1403
- const diff = await fixture.cdk(['diff', '--security-only', fixture.fullStackName('sso-assignment')]);
1404
- `┌───┬───────────────┬──────────────────────────────────┬─────────────────────────┬──────────────────────────────┬───────────────┬──────────────┬─────────────┐
1405
- │ │ Resource │ InstanceArn │ PermissionSetArn │ PrincipalId │ PrincipalType │ TargetId │ TargetType │
1406
- ├───┼───────────────┼──────────────────────────────────┼─────────────────────────┼──────────────────────────────┼───────────────┼──────────────┼─────────────┤
1407
- │ + │\${assignment} │ arn:aws:sso:::instance/testvalue │ arn:aws:sso:::testvalue │ 11111111-2222-3333-4444-test │ USER │ 111111111111 │ AWS_ACCOUNT │
1408
- └───┴───────────────┴──────────────────────────────────┴─────────────────────────┴──────────────────────────────┴───────────────┴──────────────┴─────────────┘
1409
- `;
1410
- expect(diff).toContain('Resource');
1411
- expect(diff).toContain('assignment');
1412
-
1413
- expect(diff).toContain('InstanceArn');
1414
- expect(diff).toContain('arn:aws:sso:::instance/testvalue');
1415
-
1416
- expect(diff).toContain('PermissionSetArn');
1417
- expect(diff).toContain('arn:aws:sso:::testvalue');
1418
-
1419
- expect(diff).toContain('PrincipalId');
1420
- expect(diff).toContain('11111111-2222-3333-4444-test');
1421
-
1422
- expect(diff).toContain('PrincipalType');
1423
- expect(diff).toContain('USER');
1424
-
1425
- expect(diff).toContain('TargetId');
1426
- expect(diff).toContain('111111111111');
1427
-
1428
- expect(diff).toContain('TargetType');
1429
- expect(diff).toContain('AWS_ACCOUNT');
1430
- }),
1431
- );
1432
-
1433
- integTest(
1434
- 'cdk diff --security-only successfully outputs sso-access-control information',
1435
- withDefaultFixture(async (fixture) => {
1436
- const diff = await fixture.cdk(['diff', '--security-only', fixture.fullStackName('sso-access-control')]);
1437
- `┌───┬────────────────────────────────┬────────────────────────┬─────────────────────────────────┐
1438
- │ │ Resource │ InstanceArn │ AccessControlAttributes │
1439
- ├───┼────────────────────────────────┼────────────────────────┼─────────────────────────────────┤
1440
- │ + │\${instanceAccessControlConfig} │ arn:aws:test:testvalue │ Key: first, Values: [a] │
1441
- │ │ │ │ Key: second, Values: [b] │
1442
- │ │ │ │ Key: third, Values: [c] │
1443
- │ │ │ │ Key: fourth, Values: [d] │
1444
- │ │ │ │ Key: fifth, Values: [e] │
1445
- │ │ │ │ Key: sixth, Values: [f] │
1446
- └───┴────────────────────────────────┴────────────────────────┴─────────────────────────────────┘
1447
- `;
1448
- expect(diff).toContain('Resource');
1449
- expect(diff).toContain('instanceAccessControlConfig');
1450
-
1451
- expect(diff).toContain('InstanceArn');
1452
- expect(diff).toContain('arn:aws:sso:::instance/testvalue');
1453
-
1454
- expect(diff).toContain('AccessControlAttributes');
1455
- expect(diff).toContain('Key: first, Values: [a]');
1456
- expect(diff).toContain('Key: second, Values: [b]');
1457
- expect(diff).toContain('Key: third, Values: [c]');
1458
- expect(diff).toContain('Key: fourth, Values: [d]');
1459
- expect(diff).toContain('Key: fifth, Values: [e]');
1460
- expect(diff).toContain('Key: sixth, Values: [f]');
1461
- }),
1462
- );
1463
-
1464
- integTest(
1465
- 'cdk diff --security-only --fail exits when security diff for sso access control config',
1466
- withDefaultFixture(async (fixture) => {
1467
- await expect(
1468
- fixture.cdk(['diff', '--security-only', '--fail', fixture.fullStackName('sso-access-control')]),
1469
- ).rejects.toThrow('exited with error');
1470
- }),
1471
- );
1472
-
1473
- integTest(
1474
- 'cdk diff --security-only --fail exits when security diff for sso-perm-set-without-managed-policy',
1475
- withDefaultFixture(async (fixture) => {
1476
- await expect(
1477
- fixture.cdk(['diff', '--security-only', '--fail', fixture.fullStackName('sso-perm-set-without-managed-policy')]),
1478
- ).rejects.toThrow('exited with error');
1479
- }),
1480
- );
1481
-
1482
- integTest(
1483
- 'cdk diff --security-only --fail exits when security diff for sso-perm-set-with-managed-policy',
1484
- withDefaultFixture(async (fixture) => {
1485
- await expect(
1486
- fixture.cdk(['diff', '--security-only', '--fail', fixture.fullStackName('sso-perm-set-with-managed-policy')]),
1487
- ).rejects.toThrow('exited with error');
1488
- }),
1489
- );
1490
-
1491
- integTest(
1492
- 'cdk diff --security-only --fail exits when security diff for sso-assignment',
1493
- withDefaultFixture(async (fixture) => {
1494
- await expect(
1495
- fixture.cdk(['diff', '--security-only', '--fail', fixture.fullStackName('sso-assignment')]),
1496
- ).rejects.toThrow('exited with error');
1497
- }),
1498
- );
1499
-
1500
- integTest(
1501
- 'cdk diff --security-only --fail exits when security changes are present',
1502
- withDefaultFixture(async (fixture) => {
1503
- const stackName = 'iam-test';
1504
- await expect(fixture.cdk(['diff', '--security-only', '--fail', fixture.fullStackName(stackName)])).rejects.toThrow(
1505
- 'exited with error',
1506
- );
1507
- }),
1508
- );
1509
-
1510
- integTest(
1511
- "cdk diff --quiet does not print 'There were no differences' message for stacks which have no differences",
1512
- withDefaultFixture(async (fixture) => {
1513
- // GIVEN
1514
- await fixture.cdkDeploy('test-1');
1515
-
1516
- // WHEN
1517
- const diff = await fixture.cdk(['diff', '--quiet', fixture.fullStackName('test-1')]);
1518
-
1519
- // THEN
1520
- expect(diff).not.toContain('Stack test-1');
1521
- expect(diff).not.toContain('There were no differences');
1522
- }),
1523
- );
1524
-
1525
- integTest(
1526
- 'deploy stack with docker asset',
1527
- withDefaultFixture(async (fixture) => {
1528
- await fixture.cdkDeploy('docker');
1529
- }),
1530
- );
1531
-
1532
- integTest(
1533
- 'deploy and test stack with lambda asset',
1534
- withDefaultFixture(async (fixture) => {
1535
- const stackArn = await fixture.cdkDeploy('lambda', { captureStderr: false });
1536
-
1537
- const response = await fixture.aws.cloudFormation.send(
1538
- new DescribeStacksCommand({
1539
- StackName: stackArn,
1540
- }),
1541
- );
1542
- const lambdaArn = response.Stacks?.[0].Outputs?.[0].OutputValue;
1543
- if (lambdaArn === undefined) {
1544
- throw new Error('Stack did not have expected Lambda ARN output');
1545
- }
1546
-
1547
- const output = await fixture.aws.lambda.send(
1548
- new InvokeCommand({
1549
- FunctionName: lambdaArn,
1550
- }),
1551
- );
1552
-
1553
- expect(JSON.stringify(output.Payload?.transformToString())).toContain('dear asset');
1554
- }),
1555
- );
1556
-
1557
- integTest('deploy stack with Lambda Asset to Object Lock-enabled asset bucket', withoutBootstrap(async (fixture) => {
1558
- // Bootstrapping with custom toolkit stack name and qualifier
1559
- const qualifier = fixture.qualifier;
1560
- const toolkitStackName = fixture.bootstrapStackName;
1561
- await fixture.cdkBootstrapModern({
1562
- verbose: true,
1563
- toolkitStackName: toolkitStackName,
1564
- qualifier: qualifier,
1565
- });
1566
-
1567
- const bucketName = `cdk-${qualifier}-assets-${await fixture.aws.account()}-${fixture.aws.region}`;
1568
- await fixture.aws.s3.send(new PutObjectLockConfigurationCommand({
1569
- Bucket: bucketName,
1570
- ObjectLockConfiguration: {
1571
- ObjectLockEnabled: 'Enabled',
1572
- Rule: {
1573
- DefaultRetention: {
1574
- Days: 1,
1575
- Mode: 'GOVERNANCE',
1576
- },
1577
- },
1578
- },
1579
- }));
1580
-
1581
- // Deploy a stack that definitely contains a file asset
1582
- await fixture.cdkDeploy('lambda', {
1583
- options: [
1584
- '--toolkit-stack-name', toolkitStackName,
1585
- '--context', `@aws-cdk/core:bootstrapQualifier=${qualifier}`,
1586
- ],
1587
- });
1588
-
1589
- // THEN - should not fail. Now clean the bucket with governance bypass: a regular delete
1590
- // operation will fail.
1591
- await fixture.aws.emptyBucket(bucketName, { bypassGovernance: true });
1592
- }));
1593
-
1594
- integTest(
1595
- 'cdk ls',
1596
- withDefaultFixture(async (fixture) => {
1597
- const listing = await fixture.cdk(['ls'], { captureStderr: false });
1598
-
1599
- const expectedStacks = [
1600
- 'conditional-resource',
1601
- 'docker',
1602
- 'docker-with-custom-file',
1603
- 'failed',
1604
- 'iam-test',
1605
- 'lambda',
1606
- 'missing-ssm-parameter',
1607
- 'order-providing',
1608
- 'outputs-test-1',
1609
- 'outputs-test-2',
1610
- 'param-test-1',
1611
- 'param-test-2',
1612
- 'param-test-3',
1613
- 'termination-protection',
1614
- 'test-1',
1615
- 'test-2',
1616
- 'with-nested-stack',
1617
- 'with-nested-stack-using-parameters',
1618
- 'order-consuming',
1619
- ];
1620
-
1621
- for (const stack of expectedStacks) {
1622
- expect(listing).toContain(fixture.fullStackName(stack));
1623
- }
1624
- }),
1625
- );
1626
-
1627
- /**
1628
- * Type to store stack dependencies recursively
1629
- */
1630
- type DependencyDetails = {
1631
- id: string;
1632
- dependencies: DependencyDetails[];
1633
- };
1634
-
1635
- type StackDetails = {
1636
- id: string;
1637
- dependencies: DependencyDetails[];
1638
- };
1639
-
1640
- integTest(
1641
- 'cdk ls --show-dependencies --json',
1642
- withDefaultFixture(async (fixture) => {
1643
- const listing = await fixture.cdk(['ls --show-dependencies --json'], { captureStderr: false });
1644
-
1645
- const expectedStacks = [
1646
- {
1647
- id: 'test-1',
1648
- dependencies: [],
1649
- },
1650
- {
1651
- id: 'order-providing',
1652
- dependencies: [],
1653
- },
1654
- {
1655
- id: 'order-consuming',
1656
- dependencies: [
1657
- {
1658
- id: 'order-providing',
1659
- dependencies: [],
1660
- },
1661
- ],
1662
- },
1663
- {
1664
- id: 'with-nested-stack',
1665
- dependencies: [],
1666
- },
1667
- {
1668
- id: 'list-stacks',
1669
- dependencies: [
1670
- {
1671
- id: 'list-stacks/DependentStack',
1672
- dependencies: [
1673
- {
1674
- id: 'list-stacks/DependentStack/InnerDependentStack',
1675
- dependencies: [],
1676
- },
1677
- ],
1678
- },
1679
- ],
1680
- },
1681
- {
1682
- id: 'list-multiple-dependent-stacks',
1683
- dependencies: [
1684
- {
1685
- id: 'list-multiple-dependent-stacks/DependentStack1',
1686
- dependencies: [],
1687
- },
1688
- {
1689
- id: 'list-multiple-dependent-stacks/DependentStack2',
1690
- dependencies: [],
1691
- },
1692
- ],
1693
- },
1694
- ];
1695
-
1696
- function validateStackDependencies(stack: StackDetails) {
1697
- expect(listing).toContain(stack.id);
1698
-
1699
- function validateDependencies(dependencies: DependencyDetails[]) {
1700
- for (const dependency of dependencies) {
1701
- expect(listing).toContain(dependency.id);
1702
- if (dependency.dependencies.length > 0) {
1703
- validateDependencies(dependency.dependencies);
1704
- }
1705
- }
1706
- }
1707
-
1708
- if (stack.dependencies.length > 0) {
1709
- validateDependencies(stack.dependencies);
1710
- }
1711
- }
1712
-
1713
- for (const stack of expectedStacks) {
1714
- validateStackDependencies(stack);
1715
- }
1716
- }),
1717
- );
1718
-
1719
- integTest(
1720
- 'cdk ls --show-dependencies --json --long',
1721
- withDefaultFixture(async (fixture) => {
1722
- const listing = await fixture.cdk(['ls --show-dependencies --json --long'], { captureStderr: false });
1723
-
1724
- const expectedStacks = [
1725
- {
1726
- id: 'order-providing',
1727
- name: 'order-providing',
1728
- enviroment: {
1729
- account: 'unknown-account',
1730
- region: 'unknown-region',
1731
- name: 'aws://unknown-account/unknown-region',
1732
- },
1733
- dependencies: [],
1734
- },
1735
- {
1736
- id: 'order-consuming',
1737
- name: 'order-consuming',
1738
- enviroment: {
1739
- account: 'unknown-account',
1740
- region: 'unknown-region',
1741
- name: 'aws://unknown-account/unknown-region',
1742
- },
1743
- dependencies: [
1744
- {
1745
- id: 'order-providing',
1746
- dependencies: [],
1747
- },
1748
- ],
1749
- },
1750
- ];
1751
-
1752
- for (const stack of expectedStacks) {
1753
- expect(listing).toContain(fixture.fullStackName(stack.id));
1754
- expect(listing).toContain(fixture.fullStackName(stack.name));
1755
- expect(listing).toContain(stack.enviroment.account);
1756
- expect(listing).toContain(stack.enviroment.name);
1757
- expect(listing).toContain(stack.enviroment.region);
1758
- for (const dependency of stack.dependencies) {
1759
- expect(listing).toContain(fixture.fullStackName(dependency.id));
1760
- }
1761
- }
1762
- }),
1763
- );
1764
-
1765
- integTest(
1766
- 'synthing a stage with errors leads to failure',
1767
- withDefaultFixture(async (fixture) => {
1768
- const output = await fixture.cdk(['synth'], {
1769
- allowErrExit: true,
1770
- modEnv: {
1771
- INTEG_STACK_SET: 'stage-with-errors',
1772
- },
1773
- });
1774
-
1775
- expect(output).toContain('This is an error');
1776
- }),
1777
- );
1778
-
1779
- integTest(
1780
- 'synthing a stage with errors can be suppressed',
1781
- withDefaultFixture(async (fixture) => {
1782
- await fixture.cdk(['synth', '--no-validation'], {
1783
- modEnv: {
1784
- INTEG_STACK_SET: 'stage-with-errors',
1785
- },
1786
- });
1787
- }),
1788
- );
1789
-
1790
- integTest(
1791
- 'synth --quiet can be specified in cdk.json',
1792
- withDefaultFixture(async (fixture) => {
1793
- let cdkJson = JSON.parse(await fs.readFile(path.join(fixture.integTestDir, 'cdk.json'), 'utf8'));
1794
- cdkJson = {
1795
- ...cdkJson,
1796
- quiet: true,
1797
- };
1798
- await fs.writeFile(path.join(fixture.integTestDir, 'cdk.json'), JSON.stringify(cdkJson));
1799
- const synthOutput = await fixture.cdk(['synth', fixture.fullStackName('test-2')]);
1800
- expect(synthOutput).not.toContain('topic152D84A37');
1801
- }),
1802
- );
1803
-
1804
- integTest(
1805
- 'deploy stack without resource',
1806
- withDefaultFixture(async (fixture) => {
1807
- // Deploy the stack without resources
1808
- await fixture.cdkDeploy('conditional-resource', { modEnv: { NO_RESOURCE: 'TRUE' } });
1809
-
1810
- // This should have succeeded but not deployed the stack.
1811
- await expect(
1812
- fixture.aws.cloudFormation.send(
1813
- new DescribeStacksCommand({ StackName: fixture.fullStackName('conditional-resource') }),
1814
- ),
1815
- ).rejects.toThrow('conditional-resource does not exist');
1816
-
1817
- // Deploy the stack with resources
1818
- await fixture.cdkDeploy('conditional-resource');
1819
-
1820
- // Then again WITHOUT resources (this should destroy the stack)
1821
- await fixture.cdkDeploy('conditional-resource', { modEnv: { NO_RESOURCE: 'TRUE' } });
1822
-
1823
- await expect(
1824
- fixture.aws.cloudFormation.send(
1825
- new DescribeStacksCommand({ StackName: fixture.fullStackName('conditional-resource') }),
1826
- ),
1827
- ).rejects.toThrow('conditional-resource does not exist');
1828
- }),
1829
- );
1830
-
1831
- integTest(
1832
- 'deploy no stacks with --ignore-no-stacks',
1833
- withDefaultFixture(async (fixture) => {
1834
- // empty array for stack names
1835
- await fixture.cdkDeploy([], {
1836
- options: ['--ignore-no-stacks'],
1837
- modEnv: {
1838
- INTEG_STACK_SET: 'stage-with-no-stacks',
1839
- },
1840
- });
1841
- }),
1842
- );
1843
-
1844
- integTest(
1845
- 'deploy no stacks error',
1846
- withDefaultFixture(async (fixture) => {
1847
- // empty array for stack names
1848
- await expect(
1849
- fixture.cdkDeploy([], {
1850
- modEnv: {
1851
- INTEG_STACK_SET: 'stage-with-no-stacks',
1852
- },
1853
- }),
1854
- ).rejects.toThrow('exited with error');
1855
- }),
1856
- );
1857
-
1858
- integTest(
1859
- 'IAM diff',
1860
- withDefaultFixture(async (fixture) => {
1861
- const output = await fixture.cdk(['diff', fixture.fullStackName('iam-test')]);
1862
-
1863
- // Roughly check for a table like this:
1864
- //
1865
- // ┌───┬─────────────────┬────────┬────────────────┬────────────────────────────-──┬───────────┐
1866
- // │ │ Resource │ Effect │ Action │ Principal │ Condition │
1867
- // ├───┼─────────────────┼────────┼────────────────┼───────────────────────────────┼───────────┤
1868
- // │ + │ ${SomeRole.Arn} │ Allow │ sts:AssumeRole │ Service:ec2.amazonaws.com │ │
1869
- // └───┴─────────────────┴────────┴────────────────┴───────────────────────────────┴───────────┘
1870
-
1871
- expect(output).toContain('${SomeRole.Arn}');
1872
- expect(output).toContain('sts:AssumeRole');
1873
- expect(output).toContain('ec2.amazonaws.com');
1874
- }),
1875
- );
1876
-
1877
- integTest(
1878
- 'fast deploy',
1879
- withDefaultFixture(async (fixture) => {
1880
- // we are using a stack with a nested stack because CFN will always attempt to
1881
- // update a nested stack, which will allow us to verify that updates are actually
1882
- // skipped unless --force is specified.
1883
- const stackArn = await fixture.cdkDeploy('with-nested-stack', { captureStderr: false });
1884
- const changeSet1 = await getLatestChangeSet();
1885
-
1886
- // Deploy the same stack again, there should be no new change set created
1887
- await fixture.cdkDeploy('with-nested-stack');
1888
- const changeSet2 = await getLatestChangeSet();
1889
- expect(changeSet2.ChangeSetId).toEqual(changeSet1.ChangeSetId);
1890
-
1891
- // Deploy the stack again with --force, now we should create a changeset
1892
- await fixture.cdkDeploy('with-nested-stack', { options: ['--force'] });
1893
- const changeSet3 = await getLatestChangeSet();
1894
- expect(changeSet3.ChangeSetId).not.toEqual(changeSet2.ChangeSetId);
1895
-
1896
- // Deploy the stack again with tags, expected to create a new changeset
1897
- // even though the resources didn't change.
1898
- await fixture.cdkDeploy('with-nested-stack', { options: ['--tags', 'key=value'] });
1899
- const changeSet4 = await getLatestChangeSet();
1900
- expect(changeSet4.ChangeSetId).not.toEqual(changeSet3.ChangeSetId);
1901
-
1902
- async function getLatestChangeSet() {
1903
- const response = await fixture.aws.cloudFormation.send(new DescribeStacksCommand({ StackName: stackArn }));
1904
- if (!response.Stacks?.[0]) {
1905
- throw new Error('Did not get a ChangeSet at all');
1906
- }
1907
- fixture.log(`Found Change Set ${response.Stacks?.[0].ChangeSetId}`);
1908
- return response.Stacks?.[0];
1909
- }
1910
- }),
1911
- );
1912
-
1913
- integTest(
1914
- 'failed deploy does not hang',
1915
- withDefaultFixture(async (fixture) => {
1916
- // this will hang if we introduce https://github.com/aws/aws-cdk/issues/6403 again.
1917
- await expect(fixture.cdkDeploy('failed')).rejects.toThrow('exited with error');
1918
- }),
1919
- );
1920
-
1921
- integTest(
1922
- 'can still load old assemblies',
1923
- withDefaultFixture(async (fixture) => {
1924
- const cxAsmDir = path.join(os.tmpdir(), 'cdk-integ-cx');
1925
-
1926
- const testAssembliesDirectory = path.join(RESOURCES_DIR, 'cloud-assemblies');
1927
- for (const asmdir of await listChildDirs(testAssembliesDirectory)) {
1928
- fixture.log(`ASSEMBLY ${asmdir}`);
1929
- await cloneDirectory(asmdir, cxAsmDir);
1930
-
1931
- // Some files in the asm directory that have a .js extension are
1932
- // actually treated as templates. Evaluate them using NodeJS.
1933
- const templates = await listChildren(cxAsmDir, (fullPath) => Promise.resolve(fullPath.endsWith('.js')));
1934
- for (const template of templates) {
1935
- const targetName = template.replace(/.js$/, '');
1936
- await shell([process.execPath, template, '>', targetName], {
1937
- cwd: cxAsmDir,
1938
- outputs: [fixture.output],
1939
- modEnv: {
1940
- TEST_ACCOUNT: await fixture.aws.account(),
1941
- TEST_REGION: fixture.aws.region,
1942
- },
1943
- });
1944
- }
1945
-
1946
- // Use this directory as a Cloud Assembly
1947
- const output = await fixture.cdk(['--app', cxAsmDir, '-v', 'synth']);
1948
-
1949
- // Assert that there was no providerError in CDK's stderr
1950
- // Because we rely on the app/framework to actually error in case the
1951
- // provider fails, we inspect the logs here.
1952
- expect(output).not.toContain('$providerError');
1953
- }
1954
- }),
1955
- );
1956
-
1957
- integTest(
1958
- 'generating and loading assembly',
1959
- withDefaultFixture(async (fixture) => {
1960
- const asmOutputDir = `${fixture.integTestDir}-cdk-integ-asm`;
1961
- await fixture.shell(['rm', '-rf', asmOutputDir]);
1962
-
1963
- // Synthesize a Cloud Assembly tothe default directory (cdk.out) and a specific directory.
1964
- await fixture.cdk(['synth']);
1965
- await fixture.cdk(['synth', '--output', asmOutputDir]);
1966
-
1967
- // cdk.out in the current directory and the indicated --output should be the same
1968
- await fixture.shell(['diff', 'cdk.out', asmOutputDir]);
1969
-
1970
- // Check that we can 'ls' the synthesized asm.
1971
- // Change to some random directory to make sure we're not accidentally loading cdk.json
1972
- const list = await fixture.cdk(['--app', asmOutputDir, 'ls'], { cwd: os.tmpdir() });
1973
- // Same stacks we know are in the app
1974
- expect(list).toContain(`${fixture.stackNamePrefix}-lambda`);
1975
- expect(list).toContain(`${fixture.stackNamePrefix}-test-1`);
1976
- expect(list).toContain(`${fixture.stackNamePrefix}-test-2`);
1977
-
1978
- // Check that we can use '.' and just synth ,the generated asm
1979
- const stackTemplate = await fixture.cdk(['--app', '.', 'synth', fixture.fullStackName('test-2')], {
1980
- cwd: asmOutputDir,
1981
- });
1982
- expect(stackTemplate).toContain('topic152D84A37');
1983
-
1984
- // Deploy a Lambda from the copied asm
1985
- await fixture.cdkDeploy('lambda', { options: ['-a', '.'], cwd: asmOutputDir });
1986
-
1987
- // Remove (rename) the original custom docker file that was used during synth.
1988
- // this verifies that the assemly has a copy of it and that the manifest uses
1989
- // relative paths to reference to it.
1990
- const customDockerFile = path.join(fixture.integTestDir, 'docker', 'Dockerfile.Custom');
1991
- await fs.rename(customDockerFile, `${customDockerFile}~`);
1992
- try {
1993
- // deploy a docker image with custom file without synth (uses assets)
1994
- await fixture.cdkDeploy('docker-with-custom-file', { options: ['-a', '.'], cwd: asmOutputDir });
1995
- } finally {
1996
- // Rename back to restore fixture to original state
1997
- await fs.rename(`${customDockerFile}~`, customDockerFile);
1998
- }
1999
- }),
2000
- );
2001
-
2002
- integTest(
2003
- 'templates on disk contain metadata resource, also in nested assemblies',
2004
- withDefaultFixture(async (fixture) => {
2005
- // Synth first, and switch on version reporting because cdk.json is disabling it
2006
- await fixture.cdk(['synth', '--version-reporting=true']);
2007
-
2008
- // Load template from disk from root assembly
2009
- const templateContents = await fixture.shell(['cat', 'cdk.out/*-lambda.template.json']);
2010
-
2011
- expect(JSON.parse(templateContents).Resources.CDKMetadata).toBeTruthy();
2012
-
2013
- // Load template from nested assembly
2014
- const nestedTemplateContents = await fixture.shell([
2015
- 'cat',
2016
- 'cdk.out/assembly-*-stage/*StackInStage*.template.json',
2017
- ]);
2018
-
2019
- expect(JSON.parse(nestedTemplateContents).Resources.CDKMetadata).toBeTruthy();
2020
- }),
2021
- );
2022
-
2023
- integTest(
2024
- 'CDK synth add the metadata properties expected by sam',
2025
- withSamIntegrationFixture(async (fixture) => {
2026
- // Synth first
2027
- await fixture.cdkSynth();
2028
-
2029
- const template = fixture.template('TestStack');
2030
-
2031
- const expectedResources = [
2032
- {
2033
- // Python Layer Version
2034
- id: 'PythonLayerVersion39495CEF',
2035
- cdkId: 'PythonLayerVersion',
2036
- isBundled: true,
2037
- property: 'Content',
2038
- },
2039
- {
2040
- // Layer Version
2041
- id: 'LayerVersion3878DA3A',
2042
- cdkId: 'LayerVersion',
2043
- isBundled: false,
2044
- property: 'Content',
2045
- },
2046
- {
2047
- // Bundled layer version
2048
- id: 'BundledLayerVersionPythonRuntime6BADBD6E',
2049
- cdkId: 'BundledLayerVersionPythonRuntime',
2050
- isBundled: true,
2051
- property: 'Content',
2052
- },
2053
- {
2054
- // Python Function
2055
- id: 'PythonFunction0BCF77FD',
2056
- cdkId: 'PythonFunction',
2057
- isBundled: true,
2058
- property: 'Code',
2059
- },
2060
- {
2061
- // Log Retention Function
2062
- id: 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A',
2063
- cdkId: 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a',
2064
- isBundled: false,
2065
- property: 'Code',
2066
- },
2067
- {
2068
- // Function
2069
- id: 'FunctionPythonRuntime28CBDA05',
2070
- cdkId: 'FunctionPythonRuntime',
2071
- isBundled: false,
2072
- property: 'Code',
2073
- },
2074
- {
2075
- // Bundled Function
2076
- id: 'BundledFunctionPythonRuntime4D9A0918',
2077
- cdkId: 'BundledFunctionPythonRuntime',
2078
- isBundled: true,
2079
- property: 'Code',
2080
- },
2081
- {
2082
- // NodeJs Function
2083
- id: 'NodejsFunction09C1F20F',
2084
- cdkId: 'NodejsFunction',
2085
- isBundled: true,
2086
- property: 'Code',
2087
- },
2088
- {
2089
- // Go Function
2090
- id: 'GoFunctionCA95FBAA',
2091
- cdkId: 'GoFunction',
2092
- isBundled: true,
2093
- property: 'Code',
2094
- },
2095
- {
2096
- // Docker Image Function
2097
- id: 'DockerImageFunction28B773E6',
2098
- cdkId: 'DockerImageFunction',
2099
- dockerFilePath: 'Dockerfile',
2100
- property: 'Code.ImageUri',
2101
- },
2102
- {
2103
- // Spec Rest Api
2104
- id: 'SpecRestAPI7D4B3A34',
2105
- cdkId: 'SpecRestAPI',
2106
- property: 'BodyS3Location',
2107
- },
2108
- ];
2109
-
2110
- for (const resource of expectedResources) {
2111
- fixture.output.write(`validate assets metadata for resource ${resource}`);
2112
- expect(resource.id in template.Resources).toBeTruthy();
2113
- expect(template.Resources[resource.id]).toEqual(
2114
- expect.objectContaining({
2115
- Metadata: {
2116
- 'aws:cdk:path': `${fixture.fullStackName('TestStack')}/${resource.cdkId}/Resource`,
2117
- 'aws:asset:path': expect.stringMatching(/asset\.[0-9a-zA-Z]{64}/),
2118
- 'aws:asset:is-bundled': resource.isBundled,
2119
- 'aws:asset:dockerfile-path': resource.dockerFilePath,
2120
- 'aws:asset:property': resource.property,
2121
- },
2122
- }),
2123
- );
2124
- }
2125
-
2126
- // Nested Stack
2127
- fixture.output.write('validate assets metadata for nested stack resource');
2128
- expect('NestedStackNestedStackNestedStackNestedStackResourceB70834FD' in template.Resources).toBeTruthy();
2129
- expect(template.Resources.NestedStackNestedStackNestedStackNestedStackResourceB70834FD).toEqual(
2130
- expect.objectContaining({
2131
- Metadata: {
2132
- 'aws:cdk:path': `${fixture.fullStackName(
2133
- 'TestStack',
2134
- )}/NestedStack.NestedStack/NestedStack.NestedStackResource`,
2135
- 'aws:asset:path': expect.stringMatching(
2136
- `${fixture.stackNamePrefix.replace(/-/, '')}TestStackNestedStack[0-9A-Z]{8}\.nested\.template\.json`,
2137
- ),
2138
- 'aws:asset:property': 'TemplateURL',
2139
- },
2140
- }),
2141
- );
2142
- }),
2143
- );
2144
-
2145
- integTest(
2146
- 'CDK synth bundled functions as expected',
2147
- withSamIntegrationFixture(async (fixture) => {
2148
- // Synth first
2149
- await fixture.cdkSynth();
2150
-
2151
- const template = fixture.template('TestStack');
2152
-
2153
- const expectedBundledAssets = [
2154
- {
2155
- // Python Layer Version
2156
- id: 'PythonLayerVersion39495CEF',
2157
- files: [
2158
- 'python/layer_version_dependency.py',
2159
- 'python/geonamescache/__init__.py',
2160
- 'python/geonamescache-1.3.0.dist-info',
2161
- ],
2162
- },
2163
- {
2164
- // Layer Version
2165
- id: 'LayerVersion3878DA3A',
2166
- files: ['layer_version_dependency.py', 'requirements.txt'],
2167
- },
2168
- {
2169
- // Bundled layer version
2170
- id: 'BundledLayerVersionPythonRuntime6BADBD6E',
2171
- files: [
2172
- 'python/layer_version_dependency.py',
2173
- 'python/geonamescache/__init__.py',
2174
- 'python/geonamescache-1.3.0.dist-info',
2175
- ],
2176
- },
2177
- {
2178
- // Python Function
2179
- id: 'PythonFunction0BCF77FD',
2180
- files: ['app.py', 'geonamescache/__init__.py', 'geonamescache-1.3.0.dist-info'],
2181
- },
2182
- {
2183
- // Function
2184
- id: 'FunctionPythonRuntime28CBDA05',
2185
- files: ['app.py', 'requirements.txt'],
2186
- },
2187
- {
2188
- // Bundled Function
2189
- id: 'BundledFunctionPythonRuntime4D9A0918',
2190
- files: ['app.py', 'geonamescache/__init__.py', 'geonamescache-1.3.0.dist-info'],
2191
- },
2192
- {
2193
- // NodeJs Function
2194
- id: 'NodejsFunction09C1F20F',
2195
- files: ['index.js'],
2196
- },
2197
- {
2198
- // Go Function
2199
- id: 'GoFunctionCA95FBAA',
2200
- files: ['bootstrap'],
2201
- },
2202
- {
2203
- // Docker Image Function
2204
- id: 'DockerImageFunction28B773E6',
2205
- files: ['app.js', 'Dockerfile', 'package.json'],
2206
- },
2207
- ];
2208
-
2209
- for (const resource of expectedBundledAssets) {
2210
- const assetPath = template.Resources[resource.id].Metadata['aws:asset:path'];
2211
- for (const file of resource.files) {
2212
- fixture.output.write(`validate Path ${file} for resource ${resource}`);
2213
- expect(existsSync(path.join(fixture.integTestDir, 'cdk.out', assetPath, file))).toBeTruthy();
2214
- }
2215
- }
2216
- }),
2217
- );
2218
-
2219
- integTest(
2220
- 'sam can locally test the synthesized cdk application',
2221
- withSamIntegrationFixture(async (fixture) => {
2222
- // Synth first
2223
- await fixture.cdkSynth();
2224
-
2225
- const result = await fixture.samLocalStartApi(
2226
- 'TestStack',
2227
- false,
2228
- randomInteger(30000, 40000),
2229
- '/restapis/spec/pythonFunction',
2230
- );
2231
- expect(result.actionSucceeded).toBeTruthy();
2232
- expect(result.actionOutput).toEqual(
2233
- expect.objectContaining({
2234
- message: 'Hello World',
2235
- }),
2236
- );
2237
- }),
2238
- );
2239
-
2240
- integTest(
2241
- 'skips notice refresh',
2242
- withDefaultFixture(async (fixture) => {
2243
- const output = await fixture.cdkSynth({
2244
- options: ['--no-notices'],
2245
- modEnv: {
2246
- INTEG_STACK_SET: 'stage-using-context',
2247
- },
2248
- allowErrExit: true,
2249
- });
2250
-
2251
- // Neither succeeds nor fails, but skips the refresh
2252
- await expect(output).not.toContain('Notices refreshed');
2253
- await expect(output).not.toContain('Notices refresh failed');
2254
- }),
2255
- );
2256
-
2257
- /**
2258
- * Create an S3 bucket, orphan that bucket, then import the bucket, with a NodeJSFunction lambda also in the stack.
2259
- *
2260
- * Validates fix for https://github.com/aws/aws-cdk/issues/31999 (import fails)
2261
- */
2262
- integTest(
2263
- 'test resource import with construct that requires bundling',
2264
- withDefaultFixture(async (fixture) => {
2265
- // GIVEN
2266
- const outputsFile = path.join(fixture.integTestDir, 'outputs', 'outputs.json');
2267
- await fs.mkdir(path.dirname(outputsFile), { recursive: true });
2268
-
2269
- // First, create a stack that includes a NodeJSFunction lambda and one bucket that will be removed from the stack but NOT deleted from AWS.
2270
- await fixture.cdkDeploy('importable-stack', {
2271
- modEnv: { INCLUDE_NODEJS_FUNCTION_LAMBDA: '1', INCLUDE_SINGLE_BUCKET: '1', RETAIN_SINGLE_BUCKET: '1' },
2272
- options: ['--outputs-file', outputsFile],
2273
- });
2274
-
2275
- try {
2276
- // Second, now the bucket we will remove is in the stack and has a logicalId. We can now make the resource mapping file.
2277
- // This resource mapping file will be used to tell the import operation what bucket to bring into the stack.
2278
- const fullStackName = fixture.fullStackName('importable-stack');
2279
- const outputs = JSON.parse((await fs.readFile(outputsFile, { encoding: 'utf-8' })).toString());
2280
- const bucketLogicalId = outputs[fullStackName].BucketLogicalId;
2281
- const bucketName = outputs[fullStackName].BucketName;
2282
- const bucketResourceMap = {
2283
- [bucketLogicalId]: {
2284
- BucketName: bucketName,
2285
- },
2286
- };
2287
- const mappingFile = path.join(fixture.integTestDir, 'outputs', 'mapping.json');
2288
- await fs.writeFile(mappingFile, JSON.stringify(bucketResourceMap), { encoding: 'utf-8' });
2289
-
2290
- // Third, remove the bucket from the stack, but don't delete the bucket from AWS.
2291
- await fixture.cdkDeploy('importable-stack', {
2292
- modEnv: { INCLUDE_NODEJS_FUNCTION_LAMBDA: '1', INCLUDE_SINGLE_BUCKET: '0', RETAIN_SINGLE_BUCKET: '0' },
2293
- });
2294
- const cfnTemplateBeforeImport = await fixture.aws.cloudFormation.send(
2295
- new GetTemplateCommand({ StackName: fullStackName }),
2296
- );
2297
- expect(cfnTemplateBeforeImport.TemplateBody).not.toContain(bucketLogicalId);
2298
-
2299
- // WHEN
2300
- await fixture.cdk(['import', '--resource-mapping', mappingFile, fixture.fullStackName('importable-stack')], {
2301
- modEnv: { INCLUDE_NODEJS_FUNCTION_LAMBDA: '1', INCLUDE_SINGLE_BUCKET: '1', RETAIN_SINGLE_BUCKET: '0' },
2302
- });
2303
-
2304
- // THEN
2305
- const describeStacksResponse = await fixture.aws.cloudFormation.send(
2306
- new DescribeStacksCommand({ StackName: fullStackName }),
2307
- );
2308
- const cfnTemplateAfterImport = await fixture.aws.cloudFormation.send(
2309
- new GetTemplateCommand({ StackName: fullStackName }),
2310
- );
2311
-
2312
- // If bundling is skipped during import for NodeJSFunction lambda, then the operation should fail and exit
2313
- expect(describeStacksResponse.Stacks![0].StackStatus).toEqual('IMPORT_COMPLETE');
2314
-
2315
- // If the import operation is successful, the template should contain the imported bucket
2316
- expect(cfnTemplateAfterImport.TemplateBody).toContain(bucketLogicalId);
2317
- } finally {
2318
- // Clean up the resources we created
2319
- await fixture.cdkDestroy('importable-stack');
2320
- }
2321
- }),
2322
- );
2323
-
2324
- /**
2325
- * Create a queue, orphan that queue, then import the queue.
2326
- *
2327
- * We want to test with a large template to make sure large templates can work with import.
2328
- */
2329
- integTest(
2330
- 'test resource import',
2331
- withDefaultFixture(async (fixture) => {
2332
- // GIVEN
2333
- const randomPrefix = randomString();
2334
- const uniqueOutputsFileName = `${randomPrefix}Outputs.json`; // other tests use the outputs file. Make sure we don't collide.
2335
- const outputsFile = path.join(fixture.integTestDir, 'outputs', uniqueOutputsFileName);
2336
- await fs.mkdir(path.dirname(outputsFile), { recursive: true });
2337
-
2338
- // First, create a stack that includes many queues, and one queue that will be removed from the stack but NOT deleted from AWS.
2339
- await fixture.cdkDeploy('importable-stack', {
2340
- modEnv: { LARGE_TEMPLATE: '1', INCLUDE_SINGLE_QUEUE: '1', RETAIN_SINGLE_QUEUE: '1' },
2341
- options: ['--outputs-file', outputsFile],
2342
- });
2343
-
2344
- try {
2345
- // Second, now the queue we will remove is in the stack and has a logicalId. We can now make the resource mapping file.
2346
- // This resource mapping file will be used to tell the import operation what queue to bring into the stack.
2347
- const fullStackName = fixture.fullStackName('importable-stack');
2348
- const outputs = JSON.parse((await fs.readFile(outputsFile, { encoding: 'utf-8' })).toString());
2349
- const queueLogicalId = outputs[fullStackName].QueueLogicalId;
2350
- const queueResourceMap = {
2351
- [queueLogicalId]: { QueueUrl: outputs[fullStackName].QueueUrl },
2352
- };
2353
- const mappingFile = path.join(fixture.integTestDir, 'outputs', `${randomPrefix}Mapping.json`);
2354
- await fs.writeFile(mappingFile, JSON.stringify(queueResourceMap), { encoding: 'utf-8' });
2355
-
2356
- // Third, remove the queue from the stack, but don't delete the queue from AWS.
2357
- await fixture.cdkDeploy('importable-stack', {
2358
- modEnv: { LARGE_TEMPLATE: '1', INCLUDE_SINGLE_QUEUE: '0', RETAIN_SINGLE_QUEUE: '0' },
2359
- });
2360
- const cfnTemplateBeforeImport = await fixture.aws.cloudFormation.send(
2361
- new GetTemplateCommand({ StackName: fullStackName }),
2362
- );
2363
- expect(cfnTemplateBeforeImport.TemplateBody).not.toContain(queueLogicalId);
2364
-
2365
- // WHEN
2366
- await fixture.cdk(['import', '--resource-mapping', mappingFile, fixture.fullStackName('importable-stack')], {
2367
- modEnv: { LARGE_TEMPLATE: '1', INCLUDE_SINGLE_QUEUE: '1', RETAIN_SINGLE_QUEUE: '0' },
2368
- });
2369
-
2370
- // THEN
2371
- const describeStacksResponse = await fixture.aws.cloudFormation.send(
2372
- new DescribeStacksCommand({ StackName: fullStackName }),
2373
- );
2374
- const cfnTemplateAfterImport = await fixture.aws.cloudFormation.send(
2375
- new GetTemplateCommand({ StackName: fullStackName }),
2376
- );
2377
- expect(describeStacksResponse.Stacks![0].StackStatus).toEqual('IMPORT_COMPLETE');
2378
- expect(cfnTemplateAfterImport.TemplateBody).toContain(queueLogicalId);
2379
- } finally {
2380
- // Clean up
2381
- await fixture.cdkDestroy('importable-stack');
2382
- }
2383
- }),
2384
- );
2385
-
2386
- integTest(
2387
- 'test migrate deployment for app with localfile source in migrate.json',
2388
- withDefaultFixture(async (fixture) => {
2389
- const outputsFile = path.join(fixture.integTestDir, 'outputs', 'outputs.json');
2390
- await fs.mkdir(path.dirname(outputsFile), { recursive: true });
2391
-
2392
- // Initial deploy
2393
- await fixture.cdkDeploy('migrate-stack', {
2394
- modEnv: { ORPHAN_TOPIC: '1' },
2395
- options: ['--outputs-file', outputsFile],
2396
- });
2397
-
2398
- const outputs = JSON.parse((await fs.readFile(outputsFile, { encoding: 'utf-8' })).toString());
2399
- const stackName = fixture.fullStackName('migrate-stack');
2400
- const queueName = outputs[stackName].QueueName;
2401
- const queueUrl = outputs[stackName].QueueUrl;
2402
- const queueLogicalId = outputs[stackName].QueueLogicalId;
2403
- fixture.log(`Created queue ${queueUrl} in stack ${fixture.fullStackName}`);
2404
-
2405
- // Write the migrate file based on the ID from step one, then deploy the app with migrate
2406
- const migrateFile = path.join(fixture.integTestDir, 'migrate.json');
2407
- await fs.writeFile(
2408
- migrateFile,
2409
- JSON.stringify({
2410
- Source: 'localfile',
2411
- Resources: [
2412
- {
2413
- ResourceType: 'AWS::SQS::Queue',
2414
- LogicalResourceId: queueLogicalId,
2415
- ResourceIdentifier: { QueueUrl: queueUrl },
2416
- },
2417
- ],
2418
- }),
2419
- { encoding: 'utf-8' },
2420
- );
2421
-
2422
- await fixture.cdkDestroy('migrate-stack');
2423
- fixture.log(`Deleted stack ${fixture.fullStackName}, orphaning ${queueName}`);
2424
-
2425
- // Create new stack from existing queue
2426
- try {
2427
- fixture.log(`Deploying new stack ${fixture.fullStackName}, migrating ${queueName} into stack`);
2428
- await fixture.cdkDeploy('migrate-stack');
2429
- } finally {
2430
- // Cleanup
2431
- await fixture.cdkDestroy('migrate-stack');
2432
- }
2433
- }),
2434
- );
2435
-
2436
- integTest(
2437
- "hotswap deployment supports Lambda function's description and environment variables",
2438
- withDefaultFixture(async (fixture) => {
2439
- // GIVEN
2440
- const stackArn = await fixture.cdkDeploy('lambda-hotswap', {
2441
- captureStderr: false,
2442
- modEnv: {
2443
- DYNAMIC_LAMBDA_PROPERTY_VALUE: 'original value',
2444
- },
2445
- });
2446
-
2447
- // WHEN
2448
- const deployOutput = await fixture.cdkDeploy('lambda-hotswap', {
2449
- options: ['--hotswap'],
2450
- captureStderr: true,
2451
- onlyStderr: true,
2452
- modEnv: {
2453
- DYNAMIC_LAMBDA_PROPERTY_VALUE: 'new value',
2454
- },
2455
- });
2456
-
2457
- const response = await fixture.aws.cloudFormation.send(
2458
- new DescribeStacksCommand({
2459
- StackName: stackArn,
2460
- }),
2461
- );
2462
- const functionName = response.Stacks?.[0].Outputs?.[0].OutputValue;
2463
-
2464
- // THEN
2465
- // The deployment should not trigger a full deployment, thus the stack's status must remains
2466
- // "CREATE_COMPLETE"
2467
- expect(response.Stacks?.[0].StackStatus).toEqual('CREATE_COMPLETE');
2468
- // The entire string fails locally due to formatting. Making this test less specific
2469
- expect(deployOutput).toMatch(/hotswapped!/);
2470
- expect(deployOutput).toContain(functionName);
2471
- }),
2472
- );
2473
-
2474
- integTest(
2475
- 'hotswap deployment supports Fn::ImportValue intrinsic',
2476
- withDefaultFixture(async (fixture) => {
2477
- // GIVEN
2478
- try {
2479
- await fixture.cdkDeploy('export-value-stack');
2480
- const stackArn = await fixture.cdkDeploy('lambda-hotswap', {
2481
- captureStderr: false,
2482
- modEnv: {
2483
- DYNAMIC_LAMBDA_PROPERTY_VALUE: 'original value',
2484
- USE_IMPORT_VALUE_LAMBDA_PROPERTY: 'true',
2485
- },
2486
- });
2487
-
2488
- // WHEN
2489
- const deployOutput = await fixture.cdkDeploy('lambda-hotswap', {
2490
- options: ['--hotswap'],
2491
- captureStderr: true,
2492
- onlyStderr: true,
2493
- modEnv: {
2494
- DYNAMIC_LAMBDA_PROPERTY_VALUE: 'new value',
2495
- USE_IMPORT_VALUE_LAMBDA_PROPERTY: 'true',
2496
- },
2497
- });
2498
-
2499
- const response = await fixture.aws.cloudFormation.send(
2500
- new DescribeStacksCommand({
2501
- StackName: stackArn,
2502
- }),
2503
- );
2504
- const functionName = response.Stacks?.[0].Outputs?.[0].OutputValue;
2505
-
2506
- // THEN
2507
-
2508
- // The deployment should not trigger a full deployment, thus the stack's status must remains
2509
- // "CREATE_COMPLETE"
2510
- expect(response.Stacks?.[0].StackStatus).toEqual('CREATE_COMPLETE');
2511
- // The entire string fails locally due to formatting. Making this test less specific
2512
- expect(deployOutput).toMatch(/hotswapped!/);
2513
- expect(deployOutput).toContain(functionName);
2514
- } finally {
2515
- // Ensure cleanup in reverse order due to use of import/export
2516
- await fixture.cdkDestroy('lambda-hotswap');
2517
- await fixture.cdkDestroy('export-value-stack');
2518
- }
2519
- }),
2520
- );
2521
-
2522
- integTest(
2523
- 'hotswap deployment supports ecs service',
2524
- withDefaultFixture(async (fixture) => {
2525
- // GIVEN
2526
- const stackArn = await fixture.cdkDeploy('ecs-hotswap', {
2527
- captureStderr: false,
2528
- });
2529
-
2530
- // WHEN
2531
- const deployOutput = await fixture.cdkDeploy('ecs-hotswap', {
2532
- options: ['--hotswap'],
2533
- captureStderr: true,
2534
- onlyStderr: true,
2535
- modEnv: {
2536
- DYNAMIC_ECS_PROPERTY_VALUE: 'new value',
2537
- },
2538
- });
2539
-
2540
- const response = await fixture.aws.cloudFormation.send(
2541
- new DescribeStacksCommand({
2542
- StackName: stackArn,
2543
- }),
2544
- );
2545
- const serviceName = response.Stacks?.[0].Outputs?.find((output) => output.OutputKey == 'ServiceName')?.OutputValue;
2546
-
2547
- // THEN
2548
-
2549
- // The deployment should not trigger a full deployment, thus the stack's status must remains
2550
- // "CREATE_COMPLETE"
2551
- expect(response.Stacks?.[0].StackStatus).toEqual('CREATE_COMPLETE');
2552
- // The entire string fails locally due to formatting. Making this test less specific
2553
- expect(deployOutput).toMatch(/hotswapped!/);
2554
- expect(deployOutput).toContain(serviceName);
2555
- }),
2556
- );
2557
-
2558
- integTest(
2559
- 'hotswap deployment for ecs service waits for deployment to complete',
2560
- withDefaultFixture(async (fixture) => {
2561
- // GIVEN
2562
- const stackArn = await fixture.cdkDeploy('ecs-hotswap', {
2563
- captureStderr: false,
2564
- });
2565
-
2566
- // WHEN
2567
- const deployOutput = await fixture.cdkDeploy('ecs-hotswap', {
2568
- options: ['--hotswap'],
2569
- modEnv: {
2570
- DYNAMIC_ECS_PROPERTY_VALUE: 'new value',
2571
- },
2572
- });
2573
-
2574
- const describeStacksResponse = await fixture.aws.cloudFormation.send(
2575
- new DescribeStacksCommand({
2576
- StackName: stackArn,
2577
- }),
2578
- );
2579
- const clusterName = describeStacksResponse.Stacks?.[0].Outputs?.find((output) => output.OutputKey == 'ClusterName')
2580
- ?.OutputValue!;
2581
- const serviceName = describeStacksResponse.Stacks?.[0].Outputs?.find((output) => output.OutputKey == 'ServiceName')
2582
- ?.OutputValue!;
2583
-
2584
- // THEN
2585
-
2586
- const describeServicesResponse = await fixture.aws.ecs.send(
2587
- new DescribeServicesCommand({
2588
- cluster: clusterName,
2589
- services: [serviceName],
2590
- }),
2591
- );
2592
- expect(describeServicesResponse.services?.[0].deployments).toHaveLength(1); // only one deployment present
2593
- expect(deployOutput).toMatch(/hotswapped!/);
2594
- }),
2595
- );
2596
-
2597
- integTest(
2598
- 'hotswap deployment for ecs service detects failed deployment and errors',
2599
- withExtendedTimeoutFixture(async (fixture) => {
2600
- // GIVEN
2601
- await fixture.cdkDeploy('ecs-hotswap', { verbose: true });
2602
-
2603
- // WHEN
2604
- const deployOutput = await fixture.cdkDeploy('ecs-hotswap', {
2605
- options: ['--hotswap'],
2606
- modEnv: {
2607
- USE_INVALID_ECS_HOTSWAP_IMAGE: 'true',
2608
- },
2609
- allowErrExit: true,
2610
- verbose: true,
2611
- });
2612
-
2613
- // THEN
2614
- const expectedSubstring = 'Resource is not in the expected state due to waiter status: TIMEOUT';
2615
- expect(deployOutput).toContain(expectedSubstring);
2616
- expect(deployOutput).toContain('Observed responses:');
2617
- expect(deployOutput).toContain('200: OK');
2618
- expect(deployOutput).not.toContain('hotswapped!');
2619
- }),
2620
- );
2621
-
2622
- integTest('hotswap deployment supports AppSync APIs with many functions',
2623
- withDefaultFixture(async (fixture) => {
2624
- // GIVEN
2625
- const stackArn = await fixture.cdkDeploy('appsync-hotswap', {
2626
- captureStderr: false,
2627
- });
2628
-
2629
- // WHEN
2630
- const deployOutput = await fixture.cdkDeploy('appsync-hotswap', {
2631
- options: ['--hotswap'],
2632
- captureStderr: true,
2633
- onlyStderr: true,
2634
- modEnv: {
2635
- DYNAMIC_APPSYNC_PROPERTY_VALUE: '$util.qr($ctx.stash.put("newTemplate", []))\n$util.toJson({})',
2636
- },
2637
- });
2638
-
2639
- const response = await fixture.aws.cloudFormation.send(
2640
- new DescribeStacksCommand({
2641
- StackName: stackArn,
2642
- }),
2643
- );
2644
-
2645
- expect(response.Stacks?.[0].StackStatus).toEqual('CREATE_COMPLETE');
2646
- // assert all 50 functions were hotswapped
2647
- for (const i of Array(50).keys()) {
2648
- expect(deployOutput).toContain(`AWS::AppSync::FunctionConfiguration 'appsync_function${i}' hotswapped!`);
2649
- }
2650
- }),
2651
- );
2652
-
2653
- integTest('hotswap ECS deployment respects properties override', withDefaultFixture(async (fixture) => {
2654
- // Update the CDK context with the new ECS properties
2655
- let ecsMinimumHealthyPercent = 100;
2656
- let ecsMaximumHealthyPercent = 200;
2657
- let cdkJson = JSON.parse(await fs.readFile(path.join(fixture.integTestDir, 'cdk.json'), 'utf8'));
2658
- cdkJson = {
2659
- ...cdkJson,
2660
- hotswap: {
2661
- ecs: {
2662
- minimumHealthyPercent: ecsMinimumHealthyPercent,
2663
- maximumHealthyPercent: ecsMaximumHealthyPercent,
2664
- },
2665
- },
2666
- };
2667
-
2668
- await fs.writeFile(path.join(fixture.integTestDir, 'cdk.json'), JSON.stringify(cdkJson));
2669
-
2670
- // GIVEN
2671
- const stackArn = await fixture.cdkDeploy('ecs-hotswap', {
2672
- captureStderr: false,
2673
- });
2674
-
2675
- // WHEN
2676
- await fixture.cdkDeploy('ecs-hotswap', {
2677
- options: [
2678
- '--hotswap',
2679
- ],
2680
- modEnv: {
2681
- DYNAMIC_ECS_PROPERTY_VALUE: 'new value',
2682
- },
2683
- });
2684
-
2685
- const describeStacksResponse = await fixture.aws.cloudFormation.send(
2686
- new DescribeStacksCommand({
2687
- StackName: stackArn,
2688
- }),
2689
- );
2690
-
2691
- const clusterName = describeStacksResponse.Stacks?.[0].Outputs?.find(output => output.OutputKey == 'ClusterName')?.OutputValue!;
2692
- const serviceName = describeStacksResponse.Stacks?.[0].Outputs?.find(output => output.OutputKey == 'ServiceName')?.OutputValue!;
2693
-
2694
- // THEN
2695
- const describeServicesResponse = await fixture.aws.ecs.send(
2696
- new DescribeServicesCommand({
2697
- cluster: clusterName,
2698
- services: [serviceName],
2699
- }),
2700
- );
2701
- expect(describeServicesResponse.services?.[0].deploymentConfiguration?.minimumHealthyPercent).toEqual(ecsMinimumHealthyPercent);
2702
- expect(describeServicesResponse.services?.[0].deploymentConfiguration?.maximumPercent).toEqual(ecsMaximumHealthyPercent);
2703
- }));
2704
-
2705
- async function listChildren(parent: string, pred: (x: string) => Promise<boolean>) {
2706
- const ret = new Array<string>();
2707
- for (const child of await fs.readdir(parent, { encoding: 'utf-8' })) {
2708
- const fullPath = path.join(parent, child.toString());
2709
- if (await pred(fullPath)) {
2710
- ret.push(fullPath);
2711
- }
2712
- }
2713
- return ret;
2714
- }
2715
-
2716
- async function listChildDirs(parent: string) {
2717
- return listChildren(parent, async (fullPath: string) => (await fs.stat(fullPath)).isDirectory());
2718
- }
2719
-
2720
- integTest(
2721
- 'cdk notices with --unacknowledged',
2722
- withDefaultFixture(async (fixture) => {
2723
- const noticesUnacknowledged = await fixture.cdk(['notices', '--unacknowledged'], { verbose: false });
2724
- const noticesUnacknowledgedAlias = await fixture.cdk(['notices', '-u'], { verbose: false });
2725
- expect(noticesUnacknowledged).toEqual(expect.stringMatching(/There are \d{1,} unacknowledged notice\(s\)./));
2726
- expect(noticesUnacknowledged).toEqual(noticesUnacknowledgedAlias);
2727
- }),
2728
- );
2729
-
2730
- integTest(
2731
- 'test cdk rollback',
2732
- withSpecificFixture('rollback-test-app', async (fixture) => {
2733
- let phase = '1';
2734
-
2735
- // Should succeed
2736
- await fixture.cdkDeploy('test-rollback', {
2737
- options: ['--no-rollback'],
2738
- modEnv: { PHASE: phase },
2739
- verbose: false,
2740
- });
2741
- try {
2742
- phase = '2a';
2743
-
2744
- // Should fail
2745
- const deployOutput = await fixture.cdkDeploy('test-rollback', {
2746
- options: ['--no-rollback'],
2747
- modEnv: { PHASE: phase },
2748
- verbose: false,
2749
- allowErrExit: true,
2750
- });
2751
- expect(deployOutput).toContain('UPDATE_FAILED');
2752
-
2753
- // Rollback
2754
- await fixture.cdk(['rollback'], {
2755
- modEnv: { PHASE: phase },
2756
- verbose: false,
2757
- });
2758
- } finally {
2759
- await fixture.cdkDestroy('test-rollback');
2760
- }
2761
- }),
2762
- );
2763
-
2764
- integTest(
2765
- 'automatic rollback if paused and change contains a replacement',
2766
- withSpecificFixture('rollback-test-app', async (fixture) => {
2767
- let phase = '1';
2768
-
2769
- // Should succeed
2770
- await fixture.cdkDeploy('test-rollback', {
2771
- options: ['--no-rollback'],
2772
- modEnv: { PHASE: phase },
2773
- verbose: false,
2774
- });
2775
- try {
2776
- phase = '2a';
2777
-
2778
- // Should fail
2779
- const deployOutput = await fixture.cdkDeploy('test-rollback', {
2780
- options: ['--no-rollback'],
2781
- modEnv: { PHASE: phase },
2782
- verbose: false,
2783
- allowErrExit: true,
2784
- });
2785
- expect(deployOutput).toContain('UPDATE_FAILED');
2786
-
2787
- // Do a deployment with a replacement and --force: this will roll back first and then deploy normally
2788
- phase = '3';
2789
- await fixture.cdkDeploy('test-rollback', {
2790
- options: ['--no-rollback', '--force'],
2791
- modEnv: { PHASE: phase },
2792
- verbose: false,
2793
- });
2794
- } finally {
2795
- await fixture.cdkDestroy('test-rollback');
2796
- }
2797
- }),
2798
- );
2799
-
2800
- integTest(
2801
- 'automatic rollback if paused and --no-rollback is removed from flags',
2802
- withSpecificFixture('rollback-test-app', async (fixture) => {
2803
- let phase = '1';
2804
-
2805
- // Should succeed
2806
- await fixture.cdkDeploy('test-rollback', {
2807
- options: ['--no-rollback'],
2808
- modEnv: { PHASE: phase },
2809
- verbose: false,
2810
- });
2811
- try {
2812
- phase = '2a';
2813
-
2814
- // Should fail
2815
- const deployOutput = await fixture.cdkDeploy('test-rollback', {
2816
- options: ['--no-rollback'],
2817
- modEnv: { PHASE: phase },
2818
- verbose: false,
2819
- allowErrExit: true,
2820
- });
2821
- expect(deployOutput).toContain('UPDATE_FAILED');
2822
-
2823
- // Do a deployment removing --no-rollback: this will roll back first and then deploy normally
2824
- phase = '1';
2825
- await fixture.cdkDeploy('test-rollback', {
2826
- options: ['--force'],
2827
- modEnv: { PHASE: phase },
2828
- verbose: false,
2829
- });
2830
- } finally {
2831
- await fixture.cdkDestroy('test-rollback');
2832
- }
2833
- }),
2834
- );
2835
-
2836
- integTest(
2837
- 'automatic rollback if replacement and --no-rollback is removed from flags',
2838
- withSpecificFixture('rollback-test-app', async (fixture) => {
2839
- let phase = '1';
2840
-
2841
- // Should succeed
2842
- await fixture.cdkDeploy('test-rollback', {
2843
- options: ['--no-rollback'],
2844
- modEnv: { PHASE: phase },
2845
- verbose: false,
2846
- });
2847
- try {
2848
- // Do a deployment with a replacement and removing --no-rollback: this will do a regular rollback deploy
2849
- phase = '3';
2850
- await fixture.cdkDeploy('test-rollback', {
2851
- options: ['--force'],
2852
- modEnv: { PHASE: phase },
2853
- verbose: false,
2854
- });
2855
- } finally {
2856
- await fixture.cdkDestroy('test-rollback');
2857
- }
2858
- }),
2859
- );
2860
-
2861
- integTest(
2862
- 'test cdk rollback --force',
2863
- withSpecificFixture('rollback-test-app', async (fixture) => {
2864
- let phase = '1';
2865
-
2866
- // Should succeed
2867
- await fixture.cdkDeploy('test-rollback', {
2868
- options: ['--no-rollback'],
2869
- modEnv: { PHASE: phase },
2870
- verbose: false,
2871
- });
2872
- try {
2873
- phase = '2b'; // Fail update and also fail rollback
2874
-
2875
- // Should fail
2876
- const deployOutput = await fixture.cdkDeploy('test-rollback', {
2877
- options: ['--no-rollback'],
2878
- modEnv: { PHASE: phase },
2879
- verbose: false,
2880
- allowErrExit: true,
2881
- });
2882
-
2883
- expect(deployOutput).toContain('UPDATE_FAILED');
2884
-
2885
- // Should still fail
2886
- const rollbackOutput = await fixture.cdk(['rollback'], {
2887
- modEnv: { PHASE: phase },
2888
- verbose: false,
2889
- allowErrExit: true,
2890
- });
2891
-
2892
- expect(rollbackOutput).toContain('Failing rollback');
2893
-
2894
- // Rollback and force cleanup
2895
- await fixture.cdk(['rollback', '--force'], {
2896
- modEnv: { PHASE: phase },
2897
- verbose: false,
2898
- });
2899
- } finally {
2900
- await fixture.cdkDestroy('test-rollback');
2901
- }
2902
- }),
2903
- );
2904
-
2905
- integTest('cdk notices are displayed correctly', withDefaultFixture(async (fixture) => {
2906
- const cache = {
2907
- expiration: 4125963264000, // year 2100 so we never overwrite the cache
2908
- notices: [
2909
- {
2910
- title: 'Bootstrap 1999 Notice',
2911
- issueNumber: 4444,
2912
- overview: 'Overview for Bootstrap 1999 Notice. AffectedEnvironments:<{resolve:ENVIRONMENTS}>',
2913
- components: [
2914
- {
2915
- name: 'bootstrap',
2916
- version: '<1999', // so we include all possible environments
2917
- },
2918
- ],
2919
- schemaVersion: '1',
2920
- },
2921
- ],
2922
- };
2923
-
2924
- const cdkCacheDir = path.join(fixture.integTestDir, 'cache');
2925
- await fs.mkdir(cdkCacheDir);
2926
- await fs.writeFile(path.join(cdkCacheDir, 'notices.json'), JSON.stringify(cache));
2927
-
2928
- const output = await fixture.cdkDeploy('notices', {
2929
- verbose: false,
2930
- modEnv: {
2931
- CDK_HOME: fixture.integTestDir,
2932
- },
2933
- });
2934
-
2935
- expect(output).toContain('Overview for Bootstrap 1999 Notice');
2936
-
2937
- // assert dynamic environments are resolved
2938
- expect(output).toContain(`AffectedEnvironments:<aws://${await fixture.aws.account()}/${fixture.aws.region}>`);
2939
- }));
2940
-
2941
- integTest('requests go through a proxy when configured',
2942
- withDefaultFixture(async (fixture) => {
2943
- const proxyServer = await startProxyServer();
2944
- try {
2945
- // Delete notices cache if it exists
2946
- await fs.rm(path.join(process.env.HOME ?? os.userInfo().homedir, '.cdk/cache/notices.json'), { force: true });
2947
-
2948
- await fixture.cdkDeploy('test-2', {
2949
- captureStderr: true,
2950
- options: [
2951
- '--proxy', proxyServer.url,
2952
- '--ca-bundle-path', proxyServer.certPath,
2953
- ],
2954
- modEnv: {
2955
- CDK_HOME: fixture.integTestDir,
2956
- },
2957
- });
2958
-
2959
- const requests = await proxyServer.getSeenRequests();
2960
-
2961
- expect(requests.map(req => req.url))
2962
- .toContain('https://cli.cdk.dev-tools.aws.dev/notices.json');
2963
-
2964
- const actionsUsed = awsActionsFromRequests(requests);
2965
- expect(actionsUsed).toContain('AssumeRole');
2966
- expect(actionsUsed).toContain('CreateChangeSet');
2967
- } finally {
2968
- await proxyServer.stop();
2969
- }
2970
- }),
2971
- );