I'm not sure if this is the right place for such a question, but I'm having a difficult time finding an official support channel for the Cloud Datastore Emulator.
I'm working on migrating a Python 2 App Engine app from NDB to Cloud NDB as a precursor to migrating to Python 3. Per recommendations elsewhere, I've been replacing my usage of Testbed with the local Datastore Emulator, and for the most part that's been working out. What I'm running into is an error that starts popping up about halfway through the 580 unit tests in our test suite. The error message would seem to suggest that the emulator isn't capable of keeping up with the rapidfire reset requests coming from the test setUp() method.
All of my tests derive from a base class with the following setUp() method:
NDB_CLIENT = ndb.Client(project='myproject')
NDB_CLIENT.host = 'localhost:8089'
NDB_CLIENT.secure = False
class MyTestCase(unittest.TestCase):
def setUp(self):
self.testapp = webapp2.WSGIApplication([])
# clear datastore
requests.post('http://localhost:8089/reset')
self.ndb_context = NDB_CLIENT.context()
self.ndb_context.__enter__()
I'm running the Cloud Datastore in a terminal window with the following command:
$ gcloud beta emulators datastore start --no-store-on-disk --consistency=1.0 --host-port=localhost:8089
About halfway through the test suite, the tests begin failing with this error:
ERROR: test_a_thing (my_test.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/my_test.py", line 11, in setUp
File "/Users/myuser/Projects/MyProject/test/_base_test.py", line 29, in setUp
File "/Users/myuser/Projects/MyProject/lib/requests/api.py", line 119, in post
File "/Users/myuser/Projects/MyProject/lib/requests/api.py", line 61, in request
File "/Users/myuser/Projects/MyProject/lib/requests/sessions.py", line 530, in request
File "/Users/myuser/Projects/MyProject/lib/requests/sessions.py", line 643, in send
File "/Users/myuser/Projects/MyProject/lib/requests/adapters.py", line 516, in send
ConnectionError: HTTPConnectionPool(host='localhost', port=8089): Max retries exceeded with url: /reset (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x113715610>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))
If I run any of these test files by themselves, they all pass. Does anyone have any suggestions on how I could troubleshoot or improve this?