Datastore Emulatorのエンドポイント
Cloud Datastore エミュレータは起動した後、gcloudコマンドではなくREST APIを使って操作するらしい。
が、そのあたりの情報が全然まとまっていなかったので本体の中をチラ見して必要そうなところを調べてみた。
cloud-datastore-emulator 2.1.0
| Method | Path | Description |
|---|---|---|
| GET | / | OKを返すだけ |
| POST | /reset | データをリセットする*1 |
| POST | /persist | データを永続化する*2 |
| POST | /shutdown | datastore emulatorを落とす |
| POST | /_ah/admin/datastore | /reset と同じ |
| POST | /_ah/admin/quit | /shutdownと同じ |
ユニットテストで使う際は--no-store-on-diskをつけて起動し、
- テストケースごとに
POST /reset - テストが終わったら
POST /shutdown
すると良さそう。