Skip to content

Commit

Permalink
Updating emulator script for non-legacy datastore emulator.
Browse files Browse the repository at this point in the history
- Adding "--no-legacy" flag to "gcloud" CLI calls
- Updating instructions in CONTRIBUTING document to showcase
  the flag and the GCLOUD_DISABLE_GRPC env. var.
- Updating the datastore ready line for the server from
  the cloud-datastore-emulator (i.e. "--no-legacy") component,
  since it is different from the "gcd-emulator" component
  • Loading branch information
dhermes committed Sep 7, 2016
1 parent 0cc6079 commit 656bf4d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,14 @@ Running System Tests
``datastore`` emulator::

$ tox -e datastore-emulator
$ GOOGLE_CLOUD_DISABLE_GRPC=true tox -e datastore-emulator

This also requires that the ``gcloud`` command line tool is
installed. If you'd like to run them directly (outside of a
``tox`` environment), first start the emulator and
take note of the process ID::

$ gcloud beta emulators datastore start 2>&1 > log.txt &
$ gcloud beta emulators datastore start --no-legacy 2>&1 > log.txt &
[1] 33333

then determine the environment variables needed to interact with
Expand Down
13 changes: 10 additions & 3 deletions system_tests/run_emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
'datastore': (GCD_DATASET, GCD_HOST),
'pubsub': (PUBSUB_EMULATOR,)
}
_DS_READY_LINE = '[datastore] INFO: Dev App Server is now running\n'
EXTRA = {
'datastore': ('--no-legacy',),
}
_DS_READY_LINE = '[datastore] Dev App Server is now running.\n'
_PS_READY_LINE_PREFIX = '[pubsub] INFO: Server started, listening on '


Expand All @@ -62,7 +65,9 @@ def get_start_command(package):
:rtype: tuple
:returns: The arguments to be used, in a tuple.
"""
return 'gcloud', 'beta', 'emulators', package, 'start'
result = ('gcloud', 'beta', 'emulators', package, 'start')
extra = EXTRA.get(package, ())
return result + extra


def get_env_init_command(package):
Expand All @@ -74,7 +79,9 @@ def get_env_init_command(package):
:rtype: tuple
:returns: The arguments to be used, in a tuple.
"""
return 'gcloud', 'beta', 'emulators', package, 'env-init'
result = ('gcloud', 'beta', 'emulators', package, 'env-init')
extra = EXTRA.get(package, ())
return result + extra


def datastore_wait_ready(popen):
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ commands =
python {toxinidir}/system_tests/run_emulator.py --package=datastore
setenv =
GOOGLE_CLOUD_NO_PRINT=true
passenv =
GOOGLE_CLOUD_DISABLE_GRPC
deps =
{[testenv]deps}
psutil
Expand Down

0 comments on commit 656bf4d

Please sign in to comment.