Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update teardown to only delete newly created test tables #190

Merged
merged 1 commit into from
Feb 6, 2023

Conversation

dustinsgoodman
Copy link
Contributor

#95 highlights a problem with using this library. If you are using the sharedDb flag on a dynamodb-local instance, it clears the entire database as part of teardown. In my case, I was using stages to separate database tables by environment but the teardown here is indiscriminate and deletes everything. As a developer writing tests, I only want this tool to delete the tables it creates and leave other deletion to the implementor to decide as described in the discussion of #55. This PR makes the following changes:

  • update setup and teardown to only attempt deletion of tables created by setup
  • refactor getConfig and deleteTables to new utils
  • add getRelevantTables util
  • refactor setup to use new utils

Closes #95

- refactor getConfig and deleteTables to new utils
- add getRelevantTables util
- refactor setup to use new utils
- update setup and teardown to only attempt deletion of tables created by setup
@dustinsgoodman
Copy link
Contributor Author

@vladgolubev you look like an active maintainer - Is any interest in this change?

@vladholubiev
Copy link
Member

@dustinsgoodman yeap, interested, let me review! thanks for pinging me, somehow I missed the original notification

@vladholubiev vladholubiev merged commit 80ad270 into shelfio:master Feb 6, 2023
@vladholubiev
Copy link
Member

@dustinsgoodman published in https://github.com/shelfio/jest-dynamodb/releases/tag/v3.4.0!

@dustinsgoodman dustinsgoodman deleted the only-teardown-setup branch February 6, 2023 18:08
@dustinsgoodman
Copy link
Contributor Author

Amazing! Thanks so much @vladgolubev!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Why deleting all tables in dynamodb?
2 participants