Skip to content

Commit

Permalink
chore: cleanup custom resource handler files (#30887)
Browse files Browse the repository at this point in the history
This PR cleans up the files created in a temp folder when the custom resource handlers are generated. 

While using a temp folder removes these files on restart, most people aren't typically in the habit of regular restarts. We are now in a position where running our integ tests and/or unit tests will cause my machine to run out of space. This is one of several PRs to fix this. This may seem like a tiny change to PR on it's own when I've just said that there will be several, but I'm intentionally keeping them small and separate. There is some behavior in our tests that I don't quite understand so small incremental change will help isolate this better.

There are no tests to add here but I have run the entire test suite locally from a clean workspace after making this change. 

### Checklist
- [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
TheRealAmazonKendra authored Jul 18, 2024
1 parent bbf1ad4 commit 726a3be
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ export abstract class CustomResourceProviderBase extends Construct {

this._codeHash = staging.assetHash;

fs.rmSync(stagingDirectory, { recursive: true, force: true });

return {
code: {
S3Bucket: asset.bucketName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ describe('custom resource provider', () => {
const keyParam = paramNames[1];
const hashParam = paramNames[2];

expect(fs.existsSync(path.join(sourcePath, '__entrypoint__.js'))).toEqual(true);

expect(cfn).toEqual({
Resources: {
CustomMyResourceTypeCustomResourceProviderRoleBD5E655F: {
Expand Down

0 comments on commit 726a3be

Please sign in to comment.