Coverage testing and docker flow fixes#358
Conversation
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Experiment: see if adding back the tests brings back counting coverage for some of the lines in the .h files that went missing. Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
|
Now that #357 is in, readying this one up for review. This should further stabilize CI. |
mum4k
left a comment
There was a problem hiding this comment.
Thank you very much for improving the stability, this has been hitting us on multiple PRs. As an overall comment - can we try to enumerate the fixes we are making here? It makes it a bit hard to review the PR and relate the various changes to intentions.
| assertEqual(counters["requestsource.internal.upstream_rq_200"], 4) | ||
|
|
||
|
|
||
| def run_service_with_args(args): |
There was a problem hiding this comment.
Can we add documentation for this helper? E.g.
def run_service_with_args(args):
"""Executes the Nighthawk service with the provided arguments.
Args:
args: A string, the command line arguments for the service, e.g. "--foo --bar".
Returns:
A tuple in the form (exit_code, output), where exit_code is the code the Nighthawk
service terminated with and the output is its standard output.
"""Comment about adding documentation applies to all new non-test public functions. We could consider making some of them private instead.
There was a problem hiding this comment.
I made added this comment, slightly modified, to run_service_with_args. And then made this function and others that reuse it private.
|
|
||
| def test_grpc_service_help(): | ||
| (exit_code, output) = run_service_with_args("--help") | ||
| assert (exit_code == 0) |
There was a problem hiding this comment.
Since these are tests, we should likely use self.assertTrue instead of assert. I think assert just terminates the execution while self.assertFoo correctly records the test failure using the test framework.
There was a problem hiding this comment.
Well, we're using pytest, I think this ought te be ok. quoting from the docs:
Due to pytest’s detailed assertion introspection, only plain assert statements are used.
Posting the output of a sample failure (introduced on purpose):
def test_output_transform_help():
(exit_code, output) = _run_output_transform_with_args("--help")
> assert (exit_code == 1)
E assert 0 == 1
E -0
E +1
exit_code = 0
output = ('WARNING: Perftools heap leak checker is active -- Performance may suffer\n'
'\n'
'USAGE: \n'
.... <snip> ...
There was a problem hiding this comment.
Having said that, we do have some helpers in utilities.py, like assertEqual. Switched to use that, for consistency with the rest of the test code.
| #!/usr/bin/env python3 | ||
| import pytest | ||
|
|
||
| from test.integration.utility import * |
There was a problem hiding this comment.
Can we import specific modules or packages explicitly? It helps when debugging.
There was a problem hiding this comment.
Amended this in some places. But we may want to track this as tech debt in an issue, because this occurs in other places as well. I filed #371 for that (as tech-debt)
Ah yes, sure: I updated the PR description to list what I did here. Let me know if that looks better. I will address the other comments later today. |
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
|
|
||
| from test.integration.integration_test_fixtures import http_test_server_fixture | ||
| from test.integration.utility import * | ||
| from test.integration.utility import (isSanitizerRun, assertEqual, assertIn, assertGreaterEqual, |
There was a problem hiding this comment.
Looks like this now imports functions from the utility module. What we really should be importing is the utility module itself.
from test.integration import utility
And then calls will look like.
utility.assertEqual
Ideally utility would have a better more descriptive name, but we can address that separately. The Python style we are following internally suggests to only import packages or modules, that way it is easy to say where some function is defined. If the reader just sees "assertEqual", they have to do some digging.
There was a problem hiding this comment.
Thank you for filing the issue.
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Following some digging into stability of our coverage testing, creating this PR for testing CI
with some fixes / enhancements, as well as covering a few more lines in our
CLI tooling exception paths. There seems to be something racy going on where sometimes the coverage originating from our python integration tests is not counted.
Eventually I learned that things might stabilise when we switch the toolchain to clang 10. We follow Envoy's lead on that, so for now stopping further efforts on this.
Description of the changes in this PR:
envoy_build_sha.sh, which apparently broke in one of the Envoy updatesrun_nighthawk_bazel_coverage.shto work on my machinePrerequisites
Leaving some notes/learnings here:
our python integration tests is not counted. This is relatively infrequent in CI.