Google Datastore Emulator - Spring Boot - Start Emulator In-Memory

Viewed 256

I have a Spring App that I am boot running with the following local properties to set up a GCP Datastore Emulator:

spring.cloud.gcp.datastore.emulator.enabled=true
spring.cloud.gcp.datastore.host=localhost:8081

The application boots and connects to the datastore emulator as expected, and I am able to read/write with no problem. However, when I try to clear the database by sending a POST request to http://localhost:8081/reset an error occurs:

" Cannot reset a Datastore Emulator when it is storing data on disk. Re-run the emulator with the --testing flag to start the emulator in-memory."

ok, great, I want to run in-memory locally anyway but cannot find a spring.cloud.gcp.datastore property that will configure this for me, i.e., set the --testing flag. Searching around, I see many people start up the emulator and set their arguments using gcloud commands but I'm hoping there is a property setting to do this.

For integration testing I was able configure the in memory setting using the localdatastorehelper LocalDatastoreHelper.newBuilder().setStoreOnDisk(false) but I am hoping there is a better/easier way to do this when starting up the application.

0 Answers
Related