@aws-cdk-testing/cli-integ 3.5.0 → 3.7.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/README.md +48 -39
- package/lib/aws.js +20 -9
- package/lib/cli/query-github.js +2 -3
- package/lib/cli/run-suite.js +123 -52
- package/lib/cli/stage-distribution.js +4 -4
- package/lib/corking.js +2 -5
- 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/npm.d.ts +2 -0
- package/lib/npm.js +30 -1
- package/lib/package-sources/cli-npm-source.d.ts +14 -0
- package/lib/package-sources/cli-npm-source.js +50 -0
- package/lib/package-sources/cli-repo-source.d.ts +19 -0
- package/lib/package-sources/cli-repo-source.js +49 -0
- package/lib/package-sources/find-root.d.ts +6 -0
- package/lib/package-sources/find-root.js +18 -0
- package/lib/package-sources/library-globalinstall-source.d.ts +20 -0
- package/lib/package-sources/library-globalinstall-source.js +70 -0
- package/lib/package-sources/library-npm-source.d.ts +17 -0
- package/lib/package-sources/library-npm-source.js +60 -0
- package/lib/package-sources/library-preinstalled-source.d.ts +21 -0
- package/lib/package-sources/library-preinstalled-source.js +78 -0
- package/lib/package-sources/repo-tools/npm.js +4 -5
- package/lib/package-sources/source.d.ts +36 -18
- package/lib/package-sources/source.js +1 -1
- package/lib/package-sources/subprocess.d.ts +10 -3
- package/lib/package-sources/subprocess.js +31 -12
- package/lib/process.js +7 -6
- package/lib/proxy.d.ts +1 -1
- package/lib/proxy.js +2 -2
- package/lib/resource-pool.js +10 -6
- package/lib/shell.d.ts +3 -3
- package/lib/shell.js +12 -16
- package/lib/staging/codeartifact.js +17 -18
- 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/staging/usage-dir.js +4 -1
- package/lib/with-aws.d.ts +2 -2
- package/lib/with-aws.js +5 -4
- package/lib/with-cdk-app.d.ts +9 -6
- package/lib/with-cdk-app.js +48 -61
- package/lib/with-cli-lib.d.ts +4 -3
- package/lib/with-cli-lib.js +5 -8
- package/lib/with-packages.d.ts +3 -2
- package/lib/with-packages.js +3 -2
- package/lib/with-sam.d.ts +3 -3
- package/lib/with-sam.js +15 -33
- package/lib/with-temporary-directory.d.ts +1 -1
- package/lib/with-temporary-directory.js +1 -1
- package/lib/xpmutex.js +11 -4
- package/lib/yarn.d.ts +6 -0
- package/lib/yarn.js +31 -0
- package/npm-shrinkwrap.json +8724 -0
- package/package.json +16 -11
- package/resources/cdk-apps/refactoring/cdk.json +7 -0
- package/resources/cdk-apps/refactoring/refactoring.js +18 -0
- package/resources/integ.jest.config.js +45 -8
- package/test-reports/junit.xml +15 -0
- package/tests/cli-integ-tests/cdk---exclusively-selects-only-selected-stack.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.js +12 -12
- package/tests/cli-integ-tests/cdk-assets/smoketest.integtest.js +10 -10
- package/tests/cli-integ-tests/cdk-automatic-ordering-with-concurrency.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-automatic-ordering.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and---no-rollback-is-removed-from-flags.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and-change-contains-a-replacement.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-automatic-rollback-if-replacement-and---no-rollback-is-removed-from-flags.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-a-customized-template-vendor-will-not-overwrite-the-default-template.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-bootstrap-can-and-deploy-if-omitting-execution-policies.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-modern-synthesized-stack-even-if-bootstrap-stack-name-is-unknown.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-with-session-tags-on-the-deploy.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-without-execution-role-and-with-session-tags-on-deploy-role.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-can-dump-the-template.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.js +5 -7
- package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-(with-slashes)-to-bootstrap.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-to-bootstrap.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-default-permissions-boundary-to-bootstrap.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.js +5 -6
- package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap-(with-docker-image).integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-deploy-old-style-synthesis-to-new-style-bootstrap.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-bootstrap-upgrade-legacy-bootstrap-stack-to-new-bootstrap-stack-while-in-use.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-can-still-load-old-assemblies.integtest.js +2 -2
- 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 +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff---fail-with-multiple-stack-exits-with-if-any-of-the-stacks-contains-a-diff.integtest.js +2 -2
- 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 +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-changes-are-present.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-access-control-config.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-assignment.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-with-managed-policy.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-without-managed-policy.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-access-control-information.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-assignment-information.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-with-managed-policy-information.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-without-managed-policy-information.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff-doesnt-show-resource-metadata-changes.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff-shows-resource-metadata-changes-with---no-change-set.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-and-custom-toolkit-stack-name-and-qualifier-does-not-fail.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-does-not-fail.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-diff.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json---long.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-ls.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-notices-are-displayed-correctly.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-notices-with---unacknowledged.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-synth-add-the-metadata-properties-expected-by-sam.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-synth-bundled-functions-as-expected.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-cdk-synth.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-ci-output-to-stderr.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-construct-with-builtin-lambda-function.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-context-in-stage-propagates-to-top.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-context-setting.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-all-concurrently.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-deploy-all.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.js +4 -5
- package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.js +4 -5
- package/tests/cli-integ-tests/cdk-deploy-no-stacks-error.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-deploy-no-stacks-with---ignore-no-stacks.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-stack-with-docker-asset.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-deploy-stack-with-lambda-asset-to-object-lock-enabled-asset-bucket.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-deploy-stack-without-resource.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-deploy-wildcard-with-outputs.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-with-method-direct-and-import-existing-resources-fails.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.js +4 -5
- package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-with-wildcard-and-parameters.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-deploy.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.js +6 -7
- package/tests/cli-integ-tests/cdk-doubly-nested-stack.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-enablediffnofail.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-failed-deploy-does-not-hang.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-fast-deploy.integtest.js +5 -6
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-ecr-images.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-s3-objects.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-ecr-images.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-s3-objects.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-ecr-images.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-s3-objects.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-ecr-images.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.js +3 -3
- package/tests/cli-integ-tests/cdk-generating-and-loading-assembly.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-detects-failed-deployment-and-errors.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.js +7 -6
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.js +4 -5
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.js +4 -5
- package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.js +4 -5
- package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.js +6 -7
- package/tests/cli-integ-tests/cdk-iam-diff.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-import-interactive.integtest.js +5 -6
- package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.js +3 -4
- package/tests/cli-integ-tests/cdk-lib-cli-lib-list.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-lib-cli-lib-synth.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.js +2 -3
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.js +2 -2
- 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 +3 -4
- 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 +3 -4
- package/tests/cli-integ-tests/cdk-sam-can-locally-test-the-synthesized-cdk-application.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-security-related-changes-without-a-cli-are-expected-to-fail.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-skips-notice-refresh.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-ssm-parameter-provider-error.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.js +6 -7
- package/tests/cli-integ-tests/cdk-stage-with-bundled-lambda-function.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-synth---quiet-can-be-specified-in-cdk.json.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-can-be-suppressed.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-leads-to-failure.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-templates-on-disk-contain-metadata-resource.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-termination-protection.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-test-cdk-rollback---force.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-test-cdk-rollback.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.js +5 -5
- package/tests/cli-integ-tests/cdk-test-resource-import-with-construct-that-requires-bundling.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-test-resource-import.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-two-ways-of-showing-the-version.integtest.js +2 -2
- package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.js +6 -7
- package/tests/cli-integ-tests/cdk-vpc-lookup.integtest.js +2 -2
- package/tests/cli-integ-tests/proxy.integtest.js +2 -3
- package/tests/init-csharp/init-csharp.integtest.js +4 -4
- package/tests/init-fsharp/init-fsharp.integtest.js +4 -4
- package/tests/init-go/init-go.integtest.js +4 -5
- package/tests/init-java/init-java.integtest.js +3 -3
- package/tests/init-javascript/init-javascript.integtest.js +3 -3
- package/tests/init-python/init-python.integtest.js +3 -3
- package/tests/init-typescript-app/init-typescript-app.integtest.js +3 -3
- package/tests/init-typescript-lib/init-typescript-lib.integtest.js +2 -2
- package/tests/tool-integrations/amplify.integtest.js +6 -6
- package/tests/tool-integrations/with-tool-context.d.ts +5 -5
- package/tests/tool-integrations/with-tool-context.js +1 -1
- package/tests/toolkit-lib-integ-tests/toolkit-can-cdk-deploy.integtest.d.ts +1 -0
- package/tests/toolkit-lib-integ-tests/toolkit-can-cdk-deploy.integtest.js +17 -0
- package/tests/toolkit-lib-integ-tests/toolkit-helpers.d.ts +15 -0
- package/tests/toolkit-lib-integ-tests/toolkit-helpers.js +45 -0
- package/tests/uberpackage/uberpackage.integtest.js +2 -2
- 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.d.ts +0 -23
- package/lib/package-sources/release-source.js +0 -71
- package/lib/package-sources/release-source.ts +0 -82
- package/lib/package-sources/repo-source.d.ts +0 -30
- package/lib/package-sources/repo-source.js +0 -97
- 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 -847
- package/lib/with-cli-lib.ts +0 -150
- package/lib/with-packages.ts +0 -15
- package/lib/with-sam.ts +0 -295
- 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.js +0 -97
- 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/tests/cli-integ-tests/{cdk-deploy-with-role.integtest.d.ts → cdk-refactor-dry-run.integtest.d.ts} +0 -0
package/lib/proxy.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import * as querystring from 'node:querystring';
|
|
3
|
-
import * as os from 'os';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import * as mockttp from 'mockttp';
|
|
6
|
-
import { CompletedRequest } from 'mockttp';
|
|
7
|
-
|
|
8
|
-
export async function startProxyServer(certDirRoot?: string): Promise<ProxyServer> {
|
|
9
|
-
const certDir = await fs.mkdtemp(path.join(certDirRoot ?? os.tmpdir(), 'cdk-'));
|
|
10
|
-
const certPath = path.join(certDir, 'cert.pem');
|
|
11
|
-
const keyPath = path.join(certDir, 'key.pem');
|
|
12
|
-
|
|
13
|
-
// Set up key and certificate
|
|
14
|
-
const { key, cert } = await mockttp.generateCACertificate();
|
|
15
|
-
await fs.writeFile(keyPath, key);
|
|
16
|
-
await fs.writeFile(certPath, cert);
|
|
17
|
-
|
|
18
|
-
const server = mockttp.getLocal({
|
|
19
|
-
https: { keyPath: keyPath, certPath: certPath },
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
// We don't need to modify any request, so the proxy
|
|
23
|
-
// passes through all requests to the target host.
|
|
24
|
-
const endpoint = await server
|
|
25
|
-
.forAnyRequest()
|
|
26
|
-
.thenPassThrough();
|
|
27
|
-
|
|
28
|
-
const port = 9000 + Math.floor(Math.random() * 10000);
|
|
29
|
-
|
|
30
|
-
// server.enableDebug();
|
|
31
|
-
await server.start(port);
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
certPath,
|
|
35
|
-
keyPath,
|
|
36
|
-
server,
|
|
37
|
-
url: server.url,
|
|
38
|
-
port: server.port,
|
|
39
|
-
getSeenRequests: () => endpoint.getSeenRequests(),
|
|
40
|
-
async stop() {
|
|
41
|
-
await server.stop();
|
|
42
|
-
await fs.rm(certDir, { recursive: true, force: true });
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ProxyServer {
|
|
48
|
-
readonly certPath: string;
|
|
49
|
-
readonly keyPath: string;
|
|
50
|
-
readonly server: mockttp.Mockttp;
|
|
51
|
-
readonly url: string;
|
|
52
|
-
readonly port: number;
|
|
53
|
-
|
|
54
|
-
getSeenRequests(): Promise<CompletedRequest[]>;
|
|
55
|
-
stop(): Promise<void>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function awsActionsFromRequests(requests: CompletedRequest[]): string[] {
|
|
59
|
-
return [...new Set(requests
|
|
60
|
-
.map(req => req.body.buffer.toString('utf-8'))
|
|
61
|
-
.map(body => querystring.decode(body))
|
|
62
|
-
.map(x => x.Action as string)
|
|
63
|
-
.filter(action => action != null))];
|
|
64
|
-
}
|
package/lib/resource-pool.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { ILock, XpMutex, XpMutexPool } from './xpmutex';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A class that holds a pool of resources and gives them out and returns them on-demand
|
|
5
|
-
*
|
|
6
|
-
* The resources will be given out front to back, when they are returned
|
|
7
|
-
* the most recently returned version will be given out again (for best
|
|
8
|
-
* cache coherency).
|
|
9
|
-
*
|
|
10
|
-
* If there are multiple consumers waiting for a resource, consumers are serviced
|
|
11
|
-
* in FIFO order for most fairness.
|
|
12
|
-
*/
|
|
13
|
-
export class ResourcePool<A extends string=string> {
|
|
14
|
-
public static withResources<A extends string>(name: string, resources: A[]) {
|
|
15
|
-
const pool = XpMutexPool.fromName(name);
|
|
16
|
-
return new ResourcePool(pool, resources);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
private readonly resources: ReadonlyArray<A>;
|
|
20
|
-
private readonly mutexes: Record<string, XpMutex> = {};
|
|
21
|
-
private readonly locks: Record<string, ILock | undefined> = {};
|
|
22
|
-
|
|
23
|
-
private constructor(private readonly pool: XpMutexPool, resources: A[]) {
|
|
24
|
-
if (resources.length === 0) {
|
|
25
|
-
throw new Error('Must have at least one resource in the pool');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Shuffle to reduce contention
|
|
29
|
-
resources = [...resources];
|
|
30
|
-
fisherYatesShuffle(resources);
|
|
31
|
-
this.resources = resources;
|
|
32
|
-
|
|
33
|
-
for (const res of resources) {
|
|
34
|
-
this.mutexes[res] = this.pool.mutex(res);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Take one value from the resource pool
|
|
40
|
-
*
|
|
41
|
-
* If no such value is currently available, wait until it is.
|
|
42
|
-
*/
|
|
43
|
-
public async take(): Promise<ILease<A>> {
|
|
44
|
-
while (true) {
|
|
45
|
-
// Start a wait on the unlock now -- if the unlock signal comes after
|
|
46
|
-
// we try to acquire but before we start the wait, we might miss it.
|
|
47
|
-
//
|
|
48
|
-
// (The timeout is in case the unlock signal doesn't come for whatever reason).
|
|
49
|
-
const wait = this.pool.awaitUnlock(10_000);
|
|
50
|
-
|
|
51
|
-
// Try all mutexes, we might need to reacquire an expired lock
|
|
52
|
-
for (const res of this.resources) {
|
|
53
|
-
const lease = await this.tryObtainLease(res);
|
|
54
|
-
if (lease) {
|
|
55
|
-
// Ignore the wait (count as handled)
|
|
56
|
-
wait.then(() => {}, () => {});
|
|
57
|
-
return lease;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// None available, wait until one gets unlocked then try again
|
|
62
|
-
await wait;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Execute a block using a single resource from the pool
|
|
68
|
-
*/
|
|
69
|
-
public async using<B>(block: (x: A) => B | Promise<B>): Promise<B> {
|
|
70
|
-
const lease = await this.take();
|
|
71
|
-
try {
|
|
72
|
-
return await block(lease.value);
|
|
73
|
-
} finally {
|
|
74
|
-
await lease.dispose();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private async tryObtainLease(value: A) {
|
|
79
|
-
const lock = await this.mutexes[value].tryAcquire();
|
|
80
|
-
if (!lock) {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
this.locks[value] = lock;
|
|
85
|
-
return this.makeLease(value);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private makeLease(value: A): ILease<A> {
|
|
89
|
-
let disposed = false;
|
|
90
|
-
return {
|
|
91
|
-
value,
|
|
92
|
-
dispose: async () => {
|
|
93
|
-
if (disposed) {
|
|
94
|
-
throw new Error('Calling dispose() on an already-disposed lease.');
|
|
95
|
-
}
|
|
96
|
-
disposed = true;
|
|
97
|
-
return this.returnValue(value);
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* When a value is returned:
|
|
104
|
-
*
|
|
105
|
-
* - If someone's waiting for it, give it to them
|
|
106
|
-
* - Otherwise put it back into the pool
|
|
107
|
-
*/
|
|
108
|
-
private async returnValue(value: string) {
|
|
109
|
-
const lock = this.locks[value];
|
|
110
|
-
delete this.locks[value];
|
|
111
|
-
await lock?.release();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* A single value taken from the pool
|
|
117
|
-
*/
|
|
118
|
-
export interface ILease<A> {
|
|
119
|
-
/**
|
|
120
|
-
* The value obtained by the lease
|
|
121
|
-
*/
|
|
122
|
-
readonly value: A;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Return the leased value to the pool
|
|
126
|
-
*/
|
|
127
|
-
dispose(): Promise<void>;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Shuffle an array in-place
|
|
132
|
-
*/
|
|
133
|
-
function fisherYatesShuffle<A>(xs: A[]) {
|
|
134
|
-
for (let i = xs.length - 1; i >= 1; i--) {
|
|
135
|
-
const j = Math.floor(Math.random() * i);
|
|
136
|
-
const h = xs[j];
|
|
137
|
-
xs[j] = xs[i];
|
|
138
|
-
xs[i] = h;
|
|
139
|
-
}
|
|
140
|
-
}
|
package/lib/resources.ts
DELETED
package/lib/shell.ts
DELETED
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import * as child_process from 'child_process';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as os from 'os';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import { TestContext } from './integ-test';
|
|
6
|
-
import { Process } from './process';
|
|
7
|
-
import { TemporaryDirectoryContext } from './with-temporary-directory';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A shell command that does what you want
|
|
11
|
-
*
|
|
12
|
-
* Is platform-aware, handles errors nicely.
|
|
13
|
-
*/
|
|
14
|
-
export async function shell(command: string[], options: ShellOptions = {}): Promise<string> {
|
|
15
|
-
if (options.modEnv && options.env) {
|
|
16
|
-
throw new Error('Use either env or modEnv but not both');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const outputs = new Set(options.outputs);
|
|
20
|
-
const writeToOutputs = (x: string) => {
|
|
21
|
-
for (const outputStream of outputs) {
|
|
22
|
-
outputStream.write(x);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// Always output the command
|
|
27
|
-
writeToOutputs(`💻 ${command.join(' ')}\n`);
|
|
28
|
-
const show = options.show ?? 'always';
|
|
29
|
-
|
|
30
|
-
const env = options.env ?? (options.modEnv ? { ...process.env, ...options.modEnv } : process.env);
|
|
31
|
-
const tty = options.interact && options.interact.length > 0;
|
|
32
|
-
|
|
33
|
-
// Coerce to `any` because `ShellOptions` contains custom properties
|
|
34
|
-
// that don't exist in the underlying interfaces. We could either rebuild each options map,
|
|
35
|
-
// or just pass through and let the underlying implemenation ignore what it doesn't know about.
|
|
36
|
-
// We choose the lazy one.
|
|
37
|
-
const spawnOptions = { ...options, env } as any;
|
|
38
|
-
|
|
39
|
-
const child = tty
|
|
40
|
-
? Process.spawnTTY(command[0], command.slice(1), spawnOptions)
|
|
41
|
-
: Process.spawn(command[0], command.slice(1), spawnOptions)
|
|
42
|
-
|
|
43
|
-
// copy because we will be shifting it
|
|
44
|
-
const remainingInteractions = [...(options.interact ?? [])];
|
|
45
|
-
|
|
46
|
-
return new Promise<string>((resolve, reject) => {
|
|
47
|
-
const stdout = new Array<Buffer>();
|
|
48
|
-
const stderr = new Array<Buffer>();
|
|
49
|
-
|
|
50
|
-
const lastLine = new LastLine();
|
|
51
|
-
|
|
52
|
-
child.onStdout(chunk => {
|
|
53
|
-
if (show === 'always') {
|
|
54
|
-
writeToOutputs(chunk.toString('utf-8'));
|
|
55
|
-
}
|
|
56
|
-
stdout.push(chunk);
|
|
57
|
-
lastLine.append(chunk.toString('utf-8'));
|
|
58
|
-
|
|
59
|
-
const interaction = remainingInteractions[0];
|
|
60
|
-
if (interaction) {
|
|
61
|
-
|
|
62
|
-
if (interaction.prompt.test(lastLine.get())) {
|
|
63
|
-
|
|
64
|
-
// subprocess expects a user input now.
|
|
65
|
-
// first, shift the interactions to ensure the same interaction is not reused
|
|
66
|
-
remainingInteractions.shift();
|
|
67
|
-
|
|
68
|
-
// then, reset the last line to prevent repeated matches caused by tty echoing
|
|
69
|
-
lastLine.reset();
|
|
70
|
-
|
|
71
|
-
// now write the input with a slight delay to ensure
|
|
72
|
-
// the child process has already started reading.
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
child.writeStdin(interaction.input + (interaction.end ?? os.EOL));
|
|
75
|
-
}, 500);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
if (tty && options.captureStderr === false) {
|
|
83
|
-
// in a tty stderr goes to the same fd as stdout
|
|
84
|
-
throw new Error(`Cannot disable 'captureStderr' in tty`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (!tty) {
|
|
88
|
-
// in a tty stderr goes to the same fd as stdout, so onStdout
|
|
89
|
-
// is sufficient.
|
|
90
|
-
child.onStderr(chunk => {
|
|
91
|
-
if (show === 'always') {
|
|
92
|
-
writeToOutputs(chunk.toString('utf-8'));
|
|
93
|
-
}
|
|
94
|
-
if (options.captureStderr ?? true) {
|
|
95
|
-
stderr.push(chunk);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
child.onError(reject);
|
|
101
|
-
|
|
102
|
-
child.onExit(code => {
|
|
103
|
-
const stderrOutput = Buffer.concat(stderr).toString('utf-8');
|
|
104
|
-
const stdoutOutput = Buffer.concat(stdout).toString('utf-8');
|
|
105
|
-
const out = (options.onlyStderr ? stderrOutput : stdoutOutput + stderrOutput).trim();
|
|
106
|
-
|
|
107
|
-
const logAndreject = (error: Error) => {
|
|
108
|
-
if (show === 'error') {
|
|
109
|
-
writeToOutputs(`${out}\n`);
|
|
110
|
-
}
|
|
111
|
-
reject(error);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (remainingInteractions.length !== 0) {
|
|
115
|
-
// regardless of the exit code, if we didn't consume all expected interactions we probably
|
|
116
|
-
// did somethiing wrong.
|
|
117
|
-
logAndreject(new Error(`Expected more user interactions but subprocess exited with ${code}`));
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (code === 0 || options.allowErrExit) {
|
|
122
|
-
resolve(out);
|
|
123
|
-
} else {
|
|
124
|
-
logAndreject(new Error(`'${command.join(' ')}' exited with error code ${code}.`));
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Models a single user interaction with the shell.
|
|
132
|
-
*/
|
|
133
|
-
export interface UserInteraction {
|
|
134
|
-
/**
|
|
135
|
-
* The prompt to expect. Regex matched against the last line in
|
|
136
|
-
* the output before the prompt is displayed.
|
|
137
|
-
*
|
|
138
|
-
* Most commonly this would be a simple string to match for inclusion.
|
|
139
|
-
*
|
|
140
|
-
* Examples:
|
|
141
|
-
*
|
|
142
|
-
* - Process Output: "Hey there! Are you sure?"
|
|
143
|
-
* Prompt: /Are you sure?/
|
|
144
|
-
* Match (Yes/No): Yes
|
|
145
|
-
* Reason: "Hey there! Are you sure?" ~ /Are you sure?/
|
|
146
|
-
*
|
|
147
|
-
* - Process Output: "Hey there!\nAre you sure?"
|
|
148
|
-
* Prompt: /Are you sure?/
|
|
149
|
-
* Match (Yes/No): Yes
|
|
150
|
-
* Reason: "Are you sure?" ~ /Are you sure?/
|
|
151
|
-
*
|
|
152
|
-
* - Process Output: "Are you sure?\n(remember this is destructive)"
|
|
153
|
-
* Prompt: /Are you sure?/
|
|
154
|
-
* Match (Yes/No): No
|
|
155
|
-
* Reason: "(remember this is destructive)" ≄ /Are you sure?/
|
|
156
|
-
*
|
|
157
|
-
* - Process Output: "Are you sure?\n(remember this is destructive)"
|
|
158
|
-
* Prompt: /remember this is destructive/
|
|
159
|
-
* Match (Yes/No): Yes
|
|
160
|
-
* Reason: "(remember this is destructive)" ~ /remember this is destructive/
|
|
161
|
-
*
|
|
162
|
-
*/
|
|
163
|
-
readonly prompt: RegExp;
|
|
164
|
-
/**
|
|
165
|
-
* The input to provide.
|
|
166
|
-
*/
|
|
167
|
-
readonly input: string;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* The string to signal the end of input.
|
|
171
|
-
*
|
|
172
|
-
* @default os.EOL
|
|
173
|
-
*/
|
|
174
|
-
readonly end?: string;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export interface ShellOptions extends child_process.SpawnOptions {
|
|
178
|
-
/**
|
|
179
|
-
* Properties to add to 'env'
|
|
180
|
-
*/
|
|
181
|
-
readonly modEnv?: Record<string, string | undefined>;
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Don't fail when exiting with an error
|
|
185
|
-
*
|
|
186
|
-
* @default false
|
|
187
|
-
*/
|
|
188
|
-
readonly allowErrExit?: boolean;
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Whether to capture stderr
|
|
192
|
-
*
|
|
193
|
-
* @default true
|
|
194
|
-
*/
|
|
195
|
-
readonly captureStderr?: boolean;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Pass output here
|
|
199
|
-
*/
|
|
200
|
-
readonly outputs?: NodeJS.WritableStream[];
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Only return stderr. For example, this is used to validate
|
|
204
|
-
* that when CI=true, all logs are sent to stdout.
|
|
205
|
-
*
|
|
206
|
-
* @default false
|
|
207
|
-
*/
|
|
208
|
-
readonly onlyStderr?: boolean;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Don't log to stdout
|
|
212
|
-
*
|
|
213
|
-
* @default always
|
|
214
|
-
*/
|
|
215
|
-
readonly show?: 'always' | 'never' | 'error';
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Provide user interaction to respond to shell prompts.
|
|
219
|
-
*
|
|
220
|
-
* Order and count should correspond to the expected prompts issued by the subprocess.
|
|
221
|
-
*/
|
|
222
|
-
readonly interact?: UserInteraction[];
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export class ShellHelper {
|
|
227
|
-
public static fromContext(context: TestContext & TemporaryDirectoryContext) {
|
|
228
|
-
return new ShellHelper(context.integTestDir, context.output);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
constructor(
|
|
232
|
-
private readonly _cwd: string,
|
|
233
|
-
private readonly _output: NodeJS.WritableStream) { }
|
|
234
|
-
|
|
235
|
-
public async shell(command: string[], options: Omit<ShellOptions, 'cwd' | 'outputs'> = {}): Promise<string> {
|
|
236
|
-
return shell(command, {
|
|
237
|
-
outputs: [this._output],
|
|
238
|
-
cwd: this._cwd,
|
|
239
|
-
...options,
|
|
240
|
-
modEnv: {
|
|
241
|
-
// give every shell its own docker config directory
|
|
242
|
-
// so that parallel runs don't interfere with each other.
|
|
243
|
-
DOCKER_CONFIG: path.join(this._cwd, '.docker'),
|
|
244
|
-
...options.modEnv,
|
|
245
|
-
},
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* rm -rf reimplementation, don't want to depend on an NPM package for this
|
|
252
|
-
*
|
|
253
|
-
* Returns `true` if everything got deleted, or `false` if some files could
|
|
254
|
-
* not be deleted due to permissions issues.
|
|
255
|
-
*/
|
|
256
|
-
export function rimraf(fsPath: string): boolean {
|
|
257
|
-
try {
|
|
258
|
-
let success = true;
|
|
259
|
-
const isDir = fs.lstatSync(fsPath).isDirectory();
|
|
260
|
-
|
|
261
|
-
if (isDir) {
|
|
262
|
-
for (const file of fs.readdirSync(fsPath)) {
|
|
263
|
-
success &&= rimraf(path.join(fsPath, file));
|
|
264
|
-
}
|
|
265
|
-
fs.rmdirSync(fsPath);
|
|
266
|
-
} else {
|
|
267
|
-
fs.unlinkSync(fsPath);
|
|
268
|
-
}
|
|
269
|
-
return success;
|
|
270
|
-
} catch (e: any) {
|
|
271
|
-
// Can happen if some files got generated inside a Docker container and are now inadvertently owned by `root`.
|
|
272
|
-
// We can't ever clean those up anymore, but since it only happens inside GitHub Actions containers we also don't care too much.
|
|
273
|
-
if (e.code === 'EACCES' || e.code === 'ENOTEMPTY') { return false; }
|
|
274
|
-
|
|
275
|
-
// Already gone
|
|
276
|
-
if (e.code === 'ENOENT') { return true; }
|
|
277
|
-
|
|
278
|
-
throw e;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export function addToShellPath(x: string) {
|
|
283
|
-
const parts = process.env.PATH?.split(':') ?? [];
|
|
284
|
-
|
|
285
|
-
if (!parts.includes(x)) {
|
|
286
|
-
parts.unshift(x);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
process.env.PATH = parts.join(':');
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Accumulate text since the last line break (or beginning of string) it has seen in the chunks.
|
|
294
|
-
*
|
|
295
|
-
* Examples:
|
|
296
|
-
*
|
|
297
|
-
* - Chunks: ['one\n', 'two\n', three']
|
|
298
|
-
* - Last Line: 'three'
|
|
299
|
-
*
|
|
300
|
-
* - Chunks: ['one', 'two', '\nthree']
|
|
301
|
-
* - Last Line: 'three'
|
|
302
|
-
*
|
|
303
|
-
* - Chunks: ['one', 'two']
|
|
304
|
-
* - Last Line: 'onetwo'
|
|
305
|
-
*
|
|
306
|
-
* - Chunks: ['one', 'two', '\nthree', 'four']
|
|
307
|
-
* - Last Line: 'threefour'
|
|
308
|
-
*/
|
|
309
|
-
class LastLine {
|
|
310
|
-
|
|
311
|
-
private lastLine: string = '';
|
|
312
|
-
|
|
313
|
-
public append(chunk: string): void {
|
|
314
|
-
const lines = chunk.split(os.EOL);
|
|
315
|
-
if (lines.length === 1) {
|
|
316
|
-
// chunk doesn't contain a new line so just append
|
|
317
|
-
this.lastLine += lines[0];
|
|
318
|
-
} else {
|
|
319
|
-
// chunk contains multiple lines so just override with the last one
|
|
320
|
-
this.lastLine = lines[lines.length - 1];
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
public get(): string {
|
|
325
|
-
return this.lastLine;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
public reset() {
|
|
329
|
-
this.lastLine = '';
|
|
330
|
-
}
|
|
331
|
-
}
|