From 656bf4db02e66ec96fd380c2556431f90d92af15 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Sat, 3 Sep 2016 12:40:20 -0700 Subject: [PATCH] Updating emulator script for non-legacy datastore emulator. - 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 --- CONTRIBUTING.rst | 3 ++- system_tests/run_emulator.py | 13 ++++++++++--- tox.ini | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 37686c3ad620..b4a9f92fd98a 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -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 diff --git a/system_tests/run_emulator.py b/system_tests/run_emulator.py index 5d946a1aac83..2a1e5d41a53b 100644 --- a/system_tests/run_emulator.py +++ b/system_tests/run_emulator.py @@ -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 ' @@ -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): @@ -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): diff --git a/tox.ini b/tox.ini index 5128f7160987..01e473331b59 100644 --- a/tox.ini +++ b/tox.ini @@ -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