-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run google-cloud-python system tests against new runtime images. #39
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meta comment: It looks like you're running all of the tests inside a "docker build". It might be a little more straightforward to inject the tests into your docker image using a volume mount during a "docker run", and then run the tests that way.
@@ -0,0 +1,2 @@ | |||
data/ | |||
secrets.tar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: missing newline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
# Inject secrets | ||
# TODO: Encrypt/decrypt secrets | ||
ADD data/ data/ | ||
ENV GOOGLE_APPLICATION_CREDENTIALS /home/vmagent/app/data/cloud-python-runtime-qa-credentials.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think /home/vmagent/app is symlinked to /app. It might be easier to just use that path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -0,0 +1,40 @@ | |||
FROM google/python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this assume you've just built an image called "google/python" locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice to make this an invalid image name then. If you forgot to build your image or built it with a different name this would give you false positives, since google/python does exist on Dockerhub, but isn't updated at all IIRC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's file a bug and fix that separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed as #38
|
||
# Install gcloud so we can do test setup | ||
RUN apt-get update && apt-get install curl | ||
RUN curl https://sdk.cloud.google.com | bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to follow these steps instead: https://cloud.google.com/sdk/downloads#versioned
These will ensure you always get the same version of gcloud, which is especially important when you're using commands in the "preview" group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good way to end up with a test that constantly runs an outdated SDK. Assuming we run these tests regularly, is there any reason we shouldn't just target the latest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as your goal isn't to actually test the SDK it should be fine. I doubt these commands are going to change on you much in practice though.
One other benefit of fetching these tarballs is that the dl.google.com server which is used by the install script has no SLO and will cause flakes eventually. The versioned tarballs are published to GCS, which will have far fewer flakes.
The App Engine team just switched some internal tests over because of flakiness introduced by dl.google.com.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, @duggelz if you drop the gcloud preview datastore create-indexes system_tests/data/index.yaml
you should be able to get by with not installing the SDK at all. Setting GOOGLE_APPLICATION_CREDENTIALS
and GCLOUD_PROJECT
are sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed #40 and GoogleContainerTools/base-images-docker#50 .
Meanwhile, this is good enough for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
# 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 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you run this docker build inside cloudbuild you might be able to skip all authentication since it'll be running inside GCE and gcloud can auth itself automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does cloudcloud give credentials for the current project? What about scopes? Using a service account is predictable auth, so maybe there's some benefit there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the credentials used are a service account in your project. The scopes are cloud-platform I believe, and you can use IAM to grant more permissions to that service account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deferring this as #40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
|
||
# 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) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice to make this a "CMD" instead of a RUN, that way you can build this image once and then run tests several times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was doing 'CACHE= make' to get the same effect from Docker layer caching. Hmm, the name made more sense in my head ("CACHE=" enables caching?!)
@dlorenc how does that play with cloud build? |
It works fine with cloud build. You get full access to a docker daemon. |
|
||
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deferred as #40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd actually prefer if we went ahead and removed this in this PR. Did you have trouble with just setting GOOGLE_APPLICATION_CREDENTIALS
and GCLOUD_PROJECT
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
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.
Please take another look. I also addressed some things that Jon and I talked about over email. |
Currently, everything but 'logging' works. See: googleapis/google-cloud-python#2669
@@ -0,0 +1,3 @@ | |||
# Editor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop this. Add it to your global gitignore: https://help.github.com/articles/ignoring-files/#create-a-global-gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -25,3 +25,7 @@ tests: | |||
.PHONY: benchmarks | |||
benchmarks: | |||
make -C tests benchmarks | |||
|
|||
.PHONY: system-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go ahead and name this google-cloud-system-tests
, as we may want to add system tests for other packages in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. No doubt we'll need to move files and directories around later when we add more system tests.
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No TODOs in code, please, file an issue instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to see something like:
# TODO(#41): Enable once run_unit_tests.py is released
Or just not have that comment at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer not to have it at all. Put all the needed context in the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Asking me to program without TODOs is like asking me to program without my left hand. But I'm always up for a challenge.
|
||
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd actually prefer if we went ahead and removed this in this PR. Did you have trouble with just setting GOOGLE_APPLICATION_CREDENTIALS
and GCLOUD_PROJECT
?
This reverts commit e3a7cf8.
Test setup will be handled elsewhere.
@@ -4,26 +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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you file an issue to figure out how to not hardcode these? (I'm thinking just passing them to docker run, but we can address it later).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed as #42
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you keeping this around in case you need it again in the future? Maybe just make a gist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, that was supposed to be amended before I pushed. Fixed.
Ok, can you take a final(?) look? |
No description provided.