GoogleCloudPlatform / cloud-run-anthos-reference-web-app

An opinionated set of best practices aimed at demonstrating a reference architecture for building a web application on Google Cloud using Cloud Run for Anthos.
https://cloud.google.com/anthos/run
Apache License 2.0
37 stars 22 forks source link

Add Firestore Backend Tests #3

Closed josueetcom closed 4 years ago

josueetcom commented 4 years ago

There's actually a few things going on in this PR:

Extracting the tests into a separate testing interface is the source of the huge diff. Most of the code in backend_tester.go is really derived from backend_memory_test.go. However, the presence of a totally different backend_memory_test.go file makes it difficult to showcase this on GitHub. To better view these differences I suggest checking running this command (you may need to fetch/pull first):

git diff master:backend/src/go/backend_memory_test.go firestore-backend-tests:backend/src/go/backend_tester.go

One note: TestFSNewInventoryTransaction needs to be skipped for now as the emulator returns an unknown error when querying the "inventories" collection that doesn't occur in practice

josueetcom commented 4 years ago

Regarding @ssmall 's comment. I agree I would've preferred for it to be self contained. I originally wrote the tests that way but was unable to run gcloud beta emulators firestore start from any of the Cloud SDK container images so I had to do this instead :/