#community-help

Truncating Typesense Instance for Testing Purposes

TLDR Emma inquired about an easier way to truncate a Typesense instance for testing. Jason suggested stopping the process, deleting contents in the data-dir, and restarting, but confirmed no specific API exists for this task.

Powered by Struct AI

1

5
4mo
Solved
Join the chat
Jun 01, 2023 (4 months ago)
Emma
Photo of md5-01ff2c7cb764a071332074d6e85db0c5
Emma
10:40 PM
Is there an easier way to truncate a whole typesense instance between tests than iterating collections and aliases? Or any better way to isolate the tests?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
10:41 PM
If you’re running Typesense in CI, you could stop the process, delete the contents of the data-dir and restart the process
Emma
Photo of md5-01ff2c7cb764a071332074d6e85db0c5
Emma
10:42 PM
Hmm, I think that would be slower and harder… I'm basically trying to find an equivalent to what we do against our postgres db for tests: create a transaction and then rollback 😅

1

10:43
Emma
10:43 PM
For now I've just been iterating the aliases and collections and deleting them after each test, which works, I just hoped there might be an API command to just nuke the whole db
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
10:44 PM
There isn’t an API like that at the moment