-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
tools: Add protoxform tests #9241
Conversation
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
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 is super cool @Shikugawa, big thanks for putting this together. I think the PR is largely correctly structured, just working through some Python style stuff.
/wait
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
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.
Cool, thanks for following up on the comments. A few more.
/wait
# stdout and stderr as a string array. | ||
def runCommand(command): | ||
logging.info("%s" % command) | ||
proc = subprocess.run([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
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 can just do capture_output=True
.
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.
@htuch we can't use capture_output
because envoy_ci internal python runtime version is less than 3.7
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 able to use it in https://github.com/envoyproxy/envoy/pull/9258/files#diff-bba1df52a76edae166f0c52c4fed21dbR38, I'm wondering what version issues we're hitting here.
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.
@htuch it seems that api_boost.py
is not defined to run on envoy_ci internal docker runtime because the execution definition isn't written in do_ci.sh
so test should be passed. But if we add this python script execution definition to that shell script, it may be failed... so unless update docker internal python version, this argument should not work....
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.
anyway, add issue #9339
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.
@Shikugawa is this blocking? I think I will have a similar issue with a test I'm working on, so I can take a look. Is there anything else here that we need to sort out?
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.
@htuch hmm...can't pass formatting check because of confusing exception...
https://dev.azure.com/cncf/envoy/_build/results?buildId=23684&view=logs&jobId=9fd74226-df5b-5f29-39da-76fc341cc763&j=9fd74226-df5b-5f29-39da-76fc341cc763&t=068b98b1-acf0-52d0-fc6e-f6d1a5b1d5ef
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.
so is capture_output=True
is the reason for python >= 3.7? I think using subprocess.PIPE can workaround it.
@Shikugawa the exception seems from yapf so it's failing on Python formatter somewhere, were you able to run ci/run_envoy_docker.sh 'ci/check_and_fix_format.sh'
locally?
//tools/testdata/protoxform:protos --aspects //tools/protoxform:protoxform.bzl%protoxform_aspect --output_groups=proto \ | ||
--action_env=CPROFILE_ENABLED=1 --host_force_python=PY3 | ||
|
||
./tools/protoxform_test_helper.py ${PROTO_TARGETS} |
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 wonder if @lizan has any Bazel Fu to make the tests work as Bazel aspects.
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, you can write a rule that depends on aspect (like what type_database
rule does depend on type_whisperer aspect), then define a test target on that. but we're good to go with this for now.
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
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.
LGTM modulo the one question I have for @lizan on aspect magic. Thanks!
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
@Shikugawa LGTM, can you |
messages += Run(path, filename, 'v3alpha') | ||
|
||
if len(messages) == 0: | ||
logging.warning("PASS") |
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 you are going to want to sys.exit()
with different success/failure values here (was just looking again at this PR as I'm writing some simple golden source test as well right now). Thanks.
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
tools/protoxform_test_helper.py
Outdated
""" | ||
base = "./bazel-bin/" | ||
delimited_path = path.split('/') | ||
base += os.path.join(*delimited_path, "protos", *delimited_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.
I think this might be where the pyformat failure is happening; how come you want to squash the path twice here and join it twice? Why not just use path
instead of delimited_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.
@htuch automatically generated proto file is located on ./bazel-bin/tools/testdata/protoxform/envoy/v2/protos/tools/testdata/protoxform/envoy/v2/
.
So, this instruction could not avoid. But, It seems for me to use path
instead of delimited_path
.
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
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.
Thanks!
Signed-off-by: Harvey Tuch <[email protected]>
Signed-off-by: Harvey Tuch <[email protected]>
* master: (167 commits) stats: Avoid asserts in fuzz-tests by eliminating arbitrary length limits, using the new MemBlock wrapper for memcpy (envoyproxy#8779) Make %UPSTREAM_LOCAL_ADDRESS% access-log format work for HTTP requests. (envoyproxy#9362) tools: API boosting support for using decls and enum constants. (envoyproxy#9418) Fix incorrect cluster InitializePhase type (envoyproxy#9379) build: fix merge race between envoyproxy#9241 and envoyproxy#9413. (envoyproxy#9427) fuzz: fix incorrect evaluator test (envoyproxy#9402) server: fix bogus startup log message (envoyproxy#9404) tools: Add protoxform tests (envoyproxy#9241) api: options after import (envoyproxy#9413) misc: use std::move instead of constructing a copy (envoyproxy#9415) tools: API boosting support for rewriting elaborated types. (envoyproxy#9375) docs: fix invalid transport_socket value (envoyproxy#9403) fix typo in docs (envoyproxy#9394) srds: remove to-de-removed scopes first and then apply additions to avoid scope key conflict. (envoyproxy#9366) api: generate whole directory and sync (envoyproxy#9382) bazel: Add load statements for proto_library (envoyproxy#9367) Fix typo (envoyproxy#9388) Correct test of OptionsImpl argc type (Was: Correct type for std::array size() result) (envoyproxy#9290) http1 encode trailers in chunk encoding (envoyproxy#8667) Add mode to PipeInstance (envoyproxy#8423) ...
Add testing for protoxform scripts. We apply golden testing method for this. Risk Level: Low Testing: none Docs Changes: none Release Notes: Fixes envoyproxy#8428 Signed-off-by: shikugawa <[email protected]> Signed-off-by: Prakhar <[email protected]>
…nvoyproxy#9427) Signed-off-by: Harvey Tuch <[email protected]> Signed-off-by: Prakhar <[email protected]>
For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md
Description: Add testing for protoxform scripts. We apply golden testing method for this.
Risk Level: Low
Testing: none
Docs Changes: none
Release Notes:
[Optional Fixes #Issue] #8428
[Optional Deprecated:]