Skip to content

Adding e2e test for system-package sample #3949

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

Merged
merged 11 commits into from
Jun 3, 2020
Merged

Adding e2e test for system-package sample #3949

merged 11 commits into from
Jun 3, 2020

Conversation

dinagraves
Copy link
Contributor

No description provided.

@dinagraves dinagraves requested review from averikitsch and a team as code owners June 3, 2020 19:45
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 3, 2020
@dinagraves dinagraves marked this pull request as draft June 3, 2020 19:45
@dinagraves
Copy link
Contributor Author

@tmatsuo My e2e test is in the same folder as the unit tests for this one - in the markup tutorial it was in a higher directory. The noxfile sets all of the tests to only run for python 3.7 - which I think is fine. Any concerns?

@tmatsuo
Copy link
Contributor

tmatsuo commented Jun 3, 2020

@dinagraves
The only downside of the current hierarchy is that we skip main_test.py for other python versions.
I'm ok with it, but if you want to catch failures for other python versions, you'd better have the same hierarchy as markdown-preview project.

@dinagraves
Copy link
Contributor Author

@tmatsuo The Dockerfile specifies python 3.8, so I think it should only matter that it passes in 3.8. I'll update the noxfile to use that instead of 3.7.

@tmatsuo
Copy link
Contributor

tmatsuo commented Jun 3, 2020

I see. Currently we don't have 3.8 presubmit activated. Maybe we should. I'll add an internal Kokoro config.

@tmatsuo
Copy link
Contributor

tmatsuo commented Jun 3, 2020

I updated the internal configs and now python3.8 presubmit and continuous builds should be activated. I'll try to run them by "Update branch"

@tmatsuo tmatsuo added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 3, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 3, 2020
steps:
- # Build the renderer image
name: gcr.io/cloud-builders/docker:latest
args: ['build', '--tag=gcr.io/$PROJECT_ID/sys-package-${_SUFFIX}', '.']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using _SUFFIX here, can we use $COMMIT_SHA as the image tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm - I have to get the URL in the test and to do that I need the name of the service. Not sure how I would get the COMMIT SHA into pytest to get the URL?

Copy link
Contributor

@tmatsuo tmatsuo Jun 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can just use the ${_SUFFIX} as the tag, instead of a part of the image name?

I mean

'--tag=gcr.io/$PROJECT_ID/sys-package:${_SUFFIX}'

@averikitsch WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's just part of the image name and not the service, wouldn't I create problems by deploying the image to the same service name if other tests are also running? Wouldn't I overwrite it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to keep the service name as sys-package-${_SUFFIX}.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like COMMIT_SHA only works on builds that are triggered by a commit. Since I'm explicitly calling the build in the test, it doesn't have the substitution available and is null.

Results in error:

Step #0: invalid argument "gcr.io/python-docs-samples-tests/sys-package:" for "-t, --tag" flag: invalid reference format

@dinagraves
Copy link
Contributor Author

@tmatsuo Would it make sense to set the noxfile_config at the run/ directory level? I'm doing the same e2e tests for all of the samples.

@tmatsuo
Copy link
Contributor

tmatsuo commented Jun 3, 2020

@dinagraves Probably yes :) Especially if all the samples only support python 3.8

@tmatsuo
Copy link
Contributor

tmatsuo commented Jun 3, 2020

@dinagraves Sorry I was probably wrong.

We copy noxfile.py from parent directory.
We don't copy noxfile_config.py from parent directory.

with the current implementation.

So now you need to have noxfile_config.py in each directory.

If you don't like the behavior, please file an issue so that we can discuss further there.

@dinagraves
Copy link
Contributor Author

@tmatsuo Got it - putting noxfile_config back in the sample directories

@dinagraves dinagraves marked this pull request as ready for review June 3, 2020 22:39
@dinagraves dinagraves merged commit 4b968e8 into master Jun 3, 2020
@dinagraves dinagraves deleted the e2e-tests branch June 3, 2020 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants