@aws-cdk-testing/cli-integ 3.4.5 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/aws.js +6 -9
- package/lib/cli/query-github.js +2 -3
- package/lib/cli/run-suite.js +2 -3
- package/lib/cli/stage-distribution.js +4 -4
- package/lib/eventually.js +3 -3
- package/lib/files.js +2 -3
- package/lib/github.js +5 -6
- package/lib/integ-test.js +58 -3
- package/lib/package-sources/release-source.d.ts +1 -1
- package/lib/package-sources/release-source.js +2 -3
- package/lib/package-sources/repo-source.d.ts +1 -1
- package/lib/package-sources/repo-source.js +1 -1
- package/lib/package-sources/repo-tools/npm.js +4 -5
- package/lib/package-sources/subprocess.d.ts +1 -1
- package/lib/package-sources/subprocess.js +1 -1
- package/lib/process.js +5 -6
- package/lib/proxy.d.ts +1 -1
- package/lib/proxy.js +2 -2
- package/lib/resource-pool.js +5 -3
- package/lib/shell.d.ts +3 -3
- package/lib/shell.js +8 -12
- package/lib/staging/codeartifact.js +8 -11
- package/lib/staging/maven.d.ts +2 -2
- package/lib/staging/maven.js +3 -5
- package/lib/staging/npm.d.ts +2 -2
- package/lib/staging/npm.js +1 -1
- package/lib/staging/nuget.d.ts +2 -2
- package/lib/staging/nuget.js +1 -1
- package/lib/staging/parallel-shell.js +2 -2
- package/lib/staging/pypi.d.ts +2 -2
- package/lib/staging/pypi.js +1 -1
- package/lib/with-aws.d.ts +2 -2
- package/lib/with-aws.js +5 -4
- package/lib/with-cdk-app.d.ts +7 -5
- package/lib/with-cdk-app.js +30 -33
- package/lib/with-cli-lib.d.ts +4 -3
- package/lib/with-cli-lib.js +2 -1
- package/lib/with-packages.d.ts +1 -1
- package/lib/with-packages.js +1 -1
- package/lib/with-sam.d.ts +3 -3
- package/lib/with-sam.js +5 -7
- package/lib/with-temporary-directory.d.ts +1 -1
- package/lib/with-temporary-directory.js +1 -1
- package/lib/xpmutex.js +5 -3
- package/npm-shrinkwrap.json +8722 -0
- package/package.json +11 -7
- package/resources/cdk-apps/refactoring/cdk.json +7 -0
- package/resources/cdk-apps/refactoring/refactoring.js +18 -0
- package/test-reports/junit.xml +15 -0
- package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.js +11 -11
- package/tests/cli-integ-tests/cdk-assets/smoketest.integtest.js +9 -9
- package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.js +4 -6
- package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.js +4 -5
- package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-deploy.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.js +6 -7
- package/tests/cli-integ-tests/cdk-fast-deploy.integtest.js +4 -5
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.js +6 -5
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.js +5 -6
- package/tests/cli-integ-tests/cdk-import-interactive.integtest.js +5 -6
- package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.js +1 -2
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.js +1 -1
- package/tests/cli-integ-tests/cdk-migrate/testcase.d.ts +1 -1
- package/tests/cli-integ-tests/cdk-migrate/testcase.js +4 -6
- package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-refactor-dry-run.integtest.d.ts +1 -0
- package/tests/cli-integ-tests/cdk-refactor-dry-run.integtest.js +41 -0
- package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.js +5 -6
- package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.js +4 -4
- package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.js +5 -6
- package/tests/cli-integ-tests/proxy.integtest.js +2 -3
- package/tests/init-go/init-go.integtest.js +2 -3
- package/tests/init-typescript-app/init-typescript-app.integtest.js +1 -1
- package/tests/tool-integrations/amplify.integtest.js +4 -4
- package/tests/tool-integrations/with-tool-context.d.ts +5 -5
- package/tests/tool-integrations/with-tool-context.js +1 -1
- package/.eslintrc.js +0 -9
- package/lib/aws.ts +0 -303
- package/lib/cli/query-github.ts +0 -56
- package/lib/cli/run-suite.ts +0 -153
- package/lib/cli/stage-distribution.ts +0 -262
- package/lib/cli/test-root.ts +0 -3
- package/lib/corking.ts +0 -33
- package/lib/eventually.ts +0 -42
- package/lib/files.ts +0 -80
- package/lib/github.ts +0 -43
- package/lib/index.ts +0 -13
- package/lib/integ-test.ts +0 -110
- package/lib/lists.ts +0 -9
- package/lib/memoize.ts +0 -14
- package/lib/npm.ts +0 -41
- package/lib/package-sources/release-source.ts +0 -82
- package/lib/package-sources/repo-source.ts +0 -112
- package/lib/package-sources/repo-tools/npm.ts +0 -48
- package/lib/package-sources/source.ts +0 -35
- package/lib/package-sources/subprocess.ts +0 -15
- package/lib/process.ts +0 -154
- package/lib/proxy.ts +0 -64
- package/lib/resource-pool.ts +0 -140
- package/lib/resources.ts +0 -4
- package/lib/shell.ts +0 -331
- package/lib/staging/codeartifact.ts +0 -387
- package/lib/staging/maven.ts +0 -95
- package/lib/staging/npm.ts +0 -62
- package/lib/staging/nuget.ts +0 -75
- package/lib/staging/parallel-shell.ts +0 -51
- package/lib/staging/pypi.ts +0 -50
- package/lib/staging/usage-dir.ts +0 -99
- package/lib/with-aws.ts +0 -111
- package/lib/with-cdk-app.ts +0 -845
- package/lib/with-cli-lib.ts +0 -149
- package/lib/with-packages.ts +0 -15
- package/lib/with-sam.ts +0 -294
- package/lib/with-temporary-directory.ts +0 -35
- package/lib/with-timeout.ts +0 -33
- package/lib/xpmutex.ts +0 -218
- package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/nested-stack.js +0 -19
- package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js +0 -134
- package/tests/cli-integ-tests/cdk---exclusively-selects-only-selected-stack.integtest.ts +0 -29
- package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.ts +0 -92
- package/tests/cli-integ-tests/cdk-assets/smoketest.integtest.ts +0 -82
- package/tests/cli-integ-tests/cdk-automatic-ordering-with-concurrency.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-automatic-ordering.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and---no-rollback-is-removed-from-flags.integtest.ts +0 -40
- package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and-change-contains-a-replacement.integtest.ts +0 -40
- package/tests/cli-integ-tests/cdk-automatic-rollback-if-replacement-and---no-rollback-is-removed-from-flags.integtest.ts +0 -29
- package/tests/cli-integ-tests/cdk-bootstrap-a-customized-template-vendor-will-not-overwrite-the-default-template.integtest.ts +0 -42
- package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.ts +0 -26
- package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-bootstrap-can-and-deploy-if-omitting-execution-policies.integtest.ts +0 -21
- package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.ts +0 -21
- package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.ts +0 -27
- package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-modern-synthesized-stack-even-if-bootstrap-stack-name-is-unknown.integtest.ts +0 -24
- package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-with-session-tags-on-the-deploy.integtest.ts +0 -25
- package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-without-execution-role-and-with-session-tags-on-deploy-role.integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-bootstrap-can-dump-the-template.integtest.ts +0 -32
- package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.ts +0 -77
- package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.ts +0 -30
- package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-(with-slashes)-to-bootstrap.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-to-bootstrap.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-default-permissions-boundary-to-bootstrap.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.ts +0 -34
- package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap-(with-docker-image).integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap.integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-bootstrap-deploy-old-style-synthesis-to-new-style-bootstrap.integtest.ts +0 -21
- package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.ts +0 -24
- package/tests/cli-integ-tests/cdk-bootstrap-upgrade-legacy-bootstrap-stack-to-new-bootstrap-stack-while-in-use.integtest.ts +0 -47
- package/tests/cli-integ-tests/cdk-can-still-load-old-assemblies.integtest.ts +0 -57
- package/tests/cli-integ-tests/cdk-cdk-diff---fail-on-multiple-stacks-exits-with-error-if-any-of-the-stacks-contains-a-diff.integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-cdk-diff---fail-with-multiple-stack-exits-with-if-any-of-the-stacks-contains-a-diff.integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-cdk-diff---quiet-does-not-print-there-were-no-differences-message-for-stacks-which-have-no-differences.integtest.ts +0 -19
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-changes-are-present.integtest.ts +0 -14
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-access-control-config.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-assignment.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-with-managed-policy.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-without-managed-policy.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-access-control-information.integtest.ts +0 -35
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-assignment-information.integtest.ts +0 -37
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-with-managed-policy-information.integtest.ts +0 -35
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-without-managed-policy-information.integtest.ts +0 -37
- package/tests/cli-integ-tests/cdk-cdk-diff-doesnt-show-resource-metadata-changes.integtest.ts +0 -23
- package/tests/cli-integ-tests/cdk-cdk-diff-shows-resource-metadata-changes-with---no-change-set.integtest.ts +0 -23
- package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-and-custom-toolkit-stack-name-and-qualifier-does-not-fail.integtest.ts +0 -39
- package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-does-not-fail.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-cdk-diff.integtest.ts +0 -18
- package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json---long.integtest.ts +0 -50
- package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json.integtest.ts +0 -95
- package/tests/cli-integ-tests/cdk-cdk-ls.integtest.ts +0 -36
- package/tests/cli-integ-tests/cdk-cdk-notices-are-displayed-correctly.integtest.ts +0 -42
- package/tests/cli-integ-tests/cdk-cdk-notices-with---unacknowledged.integtest.ts +0 -14
- package/tests/cli-integ-tests/cdk-cdk-synth-add-the-metadata-properties-expected-by-sam.integtest.ts +0 -126
- package/tests/cli-integ-tests/cdk-cdk-synth-bundled-functions-as-expected.integtest.ts +0 -80
- package/tests/cli-integ-tests/cdk-cdk-synth.integtest.ts +0 -53
- package/tests/cli-integ-tests/cdk-ci-output-to-stderr.integtest.ts +0 -19
- package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-construct-with-builtin-lambda-function.integtest.ts +0 -14
- package/tests/cli-integ-tests/cdk-context-in-stage-propagates-to-top.integtest.ts +0 -20
- package/tests/cli-integ-tests/cdk-context-setting.integtest.ts +0 -33
- package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.ts +0 -23
- package/tests/cli-integ-tests/cdk-deploy-all-concurrently.integtest.ts +0 -17
- package/tests/cli-integ-tests/cdk-deploy-all.integtest.ts +0 -14
- package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.ts +0 -31
- package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.ts +0 -50
- package/tests/cli-integ-tests/cdk-deploy-no-stacks-error.integtest.ts +0 -18
- package/tests/cli-integ-tests/cdk-deploy-no-stacks-with---ignore-no-stacks.integtest.ts +0 -17
- package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.ts +0 -51
- package/tests/cli-integ-tests/cdk-deploy-stack-with-docker-asset.integtest.ts +0 -11
- package/tests/cli-integ-tests/cdk-deploy-stack-with-lambda-asset-to-object-lock-enabled-asset-bucket.integtest.ts +0 -42
- package/tests/cli-integ-tests/cdk-deploy-stack-without-resource.integtest.ts +0 -32
- package/tests/cli-integ-tests/cdk-deploy-wildcard-with-outputs.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.ts +0 -29
- package/tests/cli-integ-tests/cdk-deploy-with-method-direct-and-import-existing-resources-fails.integtest.ts +0 -17
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.ts +0 -36
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.ts +0 -45
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.ts +0 -37
- package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.ts +0 -33
- package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.ts +0 -26
- package/tests/cli-integ-tests/cdk-deploy-with-role.integtest.ts +0 -119
- package/tests/cli-integ-tests/cdk-deploy-with-wildcard-and-parameters.integtest.ts +0 -22
- package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.ts +0 -36
- package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-deploy.integtest.ts +0 -20
- package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.ts +0 -36
- package/tests/cli-integ-tests/cdk-doubly-nested-stack.integtest.ts +0 -12
- package/tests/cli-integ-tests/cdk-enablediffnofail.integtest.ts +0 -44
- package/tests/cli-integ-tests/cdk-failed-deploy-does-not-hang.integtest.ts +0 -12
- package/tests/cli-integ-tests/cdk-fast-deploy.integtest.ts +0 -41
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-ecr-images.integtest.ts +0 -48
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-s3-objects.integtest.ts +0 -51
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-ecr-images.integtest.ts +0 -48
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-s3-objects.integtest.ts +0 -52
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-ecr-images.integtest.ts +0 -47
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-s3-objects.integtest.ts +0 -63
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-ecr-images.integtest.ts +0 -55
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.ts +0 -63
- package/tests/cli-integ-tests/cdk-generating-and-loading-assembly.integtest.ts +0 -52
- package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-detects-failed-deployment-and-errors.integtest.ts +0 -29
- package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.ts +0 -45
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.ts +0 -36
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.ts +0 -41
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.ts +0 -53
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.ts +0 -43
- package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.ts +0 -59
- package/tests/cli-integ-tests/cdk-iam-diff.integtest.ts +0 -23
- package/tests/cli-integ-tests/cdk-import-interactive.integtest.ts +0 -57
- package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.ts +0 -32
- package/tests/cli-integ-tests/cdk-lib-cli-lib-list.integtest.ts +0 -12
- package/tests/cli-integ-tests/cdk-lib-cli-lib-synth.integtest.ts +0 -27
- package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.ts +0 -32
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.ts +0 -14
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.ts +0 -20
- package/tests/cli-integ-tests/cdk-migrate/testcase.ts +0 -69
- package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.ts +0 -28
- package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.ts +0 -39
- package/tests/cli-integ-tests/cdk-sam-can-locally-test-the-synthesized-cdk-application.integtest.ts +0 -25
- package/tests/cli-integ-tests/cdk-security-related-changes-without-a-cli-are-expected-to-fail.integtest.ts +0 -30
- package/tests/cli-integ-tests/cdk-skips-notice-refresh.integtest.ts +0 -26
- package/tests/cli-integ-tests/cdk-ssm-parameter-provider-error.integtest.ts +0 -18
- package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.ts +0 -59
- package/tests/cli-integ-tests/cdk-stage-with-bundled-lambda-function.integtest.ts +0 -13
- package/tests/cli-integ-tests/cdk-synth---quiet-can-be-specified-in-cdk.json.integtest.ts +0 -20
- package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-can-be-suppressed.integtest.ts +0 -15
- package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-leads-to-failure.integtest.ts +0 -18
- package/tests/cli-integ-tests/cdk-templates-on-disk-contain-metadata-resource.integtest.ts +0 -25
- package/tests/cli-integ-tests/cdk-termination-protection.integtest.ts +0 -19
- package/tests/cli-integ-tests/cdk-test-cdk-rollback---force.integtest.ts +0 -48
- package/tests/cli-integ-tests/cdk-test-cdk-rollback.integtest.ts +0 -38
- package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.ts +0 -56
- package/tests/cli-integ-tests/cdk-test-resource-import-with-construct-that-requires-bundling.integtest.ts +0 -74
- package/tests/cli-integ-tests/cdk-test-resource-import.integtest.ts +0 -64
- package/tests/cli-integ-tests/cdk-two-ways-of-showing-the-version.integtest.ts +0 -14
- package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.ts +0 -47
- package/tests/cli-integ-tests/cdk-vpc-lookup.integtest.ts +0 -26
- package/tests/cli-integ-tests/proxy.integtest.ts +0 -168
- package/tests/init-csharp/init-csharp.integtest.ts +0 -15
- package/tests/init-fsharp/init-fsharp.integtest.ts +0 -15
- package/tests/init-go/init-go.integtest.ts +0 -28
- package/tests/init-java/init-java.integtest.ts +0 -14
- package/tests/init-javascript/init-javascript.integtest.ts +0 -58
- package/tests/init-python/init-python.integtest.ts +0 -20
- package/tests/init-typescript-app/init-typescript-app.integtest.ts +0 -67
- package/tests/init-typescript-lib/init-typescript-lib.integtest.ts +0 -13
- package/tests/tool-integrations/amplify.integtest.ts +0 -117
- package/tests/tool-integrations/with-tool-context.ts +0 -14
- package/tests/uberpackage/uberpackage.integtest.ts +0 -11
package/lib/with-cdk-app.ts
DELETED
|
@@ -1,845 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import * as assert from 'assert';
|
|
3
|
-
import * as fs from 'fs';
|
|
4
|
-
import * as os from 'os';
|
|
5
|
-
import * as path from 'path';
|
|
6
|
-
import { DescribeStacksCommand, Stack } from '@aws-sdk/client-cloudformation';
|
|
7
|
-
import { GetAuthorizationTokenCommand } from '@aws-sdk/client-ecr-public';
|
|
8
|
-
import { outputFromStack, AwsClients, sleep } from './aws';
|
|
9
|
-
import { TestContext } from './integ-test';
|
|
10
|
-
import { findYarnPackages } from './package-sources/repo-source';
|
|
11
|
-
import { IPackageSource } from './package-sources/source';
|
|
12
|
-
import { packageSourceInSubprocess } from './package-sources/subprocess';
|
|
13
|
-
import { RESOURCES_DIR } from './resources';
|
|
14
|
-
import { shell, ShellOptions, ShellHelper, rimraf } from './shell';
|
|
15
|
-
import { AwsContext, atmosphereEnabled, withAws } from './with-aws';
|
|
16
|
-
import { withTimeout } from './with-timeout';
|
|
17
|
-
|
|
18
|
-
export const DEFAULT_TEST_TIMEOUT_S = 20 * 60;
|
|
19
|
-
export const EXTENDED_TEST_TIMEOUT_S = 30 * 60;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Higher order function to execute a block with a CDK app fixture
|
|
23
|
-
*
|
|
24
|
-
* Requires an AWS client to be passed in.
|
|
25
|
-
*
|
|
26
|
-
* For backwards compatibility with existing tests (so we don't have to change
|
|
27
|
-
* too much) the inner block is expected to take a `TestFixture` object.
|
|
28
|
-
*/
|
|
29
|
-
export function withSpecificCdkApp(
|
|
30
|
-
appName: string,
|
|
31
|
-
block: (context: TestFixture) => Promise<void>,
|
|
32
|
-
): (context: TestContext & AwsContext & DisableBootstrapContext) => Promise<void> {
|
|
33
|
-
return async (context: TestContext & AwsContext & DisableBootstrapContext) => {
|
|
34
|
-
const randy = context.randomString;
|
|
35
|
-
const stackNamePrefix = `cdktest-${randy}`;
|
|
36
|
-
const integTestDir = path.join(os.tmpdir(), `cdk-integ-${randy}`);
|
|
37
|
-
|
|
38
|
-
context.output.write(` Stack prefix: ${stackNamePrefix}\n`);
|
|
39
|
-
context.output.write(` Test directory: ${integTestDir}\n`);
|
|
40
|
-
context.output.write(` Region: ${context.aws.region}\n`);
|
|
41
|
-
|
|
42
|
-
await cloneDirectory(path.join(RESOURCES_DIR, 'cdk-apps', appName), integTestDir, context.output);
|
|
43
|
-
const fixture = new TestFixture(
|
|
44
|
-
integTestDir,
|
|
45
|
-
stackNamePrefix,
|
|
46
|
-
context.output,
|
|
47
|
-
context.aws,
|
|
48
|
-
context.randomString);
|
|
49
|
-
|
|
50
|
-
let success = true;
|
|
51
|
-
try {
|
|
52
|
-
const installationVersion = fixture.packages.requestedFrameworkVersion();
|
|
53
|
-
|
|
54
|
-
if (fixture.packages.majorVersion() === '1') {
|
|
55
|
-
await installNpmPackages(fixture, {
|
|
56
|
-
'@aws-cdk/core': installationVersion,
|
|
57
|
-
'@aws-cdk/aws-sns': installationVersion,
|
|
58
|
-
'@aws-cdk/aws-sqs': installationVersion,
|
|
59
|
-
'@aws-cdk/aws-iam': installationVersion,
|
|
60
|
-
'@aws-cdk/aws-lambda': installationVersion,
|
|
61
|
-
'@aws-cdk/aws-ssm': installationVersion,
|
|
62
|
-
'@aws-cdk/aws-ecr-assets': installationVersion,
|
|
63
|
-
'@aws-cdk/aws-cloudformation': installationVersion,
|
|
64
|
-
'@aws-cdk/aws-ec2': installationVersion,
|
|
65
|
-
'@aws-cdk/aws-s3': installationVersion,
|
|
66
|
-
'constructs': '^3',
|
|
67
|
-
});
|
|
68
|
-
} else {
|
|
69
|
-
await installNpmPackages(fixture, {
|
|
70
|
-
'aws-cdk-lib': installationVersion,
|
|
71
|
-
'constructs': '^10',
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (!context.disableBootstrap) {
|
|
76
|
-
await ensureBootstrapped(fixture);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
await block(fixture);
|
|
80
|
-
} catch (e) {
|
|
81
|
-
success = false;
|
|
82
|
-
throw e;
|
|
83
|
-
} finally {
|
|
84
|
-
if (process.env.INTEG_NO_CLEAN) {
|
|
85
|
-
context.log(`Left test directory in '${integTestDir}' ($INTEG_NO_CLEAN)\n`);
|
|
86
|
-
} else {
|
|
87
|
-
await fixture.dispose(success);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Like `withSpecificCdkApp`, but uses the default integration testing app with a million stacks in it
|
|
95
|
-
*/
|
|
96
|
-
export function withCdkApp(
|
|
97
|
-
block: (context: TestFixture) => Promise<void>,
|
|
98
|
-
): (context: TestContext & AwsContext & DisableBootstrapContext) => Promise<void> {
|
|
99
|
-
// 'app' is the name of the default integration app in the `cdk-apps` directory
|
|
100
|
-
return withSpecificCdkApp('app', block);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export function withCdkMigrateApp(
|
|
104
|
-
language: string,
|
|
105
|
-
block: (context: TestFixture) => Promise<void>,
|
|
106
|
-
): (context: TestContext & AwsContext & DisableBootstrapContext) => Promise<void> {
|
|
107
|
-
return async (context: TestContext & AwsContext & DisableBootstrapContext) => {
|
|
108
|
-
const stackName = `cdk-migrate-${language}-integ-${context.randomString}`;
|
|
109
|
-
const integTestDir = path.join(os.tmpdir(), `cdk-migrate-${language}-integ-${context.randomString}`);
|
|
110
|
-
|
|
111
|
-
context.output.write(` Stack name: ${stackName}\n`);
|
|
112
|
-
context.output.write(` Test directory: ${integTestDir}\n`);
|
|
113
|
-
|
|
114
|
-
fs.mkdirSync(integTestDir);
|
|
115
|
-
const fixture = new TestFixture(
|
|
116
|
-
integTestDir,
|
|
117
|
-
stackName,
|
|
118
|
-
context.output,
|
|
119
|
-
context.aws,
|
|
120
|
-
context.randomString,
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
await ensureBootstrapped(fixture);
|
|
124
|
-
|
|
125
|
-
await fixture.cdkMigrate(language, stackName);
|
|
126
|
-
|
|
127
|
-
const testFixture = new TestFixture(
|
|
128
|
-
path.join(integTestDir, stackName),
|
|
129
|
-
stackName,
|
|
130
|
-
context.output,
|
|
131
|
-
context.aws,
|
|
132
|
-
context.randomString,
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
let success = true;
|
|
136
|
-
try {
|
|
137
|
-
await block(testFixture);
|
|
138
|
-
} catch (e) {
|
|
139
|
-
success = false;
|
|
140
|
-
throw e;
|
|
141
|
-
} finally {
|
|
142
|
-
if (process.env.INTEG_NO_CLEAN) {
|
|
143
|
-
context.log(`Left test directory in '${integTestDir}' ($INTEG_NO_CLEAN)`);
|
|
144
|
-
} else {
|
|
145
|
-
await fixture.dispose(success);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Default test fixture for most (all?) integ tests
|
|
153
|
-
*
|
|
154
|
-
* It's a composition of withAws/withCdkApp, expecting the test block to take a `TestFixture`
|
|
155
|
-
* object.
|
|
156
|
-
*
|
|
157
|
-
* We could have put `withAws(withCdkApp(fixture => { /... actual test here.../ }))` in every
|
|
158
|
-
* test declaration but centralizing it is going to make it convenient to modify in the future.
|
|
159
|
-
*/
|
|
160
|
-
export function withDefaultFixture(block: (context: TestFixture) => Promise<void>) {
|
|
161
|
-
return withAws(withTimeout(DEFAULT_TEST_TIMEOUT_S, withCdkApp(block)));
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export function withSpecificFixture(appName: string, block: (context: TestFixture) => Promise<void>) {
|
|
165
|
-
return withAws(withTimeout(DEFAULT_TEST_TIMEOUT_S, withSpecificCdkApp(appName, block)));
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export function withExtendedTimeoutFixture(block: (context: TestFixture) => Promise<void>) {
|
|
169
|
-
return withAws(withTimeout(EXTENDED_TEST_TIMEOUT_S, withCdkApp(block)));
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export function withCDKMigrateFixture(language: string, block: (content: TestFixture) => Promise<void>) {
|
|
173
|
-
return withAws(withTimeout(DEFAULT_TEST_TIMEOUT_S, withCdkMigrateApp(language, block)));
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export interface DisableBootstrapContext {
|
|
177
|
-
/**
|
|
178
|
-
* Whether to disable creating the default bootstrap
|
|
179
|
-
* stack prior to running the test
|
|
180
|
-
*
|
|
181
|
-
* This should be set to true when running tests that
|
|
182
|
-
* explicitly create a bootstrap stack
|
|
183
|
-
*
|
|
184
|
-
* @default false
|
|
185
|
-
*/
|
|
186
|
-
readonly disableBootstrap?: boolean;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* To be used in place of `withDefaultFixture` when the test
|
|
191
|
-
* should not create the default bootstrap stack
|
|
192
|
-
*/
|
|
193
|
-
export function withoutBootstrap(block: (context: TestFixture) => Promise<void>) {
|
|
194
|
-
return withAws(withCdkApp(block), true);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export interface CdkCliOptions extends ShellOptions {
|
|
198
|
-
options?: string[];
|
|
199
|
-
neverRequireApproval?: boolean;
|
|
200
|
-
verbose?: boolean;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export interface CdkDestroyCliOptions extends CdkCliOptions {
|
|
204
|
-
readonly force?: boolean;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Prepare a target dir byreplicating a source directory
|
|
209
|
-
*/
|
|
210
|
-
export async function cloneDirectory(source: string, target: string, output?: NodeJS.WritableStream) {
|
|
211
|
-
await shell(['rm', '-rf', target], { outputs: output ? [output] : [] });
|
|
212
|
-
await shell(['mkdir', '-p', target], { outputs: output ? [output] : [] });
|
|
213
|
-
await shell(['cp', '-R', source + '/*', target], { outputs: output ? [output] : [] });
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
interface CommonCdkBootstrapCommandOptions {
|
|
217
|
-
/**
|
|
218
|
-
* Path to a custom bootstrap template.
|
|
219
|
-
*
|
|
220
|
-
* @default - the default CDK bootstrap template.
|
|
221
|
-
*/
|
|
222
|
-
readonly bootstrapTemplate?: string;
|
|
223
|
-
|
|
224
|
-
readonly toolkitStackName: string;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* @default false
|
|
228
|
-
*/
|
|
229
|
-
readonly verbose?: boolean;
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* @default - auto-generated CloudFormation name
|
|
233
|
-
*/
|
|
234
|
-
readonly bootstrapBucketName?: string;
|
|
235
|
-
|
|
236
|
-
readonly cliOptions?: CdkCliOptions;
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* @default - none
|
|
240
|
-
*/
|
|
241
|
-
readonly tags?: string;
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* @default - the default CDK qualifier
|
|
245
|
-
*/
|
|
246
|
-
readonly qualifier?: string;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export interface CdkLegacyBootstrapCommandOptions extends CommonCdkBootstrapCommandOptions {
|
|
250
|
-
/**
|
|
251
|
-
* @default false
|
|
252
|
-
*/
|
|
253
|
-
readonly noExecute?: boolean;
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* @default true
|
|
257
|
-
*/
|
|
258
|
-
readonly publicAccessBlockConfiguration?: boolean;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export interface CdkModernBootstrapCommandOptions extends CommonCdkBootstrapCommandOptions {
|
|
262
|
-
/**
|
|
263
|
-
* @default false
|
|
264
|
-
*/
|
|
265
|
-
readonly force?: boolean;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* @default - none
|
|
269
|
-
*/
|
|
270
|
-
readonly cfnExecutionPolicy?: string;
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* @default false
|
|
274
|
-
*/
|
|
275
|
-
readonly showTemplate?: boolean;
|
|
276
|
-
|
|
277
|
-
readonly template?: string;
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* @default false
|
|
281
|
-
*/
|
|
282
|
-
readonly terminationProtection?: boolean;
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* @default undefined
|
|
286
|
-
*/
|
|
287
|
-
readonly examplePermissionsBoundary?: boolean;
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* @default undefined
|
|
291
|
-
*/
|
|
292
|
-
readonly customPermissionsBoundary?: string;
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* @default undefined
|
|
296
|
-
*/
|
|
297
|
-
readonly usePreviousParameters?: boolean;
|
|
298
|
-
|
|
299
|
-
readonly trust?: string[];
|
|
300
|
-
|
|
301
|
-
readonly untrust?: string[];
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
export interface CdkGarbageCollectionCommandOptions {
|
|
305
|
-
/**
|
|
306
|
-
* The amount of days an asset should stay isolated before deletion, to
|
|
307
|
-
* guard against some pipeline rollback scenarios
|
|
308
|
-
*
|
|
309
|
-
* @default 0
|
|
310
|
-
*/
|
|
311
|
-
readonly rollbackBufferDays?: number;
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* The type of asset that is getting garbage collected.
|
|
315
|
-
*
|
|
316
|
-
* @default 'all'
|
|
317
|
-
*/
|
|
318
|
-
readonly type?: 'ecr' | 's3' | 'all';
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* The name of the bootstrap stack
|
|
322
|
-
*
|
|
323
|
-
* @default 'CdkToolkit'
|
|
324
|
-
*/
|
|
325
|
-
readonly bootstrapStackName?: string;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
export class TestFixture extends ShellHelper {
|
|
329
|
-
public readonly qualifier: string;
|
|
330
|
-
private readonly bucketsToDelete = new Array<string>();
|
|
331
|
-
public readonly packages: IPackageSource;
|
|
332
|
-
|
|
333
|
-
constructor(
|
|
334
|
-
public readonly integTestDir: string,
|
|
335
|
-
public readonly stackNamePrefix: string,
|
|
336
|
-
public readonly output: NodeJS.WritableStream,
|
|
337
|
-
public readonly aws: AwsClients,
|
|
338
|
-
public readonly randomString: string) {
|
|
339
|
-
super(integTestDir, output);
|
|
340
|
-
|
|
341
|
-
this.qualifier = this.randomString.slice(0, 10);
|
|
342
|
-
this.packages = packageSourceInSubprocess();
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
public log(s: string) {
|
|
346
|
-
this.output.write(`${s}\n`);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Login to the public ECR gallery using the current AWS credentials.
|
|
351
|
-
* Use this if your test needs to directly pull images outside of a `cdk` or `cdk-assets` command.
|
|
352
|
-
*/
|
|
353
|
-
public async ecrPublicLogin() {
|
|
354
|
-
|
|
355
|
-
const tokenResponse = await this.aws.ecrPublic.send(new GetAuthorizationTokenCommand({}));
|
|
356
|
-
const authData = tokenResponse.authorizationData?.authorizationToken;
|
|
357
|
-
|
|
358
|
-
const docker = process.env.CDK_DOCKER ?? 'docker';
|
|
359
|
-
|
|
360
|
-
if (!authData) {
|
|
361
|
-
throw new Error("Could not retrieve ECR public auth token.");
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
const decoded = Buffer.from(authData, "base64").toString("utf-8");
|
|
365
|
-
const [username, password] = decoded.split(":");
|
|
366
|
-
|
|
367
|
-
await this.shell([docker, 'login',
|
|
368
|
-
'--username', username,
|
|
369
|
-
'--password', "${ECR_PASSWORD}",
|
|
370
|
-
'public.ecr.aws'], {
|
|
371
|
-
shell: true,
|
|
372
|
-
modEnv: {
|
|
373
|
-
ECR_PASSWORD: password,
|
|
374
|
-
},
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
public async cdkDeploy(stackNames: string | string[], options: CdkCliOptions = {}, skipStackRename?: boolean) {
|
|
380
|
-
return this.cdk(this.cdkDeployCommandLine(stackNames, options, skipStackRename), options);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
public cdkDeployCommandLine(stackNames: string | string[], options: CdkCliOptions = {}, skipStackRename?: boolean) {
|
|
384
|
-
stackNames = typeof stackNames === 'string' ? [stackNames] : stackNames;
|
|
385
|
-
const neverRequireApproval = options.neverRequireApproval ?? true;
|
|
386
|
-
|
|
387
|
-
return [
|
|
388
|
-
'deploy',
|
|
389
|
-
...(neverRequireApproval ? ['--require-approval=never'] : []), // Default to no approval in an unattended test
|
|
390
|
-
...(options.options ?? []),
|
|
391
|
-
// use events because bar renders bad in tests
|
|
392
|
-
'--progress', 'events',
|
|
393
|
-
...(skipStackRename ? stackNames : this.fullStackName(stackNames)),
|
|
394
|
-
];
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
public async cdkSynth(options: CdkCliOptions = {}) {
|
|
398
|
-
return this.cdk([
|
|
399
|
-
'synth',
|
|
400
|
-
...(options.options ?? []),
|
|
401
|
-
], options);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
public async cdkDestroy(stackNames: string | string[], options: CdkDestroyCliOptions = {}) {
|
|
405
|
-
stackNames = typeof stackNames === 'string' ? [stackNames] : stackNames;
|
|
406
|
-
|
|
407
|
-
// default to true because most tests don't test user interaction
|
|
408
|
-
const force = options.force ?? true;
|
|
409
|
-
|
|
410
|
-
return this.cdk(['destroy',
|
|
411
|
-
...(force ? ['-f'] : []), // pass -f if user interaction is not desired
|
|
412
|
-
...(options.options ?? []),
|
|
413
|
-
...this.fullStackName(stackNames)], options);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
public async cdkBootstrapLegacy(options: CdkLegacyBootstrapCommandOptions): Promise<string> {
|
|
417
|
-
const args = ['bootstrap'];
|
|
418
|
-
|
|
419
|
-
if (options.verbose) {
|
|
420
|
-
args.push('-v');
|
|
421
|
-
}
|
|
422
|
-
args.push('--toolkit-stack-name', options.toolkitStackName);
|
|
423
|
-
if (options.bootstrapBucketName) {
|
|
424
|
-
args.push('--bootstrap-bucket-name', options.bootstrapBucketName);
|
|
425
|
-
}
|
|
426
|
-
if (options.noExecute) {
|
|
427
|
-
args.push('--no-execute');
|
|
428
|
-
}
|
|
429
|
-
if (options.publicAccessBlockConfiguration !== undefined) {
|
|
430
|
-
args.push('--public-access-block-configuration', options.publicAccessBlockConfiguration.toString());
|
|
431
|
-
}
|
|
432
|
-
if (options.tags) {
|
|
433
|
-
args.push('--tags', options.tags);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
return this.cdk(args, {
|
|
437
|
-
...options.cliOptions,
|
|
438
|
-
modEnv: {
|
|
439
|
-
...options.cliOptions?.modEnv,
|
|
440
|
-
// so that this works for V2,
|
|
441
|
-
// where the "new" bootstrap is the default
|
|
442
|
-
CDK_LEGACY_BOOTSTRAP: '1',
|
|
443
|
-
},
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
public async cdkBootstrapModern(options: CdkModernBootstrapCommandOptions): Promise<string> {
|
|
448
|
-
const args = ['bootstrap'];
|
|
449
|
-
|
|
450
|
-
if (options.verbose) {
|
|
451
|
-
args.push('-v');
|
|
452
|
-
}
|
|
453
|
-
if (options.showTemplate) {
|
|
454
|
-
args.push('--show-template');
|
|
455
|
-
}
|
|
456
|
-
if (options.template) {
|
|
457
|
-
args.push('--template', options.template);
|
|
458
|
-
}
|
|
459
|
-
args.push('--toolkit-stack-name', options.toolkitStackName);
|
|
460
|
-
if (options.bootstrapBucketName) {
|
|
461
|
-
args.push('--bootstrap-bucket-name', options.bootstrapBucketName);
|
|
462
|
-
}
|
|
463
|
-
args.push('--qualifier', options.qualifier ?? this.qualifier);
|
|
464
|
-
if (options.cfnExecutionPolicy) {
|
|
465
|
-
args.push('--cloudformation-execution-policies', options.cfnExecutionPolicy);
|
|
466
|
-
}
|
|
467
|
-
if (options.terminationProtection !== undefined) {
|
|
468
|
-
args.push('--termination-protection', options.terminationProtection.toString());
|
|
469
|
-
}
|
|
470
|
-
if (options.force) {
|
|
471
|
-
args.push('--force');
|
|
472
|
-
}
|
|
473
|
-
if (options.tags) {
|
|
474
|
-
args.push('--tags', options.tags);
|
|
475
|
-
}
|
|
476
|
-
if (options.customPermissionsBoundary !== undefined) {
|
|
477
|
-
args.push('--custom-permissions-boundary', options.customPermissionsBoundary);
|
|
478
|
-
} else if (options.examplePermissionsBoundary !== undefined) {
|
|
479
|
-
args.push('--example-permissions-boundary');
|
|
480
|
-
}
|
|
481
|
-
if (options.usePreviousParameters === false) {
|
|
482
|
-
args.push('--no-previous-parameters');
|
|
483
|
-
}
|
|
484
|
-
if (options.bootstrapTemplate) {
|
|
485
|
-
args.push('--template', options.bootstrapTemplate);
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
if (options.trust != null) {
|
|
489
|
-
args.push('--trust', options.trust.join(','));
|
|
490
|
-
}
|
|
491
|
-
if (options.untrust != null) {
|
|
492
|
-
args.push('--untrust', options.untrust.join(','));
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
return this.cdk(args, {
|
|
496
|
-
...options.cliOptions,
|
|
497
|
-
modEnv: {
|
|
498
|
-
...options.cliOptions?.modEnv,
|
|
499
|
-
// so that this works for V1,
|
|
500
|
-
// where the "old" bootstrap is the default
|
|
501
|
-
CDK_NEW_BOOTSTRAP: '1',
|
|
502
|
-
},
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
public async cdkGarbageCollect(options: CdkGarbageCollectionCommandOptions): Promise<string> {
|
|
507
|
-
const args = [
|
|
508
|
-
'gc',
|
|
509
|
-
'--unstable=gc', // TODO: remove when stabilizing
|
|
510
|
-
'--confirm=false',
|
|
511
|
-
'--created-buffer-days=0', // Otherwise all assets created during integ tests are too young
|
|
512
|
-
];
|
|
513
|
-
if (options.rollbackBufferDays) {
|
|
514
|
-
args.push('--rollback-buffer-days', String(options.rollbackBufferDays));
|
|
515
|
-
}
|
|
516
|
-
if (options.type) {
|
|
517
|
-
args.push('--type', options.type);
|
|
518
|
-
}
|
|
519
|
-
if (options.bootstrapStackName) {
|
|
520
|
-
args.push('--bootstrapStackName', options.bootstrapStackName);
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
return this.cdk(args);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
public async cdkMigrate(language: string, stackName: string, inputPath?: string, options?: CdkCliOptions) {
|
|
527
|
-
return this.cdk([
|
|
528
|
-
'migrate',
|
|
529
|
-
'--language',
|
|
530
|
-
language,
|
|
531
|
-
'--stack-name',
|
|
532
|
-
stackName,
|
|
533
|
-
'--from-path',
|
|
534
|
-
inputPath ?? path.join(__dirname, '..', 'resources', 'templates', 'sqs-template.json').toString(),
|
|
535
|
-
...(options?.options ?? []),
|
|
536
|
-
], options);
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
public async cdk(args: string[], options: CdkCliOptions = {}) {
|
|
540
|
-
const verbose = options.verbose ?? true;
|
|
541
|
-
|
|
542
|
-
await this.packages.makeCliAvailable();
|
|
543
|
-
|
|
544
|
-
return this.shell(['cdk', ...(verbose ? ['-v'] : []), ...args], {
|
|
545
|
-
...options,
|
|
546
|
-
modEnv: {
|
|
547
|
-
...this.cdkShellEnv(),
|
|
548
|
-
...options.modEnv,
|
|
549
|
-
},
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Return the environment variables with which to execute CDK
|
|
555
|
-
*/
|
|
556
|
-
public cdkShellEnv() {
|
|
557
|
-
// if tests are using an explicit aws identity already (i.e creds)
|
|
558
|
-
// force every cdk command to use the same identity.
|
|
559
|
-
const awsCreds = this.aws.identityEnv() ?? {};
|
|
560
|
-
|
|
561
|
-
return {
|
|
562
|
-
AWS_REGION: this.aws.region,
|
|
563
|
-
AWS_DEFAULT_REGION: this.aws.region,
|
|
564
|
-
STACK_NAME_PREFIX: this.stackNamePrefix,
|
|
565
|
-
PACKAGE_LAYOUT_VERSION: this.packages.majorVersion(),
|
|
566
|
-
// In these tests we want to make a distinction between stdout and sterr
|
|
567
|
-
CI: 'false',
|
|
568
|
-
...awsCreds,
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
public template(stackName: string): any {
|
|
573
|
-
const fullStackName = this.fullStackName(stackName);
|
|
574
|
-
const templatePath = path.join(this.integTestDir, 'cdk.out', `${fullStackName}.template.json`);
|
|
575
|
-
return JSON.parse(fs.readFileSync(templatePath, { encoding: 'utf-8' }).toString());
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
public async bootstrapRepoName(): Promise<string> {
|
|
579
|
-
await ensureBootstrapped(this);
|
|
580
|
-
|
|
581
|
-
const response = await this.aws.cloudFormation.send(new DescribeStacksCommand({}));
|
|
582
|
-
|
|
583
|
-
const stack = (response.Stacks ?? [])
|
|
584
|
-
.filter((s) => s.StackName && s.StackName == this.bootstrapStackName);
|
|
585
|
-
assert(stack.length == 1);
|
|
586
|
-
return outputFromStack('ImageRepositoryName', stack[0]) ?? '';
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
public get bootstrapStackName() {
|
|
590
|
-
return this.fullStackName('bootstrap-stack');
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
public fullStackName(stackName: string): string;
|
|
594
|
-
public fullStackName(stackNames: string[]): string[];
|
|
595
|
-
public fullStackName(stackNames: string | string[]): string | string[] {
|
|
596
|
-
if (typeof stackNames === 'string') {
|
|
597
|
-
return `${this.stackNamePrefix}-${stackNames}`;
|
|
598
|
-
} else {
|
|
599
|
-
return stackNames.map(s => `${this.stackNamePrefix}-${s}`);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
/**
|
|
604
|
-
* Append this to the list of buckets to potentially delete
|
|
605
|
-
*
|
|
606
|
-
* At the end of a test, we clean up buckets that may not have gotten destroyed
|
|
607
|
-
* (for whatever reason).
|
|
608
|
-
*/
|
|
609
|
-
public rememberToDeleteBucket(bucketName: string) {
|
|
610
|
-
this.bucketsToDelete.push(bucketName);
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Cleanup leftover stacks and bootstrapped resources
|
|
615
|
-
*/
|
|
616
|
-
public async dispose(success: boolean) {
|
|
617
|
-
// when using the atmosphere service, it does resource cleanup on our behalf
|
|
618
|
-
// so we don't have to wait for it.
|
|
619
|
-
if (!atmosphereEnabled()) {
|
|
620
|
-
const stacksToDelete = await this.deleteableStacks(this.stackNamePrefix);
|
|
621
|
-
|
|
622
|
-
this.sortBootstrapStacksToTheEnd(stacksToDelete);
|
|
623
|
-
|
|
624
|
-
// Bootstrap stacks have buckets that need to be cleaned
|
|
625
|
-
const bucketNames = stacksToDelete.map(stack => outputFromStack('BucketName', stack)).filter(defined);
|
|
626
|
-
// Parallelism will be reasonable
|
|
627
|
-
// eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism
|
|
628
|
-
await Promise.all(bucketNames.map(b => this.aws.emptyBucket(b)));
|
|
629
|
-
// The bootstrap bucket has a removal policy of RETAIN by default, so add it to the buckets to be cleaned up.
|
|
630
|
-
this.bucketsToDelete.push(...bucketNames);
|
|
631
|
-
|
|
632
|
-
// Bootstrap stacks have ECR repositories with images which should be deleted
|
|
633
|
-
const imageRepositoryNames = stacksToDelete.map(stack => outputFromStack('ImageRepositoryName', stack)).filter(defined);
|
|
634
|
-
// Parallelism will be reasonable
|
|
635
|
-
// eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism
|
|
636
|
-
await Promise.all(imageRepositoryNames.map(r => this.aws.deleteImageRepository(r)));
|
|
637
|
-
|
|
638
|
-
await this.aws.deleteStacks(
|
|
639
|
-
...stacksToDelete.map((s) => {
|
|
640
|
-
if (!s.StackName) {
|
|
641
|
-
throw new Error('Stack name is required to delete a stack.');
|
|
642
|
-
}
|
|
643
|
-
return s.StackName;
|
|
644
|
-
}),
|
|
645
|
-
);
|
|
646
|
-
|
|
647
|
-
// We might have leaked some buckets by upgrading the bootstrap stack. Be
|
|
648
|
-
// sure to clean everything.
|
|
649
|
-
for (const bucket of this.bucketsToDelete) {
|
|
650
|
-
await this.aws.deleteBucket(bucket);
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
// If the tests completed successfully, happily delete the fixture
|
|
655
|
-
// (otherwise leave it for humans to inspect)
|
|
656
|
-
if (success) {
|
|
657
|
-
const cleaned = rimraf(this.integTestDir);
|
|
658
|
-
if (!cleaned) {
|
|
659
|
-
console.error(`Failed to clean up ${this.integTestDir} due to permissions issues (Docker running as root?)`);
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Return the stacks starting with our testing prefix that should be deleted
|
|
666
|
-
*/
|
|
667
|
-
private async deleteableStacks(prefix: string): Promise<Stack[]> {
|
|
668
|
-
const statusFilter = [
|
|
669
|
-
'CREATE_IN_PROGRESS', 'CREATE_FAILED', 'CREATE_COMPLETE',
|
|
670
|
-
'ROLLBACK_IN_PROGRESS', 'ROLLBACK_FAILED', 'ROLLBACK_COMPLETE',
|
|
671
|
-
'DELETE_FAILED',
|
|
672
|
-
'UPDATE_IN_PROGRESS', 'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS',
|
|
673
|
-
'UPDATE_COMPLETE', 'UPDATE_ROLLBACK_IN_PROGRESS',
|
|
674
|
-
'UPDATE_ROLLBACK_FAILED',
|
|
675
|
-
'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS',
|
|
676
|
-
'UPDATE_ROLLBACK_COMPLETE', 'REVIEW_IN_PROGRESS',
|
|
677
|
-
'IMPORT_IN_PROGRESS', 'IMPORT_COMPLETE',
|
|
678
|
-
'IMPORT_ROLLBACK_IN_PROGRESS', 'IMPORT_ROLLBACK_FAILED',
|
|
679
|
-
'IMPORT_ROLLBACK_COMPLETE',
|
|
680
|
-
];
|
|
681
|
-
|
|
682
|
-
const response = await this.aws.cloudFormation.send(new DescribeStacksCommand({}));
|
|
683
|
-
|
|
684
|
-
return (response.Stacks ?? [])
|
|
685
|
-
.filter((s) => s.StackName && s.StackName.startsWith(prefix))
|
|
686
|
-
.filter((s) => s.StackStatus && statusFilter.includes(s.StackStatus))
|
|
687
|
-
.filter((s) => s.RootId === undefined); // Only delete parent stacks. Nested stacks are deleted in the process
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
private sortBootstrapStacksToTheEnd(stacks: Stack[]) {
|
|
691
|
-
stacks.sort((a, b) => {
|
|
692
|
-
if (!a.StackName || !b.StackName) {
|
|
693
|
-
throw new Error('Stack names do not exists. These are required for sorting the bootstrap stacks.');
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
const aBs = a.StackName.startsWith(this.bootstrapStackName);
|
|
697
|
-
const bBs = b.StackName.startsWith(this.bootstrapStackName);
|
|
698
|
-
|
|
699
|
-
return aBs != bBs
|
|
700
|
-
// '+' converts a boolean to 0 or 1
|
|
701
|
-
? (+aBs) - (+bBs)
|
|
702
|
-
: a.StackName.localeCompare(b.StackName);
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* Make sure that the given environment is bootstrapped
|
|
709
|
-
*
|
|
710
|
-
* Since we go striping across regions, it's going to suck doing this
|
|
711
|
-
* by hand so let's just mass-automate it.
|
|
712
|
-
*/
|
|
713
|
-
export async function ensureBootstrapped(fixture: TestFixture) {
|
|
714
|
-
// Always use the modern bootstrap stack, otherwise we may get the error
|
|
715
|
-
// "refusing to downgrade from version 7 to version 0" when bootstrapping with default
|
|
716
|
-
// settings using a v1 CLI.
|
|
717
|
-
//
|
|
718
|
-
// It doesn't matter for tests: when they want to test something about an actual legacy
|
|
719
|
-
// bootstrap stack, they'll create a bootstrap stack with a non-default name to test that exact property.
|
|
720
|
-
const envSpecifier = `aws://${await fixture.aws.account()}/${fixture.aws.region}`;
|
|
721
|
-
if (ALREADY_BOOTSTRAPPED_IN_THIS_RUN.has(envSpecifier)) { return; }
|
|
722
|
-
|
|
723
|
-
if (atmosphereEnabled()) {
|
|
724
|
-
// when atmosphere is enabled, each test starts with an empty environment
|
|
725
|
-
// and needs to deploy the bootstrap stack. in case environments are recylced too quickly,
|
|
726
|
-
// cloudformation may think the bootstrap bucket still exists even though it doesnt (because of s3 eventual consistency).
|
|
727
|
-
// so we retry on the specific error for a while.
|
|
728
|
-
await bootstrapWithRetryOnBucketExists(envSpecifier, fixture);
|
|
729
|
-
} else {
|
|
730
|
-
await doBootstrap(envSpecifier, fixture, false);
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
// when using the atmosphere service, every test needs to bootstrap
|
|
734
|
-
// its own environment.
|
|
735
|
-
if (!atmosphereEnabled()) {
|
|
736
|
-
ALREADY_BOOTSTRAPPED_IN_THIS_RUN.add(envSpecifier);
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
async function doBootstrap(envSpecifier: string, fixture: TestFixture, allowErrExit: boolean) {
|
|
741
|
-
return fixture.cdk(['bootstrap', envSpecifier], {
|
|
742
|
-
modEnv: {
|
|
743
|
-
// Even for v1, use new bootstrap
|
|
744
|
-
CDK_NEW_BOOTSTRAP: '1',
|
|
745
|
-
// when allowing error exit, we probably want to inspect
|
|
746
|
-
// and compare output, which is better done without color characters.
|
|
747
|
-
...(allowErrExit ? { FORCE_COLOR: '0' } : {}),
|
|
748
|
-
},
|
|
749
|
-
allowErrExit,
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
async function bootstrapWithRetryOnBucketExists(envSpecifier: string, fixture: TestFixture) {
|
|
754
|
-
|
|
755
|
-
const account = await fixture.aws.account();
|
|
756
|
-
const retryAfterSeconds = 30;
|
|
757
|
-
const bootstrapBucket = `cdk-hnb659fds-assets-${account}-${fixture.aws.region}`;
|
|
758
|
-
|
|
759
|
-
// s3 says that a bucket deletion can take up to an hour to be fully visible.
|
|
760
|
-
// empirically we see that a few minutes is enough though. lets give 10 to be on the safe(r) side.
|
|
761
|
-
const timeoutMinutes = 10;
|
|
762
|
-
|
|
763
|
-
const timeoutDate = new Date(Date.now() + timeoutMinutes * 60 * 1000)
|
|
764
|
-
while (true) {
|
|
765
|
-
const out = await doBootstrap(envSpecifier, fixture, true);
|
|
766
|
-
if (out.includes(`Environment ${envSpecifier} bootstrapped`)) {
|
|
767
|
-
break;
|
|
768
|
-
}
|
|
769
|
-
if (out.includes(`${bootstrapBucket} already exists`)) {
|
|
770
|
-
// might be an s3 eventualy consistency issue due to recycled environments.
|
|
771
|
-
if (Date.now() < timeoutDate.getTime()) {
|
|
772
|
-
fixture.log(`Bootstrap of ${envSpecifier} failed due to bucket existence check. Retrying in ${retryAfterSeconds} seconds...`);
|
|
773
|
-
await sleep(retryAfterSeconds * 1000)
|
|
774
|
-
continue;
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
throw new Error(`Failed bootstrapping ${envSpecifier}`);
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
function defined<A>(x: A): x is NonNullable<A> {
|
|
782
|
-
return x !== undefined;
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
/**
|
|
786
|
-
* Install the given NPM packages, identified by their names and versions
|
|
787
|
-
*
|
|
788
|
-
* Works by writing the packages to a `package.json` file, and
|
|
789
|
-
* then running NPM7's "install" on it. The use of NPM7 will automatically
|
|
790
|
-
* install required peerDependencies.
|
|
791
|
-
*
|
|
792
|
-
* If we're running in REPO mode and we find the package in the set of local
|
|
793
|
-
* packages in the repository, we'll write the directory name to `package.json`
|
|
794
|
-
* so that NPM will create a symlink (this allows running tests against
|
|
795
|
-
* built-but-unpackaged modules, and saves dev cycle time).
|
|
796
|
-
*
|
|
797
|
-
* Be aware you MUST install all the packages you directly depend upon! In the case
|
|
798
|
-
* of a repo/symlinking install, transitive dependencies WILL NOT be installed in the
|
|
799
|
-
* current directory's `node_modules` directory, because they will already have been
|
|
800
|
-
* symlinked from the TARGET directory's `node_modules` directory (which is sufficient
|
|
801
|
-
* for Node's dependency lookup mechanism).
|
|
802
|
-
*/
|
|
803
|
-
export async function installNpmPackages(fixture: TestFixture, packages: Record<string, string>) {
|
|
804
|
-
if (process.env.REPO_ROOT) {
|
|
805
|
-
const monoRepo = await findYarnPackages(process.env.REPO_ROOT);
|
|
806
|
-
|
|
807
|
-
// Replace the install target with the physical location of this package
|
|
808
|
-
for (const key of Object.keys(packages)) {
|
|
809
|
-
if (key in monoRepo) {
|
|
810
|
-
packages[key] = monoRepo[key];
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
fs.writeFileSync(path.join(fixture.integTestDir, 'package.json'), JSON.stringify({
|
|
816
|
-
name: 'cdk-integ-tests',
|
|
817
|
-
private: true,
|
|
818
|
-
version: '0.0.1',
|
|
819
|
-
devDependencies: packages,
|
|
820
|
-
}, undefined, 2), { encoding: 'utf-8' });
|
|
821
|
-
|
|
822
|
-
// we often ECONNRESET from NPM so lets retry. this might be because of high concurrency
|
|
823
|
-
// which overwhelmes system resources.
|
|
824
|
-
const timeoutMinutes = 10;
|
|
825
|
-
const timeoutDate = new Date(Date.now() + timeoutMinutes * 60 * 1000)
|
|
826
|
-
const retryAfterSeconds = 30;
|
|
827
|
-
|
|
828
|
-
while (true) {
|
|
829
|
-
try {
|
|
830
|
-
// Now install that `package.json` using NPM7
|
|
831
|
-
await fixture.shell(['node', require.resolve('npm'), 'install']);
|
|
832
|
-
break;
|
|
833
|
-
} catch (e: any) {
|
|
834
|
-
if (Date.now() < timeoutDate.getTime() && fixture.output.toString().includes('ECONNRESET' )) {
|
|
835
|
-
fixture.log(`npm install failed due to ECONNRESET. Retrying in ${retryAfterSeconds} seconds...`);
|
|
836
|
-
await sleep(retryAfterSeconds * 1000)
|
|
837
|
-
continue;
|
|
838
|
-
}
|
|
839
|
-
throw e;
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
const ALREADY_BOOTSTRAPPED_IN_THIS_RUN = new Set();
|