Corona
Corona copied to clipboard
RFE: State and database clear for unit testing
Request from Clark. He'd like a way to clear the full Corona state to better support unit testing.
Perhaps you should be able to clear each managed item (places, namespaces, etc) as well as clear them all.
We should probably support clearing the database too. (What about non-Corona data in the database?)
Regarding clearing the database…
Currently a developer can clear out the database with a simple structured query: DELETE /store?structuredQuery={"boolean": true}&bulkDelete=true. I think this is an appropriate way for them to clear the database. However, perhaps an admin should be able to perform a database clear. Currently, doing so would have the side effect of blowing away all of the transformers as well (perhaps these should move into the modules database… not sure).
So for the time being, I'd like to say that one way to delete all of the documents is enough. If there is disagreement, feel free to open this RFE again or file a new one.
Three reasons why I'm reopening:
- Deleting by query will be much slower than performing a simple database clear, and will keep performance slow for a while after the delete as the deleted fragments have to be merged away.
- When performance testing you'll often want to start with an empty database. Deleting by query doesn't do that.
- The solution isn't very obvious. :)
Also I want to be able to delete the settings such as the indexes and the namespaces. I'm hitting this issue right now in unit testing where in order to do a proper test of the namespaces configuration utility I first have to get a list of all configured namespaces from the server, then loop through that list and ask the server to delete each individual namespace. THEN I can actually start to test the namespace addition functionality.
Actually the ability to delete all of the configuration in one call is currently implemented, just not documented. Here's some very quick documentation:
Delete all namespaces: DELETE /manage/namespaces Delete all places: DELETE /manage/places (including the anonymous place) Delete all ranges: DELETE /manage/ranges Delete all bucketed ranges: DELETE /manage/bucketedranges Delete all geo indexes: DELETE /manage/geospatials Delete all transformers DELETE /manage/transformers Delete all of the above: DELETE /manage