From 9aeedd3344bd36c3e92d50527f978464253eeacc Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Wed, 2 Nov 2016 19:59:18 -0700 Subject: [PATCH 01/13] Run google-cloud-python system tests against new runtime images. --- system_tests/.gitignore | 2 ++ system_tests/Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ system_tests/Makefile | 7 +++++++ 3 files changed, 49 insertions(+) create mode 100644 system_tests/.gitignore create mode 100644 system_tests/Dockerfile create mode 100644 system_tests/Makefile diff --git a/system_tests/.gitignore b/system_tests/.gitignore new file mode 100644 index 00000000..457b0368 --- /dev/null +++ b/system_tests/.gitignore @@ -0,0 +1,2 @@ +data/ +secrets.tar \ No newline at end of file diff --git a/system_tests/Dockerfile b/system_tests/Dockerfile new file mode 100644 index 00000000..8e9ad3ff --- /dev/null +++ b/system_tests/Dockerfile @@ -0,0 +1,40 @@ +FROM google/python + +# Inject secrets +# TODO: Encrypt/decrypt secrets +ADD data/ data/ +ENV GOOGLE_APPLICATION_CREDENTIALS /home/vmagent/app/data/cloud-python-runtime-qa-credentials.json + +# Get the source. +RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-python.git +WORKDIR google-cloud-python + +# Checkout the latest release. +RUN git checkout $(git describe --tags --abbrev 0) + +# Install gcloud so we can do test setup +RUN apt-get update && apt-get install curl +RUN curl https://sdk.cloud.google.com | bash +ENV PATH ${PATH}:/root/google-cloud-sdk/bin + +# System test setup as per google-cloud-python/CONTRIBUTING.rst +RUN gcloud config set project cloud-python-runtime-qa +RUN gcloud components install app-engine-python +RUN gcloud auth activate-service-account \ + --key-file=${GOOGLE_APPLICATION_CREDENTIALS} +RUN gcloud preview datastore create-indexes system_tests/data/index.yaml +# TODO: python system_tests/clear_datastore.py +# TODO: python system_tests/populate_datastore.py + +# Install tox for running the system tests +RUN pip install --upgrade tox + +# List of system tests to run. Ideally would be all of them. But +# some of them get permission or other errors that are probably +# related to incomplete test setup. +ENV MODULES="datastore storage speech bigquery pubsub language bigtable" + +# Run Python 2.7, 3.4 system tests +# TODO(https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2670) +RUN GOOGLE_CLOUD_TESTS_API_KEY=$(cat /home/vmagent/app/data/cloud-python-runtime-qa-api-key.txt) \ + tox -e system-tests,system-tests3 -- ${MODULES} diff --git a/system_tests/Makefile b/system_tests/Makefile new file mode 100644 index 00000000..4dbde7d1 --- /dev/null +++ b/system_tests/Makefile @@ -0,0 +1,7 @@ +# Use no-cache to prevent layer caching because there is a layer that does +# a `git clone` which can not be cached. +CACHE ?= --no-cache + +.PHONY: all +all: + docker build $(CACHE) . From 3b2abef4a943abd11f1f628404a62f69d5bef7d9 Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 13:01:41 -0700 Subject: [PATCH 02/13] Add missing newline --- system_tests/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system_tests/.gitignore b/system_tests/.gitignore index 457b0368..2fc08f4d 100644 --- a/system_tests/.gitignore +++ b/system_tests/.gitignore @@ -1,2 +1,2 @@ data/ -secrets.tar \ No newline at end of file +secrets.tar From e3a7cf856971a43526063bd34d011a00e0b25a6a Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 13:03:31 -0700 Subject: [PATCH 03/13] Ignore Emacs autosave files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..21adbdb4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Editor +*~ +\#*\# From 87db4d3a483b6f3eff4c6a27fd57da41435ff3b4 Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 13:06:26 -0700 Subject: [PATCH 04/13] Shorten paths (/home/vmagent/app is symlinked to /app) --- system_tests/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system_tests/Dockerfile b/system_tests/Dockerfile index 8e9ad3ff..4ffc08a3 100644 --- a/system_tests/Dockerfile +++ b/system_tests/Dockerfile @@ -3,7 +3,7 @@ FROM google/python # Inject secrets # TODO: Encrypt/decrypt secrets ADD data/ data/ -ENV GOOGLE_APPLICATION_CREDENTIALS /home/vmagent/app/data/cloud-python-runtime-qa-credentials.json +ENV GOOGLE_APPLICATION_CREDENTIALS /app/data/cloud-python-runtime-qa-credentials.json # Get the source. RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-python.git @@ -36,5 +36,5 @@ ENV MODULES="datastore storage speech bigquery pubsub language bigtable" # Run Python 2.7, 3.4 system tests # TODO(https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2670) -RUN GOOGLE_CLOUD_TESTS_API_KEY=$(cat /home/vmagent/app/data/cloud-python-runtime-qa-api-key.txt) \ +RUN GOOGLE_CLOUD_TESTS_API_KEY=$(cat /app/data/cloud-python-runtime-qa-api-key.txt) \ tox -e system-tests,system-tests3 -- ${MODULES} From c0933d0d75b5f5e7caf26851e28747bea73d8cf5 Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 13:07:04 -0700 Subject: [PATCH 05/13] Add top-level system-tests target --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 7cd94ca7..ef3ff347 100644 --- a/Makefile +++ b/Makefile @@ -25,3 +25,7 @@ tests: .PHONY: benchmarks benchmarks: make -C tests benchmarks + +.PHONY: system-tests +system-tests: + make -C system_tests From 5439e04db2fc33adb32b92f9d1bb045c623b9a9a Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 13:31:06 -0700 Subject: [PATCH 06/13] Fix "checkout latest release", then disable it to always checkout head. Previous code was always checking out head because of missing --abbrev flag. Once I added --abbrev, I found out the latest release, 0.20, is missing some things we need. We can reenable this when 0.21+ is released. --- system_tests/Dockerfile | 3 ++- tests/google-cloud-python/Dockerfile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/system_tests/Dockerfile b/system_tests/Dockerfile index 4ffc08a3..77bce574 100644 --- a/system_tests/Dockerfile +++ b/system_tests/Dockerfile @@ -10,7 +10,8 @@ RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-python.git WORKDIR google-cloud-python # Checkout the latest release. -RUN git checkout $(git describe --tags --abbrev 0) +# TODO: Enable once the latest release works +#RUN git checkout $(git describe --tags --abbrev=0) # Install gcloud so we can do test setup RUN apt-get update && apt-get install curl diff --git a/tests/google-cloud-python/Dockerfile b/tests/google-cloud-python/Dockerfile index 06a2c004..7fb6936c 100644 --- a/tests/google-cloud-python/Dockerfile +++ b/tests/google-cloud-python/Dockerfile @@ -8,7 +8,8 @@ RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-python.git WORKDIR google-cloud-python # Checkout the latest release. -RUN git checkout $(git describe --tags) +# TODO: Enable once run_unit_tests.py is released +#RUN git checkout $(git describe --tags --abbrev=0) # Run Python 2.7 unit tests RUN python2.7 scripts/run_unit_tests.py From 29c73aa1a6249d0e5f2efa76d5d0d9745c4abda4 Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 14:13:10 -0700 Subject: [PATCH 07/13] Enable system tests that work now. Currently, everything but 'logging' works. See: https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2669 --- system_tests/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system_tests/Dockerfile b/system_tests/Dockerfile index 77bce574..ac1f427d 100644 --- a/system_tests/Dockerfile +++ b/system_tests/Dockerfile @@ -33,7 +33,7 @@ RUN pip install --upgrade tox # List of system tests to run. Ideally would be all of them. But # some of them get permission or other errors that are probably # related to incomplete test setup. -ENV MODULES="datastore storage speech bigquery pubsub language bigtable" +ENV MODULES="datastore storage speech bigquery pubsub language translate monitoring bigtable" # Run Python 2.7, 3.4 system tests # TODO(https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2670) From 6960bb4a694b71563c8956288b3f7c0a00595e6b Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 14:23:22 -0700 Subject: [PATCH 08/13] Revert "Ignore Emacs autosave files" This reverts commit e3a7cf856971a43526063bd34d011a00e0b25a6a. --- .gitignore | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 21adbdb4..00000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Editor -*~ -\#*\# From 2e6f7041fb2c591b927619e82c5321cfb5834617 Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 14:49:31 -0700 Subject: [PATCH 09/13] Use google-cloud-python from head, not the released version. See https://github.com/GoogleCloudPlatform/python-runtime/issues/41 --- system_tests/Dockerfile | 4 ---- tests/google-cloud-python/Dockerfile | 4 ---- 2 files changed, 8 deletions(-) diff --git a/system_tests/Dockerfile b/system_tests/Dockerfile index ac1f427d..1edfc50c 100644 --- a/system_tests/Dockerfile +++ b/system_tests/Dockerfile @@ -9,10 +9,6 @@ ENV GOOGLE_APPLICATION_CREDENTIALS /app/data/cloud-python-runtime-qa-credentials RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-python.git WORKDIR google-cloud-python -# Checkout the latest release. -# TODO: Enable once the latest release works -#RUN git checkout $(git describe --tags --abbrev=0) - # Install gcloud so we can do test setup RUN apt-get update && apt-get install curl RUN curl https://sdk.cloud.google.com | bash diff --git a/tests/google-cloud-python/Dockerfile b/tests/google-cloud-python/Dockerfile index 7fb6936c..ade8d818 100644 --- a/tests/google-cloud-python/Dockerfile +++ b/tests/google-cloud-python/Dockerfile @@ -7,10 +7,6 @@ RUN pip install --upgrade tox RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-python.git WORKDIR google-cloud-python -# Checkout the latest release. -# TODO: Enable once run_unit_tests.py is released -#RUN git checkout $(git describe --tags --abbrev=0) - # Run Python 2.7 unit tests RUN python2.7 scripts/run_unit_tests.py From d24cb129c88aaafde817394d5284045d492d3b4a Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 15:09:55 -0700 Subject: [PATCH 10/13] Don't install or use the Google Cloud SDK for system tests. Test setup will be handled elsewhere. --- system_tests/Dockerfile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/system_tests/Dockerfile b/system_tests/Dockerfile index 1edfc50c..75a0830b 100644 --- a/system_tests/Dockerfile +++ b/system_tests/Dockerfile @@ -4,22 +4,23 @@ FROM google/python # TODO: Encrypt/decrypt secrets ADD data/ data/ ENV GOOGLE_APPLICATION_CREDENTIALS /app/data/cloud-python-runtime-qa-credentials.json +ENV GCLOUD_PROJECT cloud-python-runtime-qa # Get the source. RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-python.git WORKDIR google-cloud-python # Install gcloud so we can do test setup -RUN apt-get update && apt-get install curl -RUN curl https://sdk.cloud.google.com | bash -ENV PATH ${PATH}:/root/google-cloud-sdk/bin +#RUN apt-get update && apt-get install curl +#RUN curl https://sdk.cloud.google.com | bash +#ENV PATH ${PATH}:/root/google-cloud-sdk/bin # System test setup as per google-cloud-python/CONTRIBUTING.rst -RUN gcloud config set project cloud-python-runtime-qa -RUN gcloud components install app-engine-python -RUN gcloud auth activate-service-account \ - --key-file=${GOOGLE_APPLICATION_CREDENTIALS} -RUN gcloud preview datastore create-indexes system_tests/data/index.yaml +#RUN gcloud config set project cloud-python-runtime-qa +#RUN gcloud components install app-engine-python +#RUN gcloud auth activate-service-account \ +# --key-file=${GOOGLE_APPLICATION_CREDENTIALS} +# RUN gcloud preview datastore create-indexes system_tests/data/index.yaml # TODO: python system_tests/clear_datastore.py # TODO: python system_tests/populate_datastore.py From d108c5aba6411fc697f1d9965bf3acfc9cdd4ebc Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 15:18:54 -0700 Subject: [PATCH 11/13] Remove cruft --- system_tests/Dockerfile | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/system_tests/Dockerfile b/system_tests/Dockerfile index 75a0830b..64c69717 100644 --- a/system_tests/Dockerfile +++ b/system_tests/Dockerfile @@ -10,20 +10,6 @@ ENV GCLOUD_PROJECT cloud-python-runtime-qa RUN git clone https://github.com/GoogleCloudPlatform/google-cloud-python.git WORKDIR google-cloud-python -# Install gcloud so we can do test setup -#RUN apt-get update && apt-get install curl -#RUN curl https://sdk.cloud.google.com | bash -#ENV PATH ${PATH}:/root/google-cloud-sdk/bin - -# System test setup as per google-cloud-python/CONTRIBUTING.rst -#RUN gcloud config set project cloud-python-runtime-qa -#RUN gcloud components install app-engine-python -#RUN gcloud auth activate-service-account \ -# --key-file=${GOOGLE_APPLICATION_CREDENTIALS} -# RUN gcloud preview datastore create-indexes system_tests/data/index.yaml -# TODO: python system_tests/clear_datastore.py -# TODO: python system_tests/populate_datastore.py - # Install tox for running the system tests RUN pip install --upgrade tox From 6ad7fb2e7ffd445223890da80fc259aca4c6a0bb Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 15:25:31 -0700 Subject: [PATCH 12/13] Rename system-tests target to google-cloud-system-tests --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ef3ff347..0d79ffd6 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,6 @@ tests: benchmarks: make -C tests benchmarks -.PHONY: system-tests -system-tests: +.PHONY: google-cloud-system-tests +google-cloud-system-tests: make -C system_tests From 5632d0e2c324df77578e3a986ddc84c26df41ef6 Mon Sep 17 00:00:00 2001 From: Doug Greiman Date: Thu, 3 Nov 2016 15:30:44 -0700 Subject: [PATCH 13/13] Remove TODOs in favor of opening issues https://github.com/GoogleCloudPlatform/python-runtime/issues/43 https://github.com/GoogleCloudPlatform/python-runtime/issues/44 --- system_tests/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/system_tests/Dockerfile b/system_tests/Dockerfile index 64c69717..8a306f64 100644 --- a/system_tests/Dockerfile +++ b/system_tests/Dockerfile @@ -1,7 +1,6 @@ FROM google/python # Inject secrets -# TODO: Encrypt/decrypt secrets ADD data/ data/ ENV GOOGLE_APPLICATION_CREDENTIALS /app/data/cloud-python-runtime-qa-credentials.json ENV GCLOUD_PROJECT cloud-python-runtime-qa @@ -19,6 +18,5 @@ RUN pip install --upgrade tox ENV MODULES="datastore storage speech bigquery pubsub language translate monitoring bigtable" # Run Python 2.7, 3.4 system tests -# TODO(https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2670) RUN GOOGLE_CLOUD_TESTS_API_KEY=$(cat /app/data/cloud-python-runtime-qa-api-key.txt) \ tox -e system-tests,system-tests3 -- ${MODULES}