-
Notifications
You must be signed in to change notification settings - Fork 373
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
test(storage): add emulator unit tests and cleanup #5453
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.
Since Bazel does not fully support pytest, I converted all those tests to unittest.
Thanks.
I have some questions
Should we convert all the code that are using testbench to emulator ?
Seems to me all the google-cloud-cpp
integration tests are already doing so. What else did you have in mind?
When will we remove the testbench directory ?
I think we should open a bug to track these things, but I believe we need to move and/or create a new README.md file like then one in the testbench/
directory.
Reviewed 5 of 5 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @vnvo2409)
google/cloud/storage/emulator/BUILD, line 15 at r1 (raw file):
# limitations under the License. py_test(
You need to add some boilerplate I think:
package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # Apache 2.0
The CI threw I think it's because we have Windows failed because of another reason: Those tests do not support to run on Windows. I have no idea why it happened 😕 |
Searching around I found this: We do not install a plain "python" program in the docker images for these builds: ./ci/kokoro/docker/build.sh asan bash
bash-5.0$ python
bash: python: command not found
bash-5.0$ python3 --version
Python 3.9.0 There is already an open bug for Bazel (bazelbuild/bazel#8446), but I think we will need to workaround it by installing a plain python program. |
FYI Ubuntu only ships |
This was Fedora:33, and I am not seeing the
Seems like we need to install
|
It doesn't look like the python dependencies are being installed for the Windows builds. I think the Windows build only ran the integration tests (and not the testbench/emulator tests) but since you run
Thanks. It should be installed by default, odd that the docker image omits it. |
Please disregard this. It made sense in my head when I typed it. |
We basically run Looks like we just need to install the |
I added
Use I also deleted some redundant ( |
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.
Reviewed 7 of 7 files at r2.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @vnvo2409)
ci/kokoro/docker/Dockerfile.fedora, line 26 at r2 (raw file):
# Link `python` to `python3` RUN ln -s $(which python3) /usr/bin/python
I think we should simply install the python
package. These Dockefiles are also good documentation to setup a development environment, and we should not be recommending something like this. Also, seems that this could fail unexpectedly in the future (say because the link is automatically created)
ci/kokoro/docker/Dockerfile.ubuntu, line 52 at r2 (raw file):
# Link `python` to `python3` RUN ln -s $(which python3) /usr/bin/python
Ditto.
google/cloud/storage/ci/run_integration_tests_emulator_bazel.sh, line 34 at r2 (raw file):
# Run the unittests of the emulator before running integration tests. "${BAZEL_BIN}" test "${bazel_test_args[@]}" "//google/cloud/storage/emulator:test_utils" \
Can we use :all
and maybe pass --test_tag_filters=manual
?
google/cloud/storage/emulator/BUILD, line 15 at r1 (raw file):
Previously, coryan (Carlos O'Ryan) wrote…
You need to add some boilerplate I think:
package(default_visibility = ["//visibility:public"]) licenses(["notice"]) # Apache 2.0
This is still missing I believe.
google/cloud/storage/emulator/BUILD, line 21 at r2 (raw file):
imports = ["."], main = "tests/test_gcs.py", tags = ["manual"],
Can you open a bug to make these unit tests run on Windows? And add a TODO(#...) - $why
here?
+kokoro:run |
These tests could run perfectly on Windows. However, I feel it's noop if we run the tests without running the emulator. WDYT ? |
Yes. I was thinking we would eventually run the Windows CI build against the emulator too. |
Codecov Report
@@ Coverage Diff @@
## master #5453 +/- ##
========================================
Coverage 95.49% 95.49%
========================================
Files 1057 1062 +5
Lines 97761 97984 +223
========================================
+ Hits 93354 93573 +219
- Misses 4407 4411 +4
Continue to review full report at Codecov.
|
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.
Looks good, let's see what happens with the builds +kokoro:run
Reviewed 8 of 8 files at r3.
Reviewable status: complete! all files reviewed, all discussions resolved
google/cloud/storage/emulator/BUILD, line 21 at r2 (raw file):
Previously, coryan (Carlos O'Ryan) wrote…
Can you open a bug to make these unit tests run on Windows? And add a
TODO(#...) - $why
here?
Oh cool, you fix that in this PR, thanks!
to
I will move the unit tests of the emulator to In addition, I think we should leave Window as-is and file an issue for activating the emulator and running the unit tests at the same time which makes more sense to 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.
In addition, I think we should leave Window as-is and file an issue for activating the emulator and running the unit tests at the same time which makes more sense to me.
That SGTM.
I would like to ask if we have to rebuild the Dockerfile.* each kokoro build or not ?
Yes, but most builds use cached versions of the docker images and refresh/rebuild the image starting from that cache.
to
storage/ci/run_integration_tests_emulator_[bazel/cmake].sh
I would prefer if we refactor these commands to something like
https://github.com/googleapis/google-cloud-cpp/blob/master/ci/install-cloud-sdk.sh
Reviewable status: complete! all files reviewed, all discussions resolved
I am a little bit confused: the dependencies from |
Yes 😁 The builds first download a (cached) docker image created from the If nothing has changed in If there are changes in The cached docker images are updated as part of the full builds post-PR, which are not required to be fast (though it is nice if they are). |
After a lot of trials, I think
It does not work, we have to write all the targets manually. Even after #5498 is closed, we should continue using this tag since it allows us to run the tests only when we need |
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.
just waiting for the builds. This is great news.
Reviewed 1 of 3 files at r4, 1 of 1 files at r5.
Reviewable status: complete! all files reviewed, all discussions resolved
Thanks again for this PR. |
Since
Bazel
does not fully supportpytest
, I converted all those tests tounittest
.I have some questions
testbench
toemulator
?testbench
directory ?Part of #4751
We finally reach a milestone in
Complete GCS+gRPC plugin
. From now, we could implementingGCS+gRPC
without worrying about testing 🚀This change is