-
Notifications
You must be signed in to change notification settings - Fork 313
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
Exclude some commands from online check. #1514
Conversation
9dab8fb
to
753bd55
Compare
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.
Fantastic that you're tackling this, thanks! Three notes:
- This breaks an integration test that was relying on
esrally list tracks
to test the internet connection behavior. - Maybe we don't need tests for this in two places, but I think keeping the unit test to completely test the logic is a nice touch. Up to you. If you keep the test however, please mock the
net.has_internet_connection
call too, or running unit tests will get three seconds slower for me, which would be ironic as I run tests more than offline Rally commands. - Is this still a draft? Do you expect review on drafts?
@pquentin This is a draft because I wanted to get all tests passing before requesting a review. In fact, I'd rather remove the integration tests and replace them with unit tests where we can, in this case we can. Integration tests are slow. |
What do you think about removing some of the integration tests, because the new unit test replaces them? I think that these can go away:
|
@pquentin Tests now pass, You'll notice that I removed I didn't remove |
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! Unfortunately, digging deeper it turns out that many commands do need Internet connection in special cases. I mentioned this inline. (To be honest I'm not sure why we need to look before leaping, we could just try the command and report a connection error if it failed due to a bad connection...)
Regarding unit tests vs. integration tests, this is highly subjective. A few comments:
- The effort made for those integration tests is not a consideration, code is code, and removing code is always nice.
- But then, integration tests actually test the functionality end-to-end, eg. they exercise the
has_internet_connection
function that is otherwise mocked - We also don't have any unit test that test the proxy case?
- And yes, it tests are so slow that I don't run them locally.
So I would tend towards leaving proxy_test.py. What do you think?
@@ -51,6 +51,8 @@ | |||
from esrally.tracker import tracker | |||
from esrally.utils import console, convert, io, net, opts, process, versions | |||
|
|||
OFFLINE_SUBCOMMANDS = ("compare", "list", "start", "stop", "generate") |
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 this is complicated:
start
can pull Docker images,stop
writes to the metrics store which can be a remote cluster.list races
andlist tracks
support fetching the data from a remote metrics clusterlist tracks
,list cars
andlist elasticsearch-plugins
need to fetch data from GitHub
So the commands that are truly offline are: compare, list telemetry, list pipelines, and generate.
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, that's good to know. I'll make changes.
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.
Agree. I struggled with this one. I'll think about it some more.
@@ -898,6 +900,21 @@ def configure_reporting_params(args, cfg): | |||
cfg.add(config.Scope.applicationOverride, "reporting", "numbers.align", args.report_numbers_align) | |||
|
|||
|
|||
def ensure_internet_connection(args, cfg, logger): |
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.
For what it's worth, I'm not really happy with the name, there are two cases where no Internet connection is needed at all, but I haven't found a better name! 🤷
Same here, I'm starting to wonder if we need this check at all. It feels like we should be able to do without this check, or at least, if it's necessary for some reason, do it lazily as needed. I'm going to look closer at the code and figure out what's the point of the offline mode. There's probably something I'm not seeing. |
8be8c3c
to
53de26b
Compare
Good point.
Ah. In that case, we should definitely keep them.
I agree. I looked through the code to figure out what the offline mode actually does. A couple of things:
The offline feature was designed for corporate environments, where benchmarking clients are not able to access the Internet. I don't see a good reason to keep the method But why an extra check? We might as well try and fail when updating these repos. I think the only purpose of the extra check was to automatically set Rally to At this point, I think I would:
What do you think? This would change the PR, but it makes more sense to me. Edited: Here is the alternative PR: #1517 |
I do prefer #1517, but asked other to chime in first. |
Closing as #1517 is indeed the way to go. |
Some of the commands don't need Rally to be online.
Fixes #1506.