api: Put Event::TimeSystem& into API and plumb that instead of TimeSystem in various places.#5660
Conversation
…in various places. Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
|
hold off on review; I found a way to simplify this. |
…ough mocks. Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
|
I think this is probably too big to review but I'd love to get any feedback anyone has. My thinking is that there are 2-3 PRs to split out here:
I'm also thinking of another grand test-refactor which is make most non-trivial tests in Envoy derive from a single class. This class would also be a good place to assert that all Global are cleaned up, which is currently only done at the end of all tests. |
|
When passing the Filesystem::Instance& through the API, we found that we'd have to expose the API from the FactoryContext as well, so there is some overlap there (at least for the carrying the TimeSystem& around in the API) part. We also gave the "all tests that use threads/filesystem derive from a single class" pattern a look -- as one might guess it turned into a pretty enormous change so we decided to put it down. |
|
@jmarantz SGTM. In general I do like the idea of carrying around |
Signed-off-by: Joshua Marantz <jmarantz@google.com>
|
I am very much in favor of using |
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Still failing:
//test/common/network:connection_impl_test FAILED in 2.2s
[ RUN ] IpVersions/ConnectionImplDeathTest.BadFd/IPv4
test/common/network/connection_impl_test.cc:91: Failure
Death test: ConnectionImpl(dispatcher, std::make_unique<ConnectionSocketImpl>(std::move(io_handle), nullptr, nullptr), Network::Test::createRawBufferSocket(), false)
Result: died but not with expected error.
Expected: contains regular expression ".*assert failure: ioHandle\\(\\).fd\\(\\) != -1.*"
Actual msg:
Will investigate after master-merge.
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
|
@sesmith177 @dnoe I think this is ready for a look. |
|
/retest |
|
🔨 rebuilding |
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
|
/retest |
|
🔨 rebuilding |
Signed-off-by: Joshua Marantz <jmarantz@google.com>
dnoe
left a comment
There was a problem hiding this comment.
I think you can remove an argument from the GuardDogImpl constructor, since it currently takes both a TimeSystem and an Api:
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
…th explicit TimeSystem arg. Signed-off-by: Joshua Marantz <jmarantz@google.com>
| /** | ||
| * @return a reference to the TimeSystem | ||
| */ | ||
| virtual Event::TimeSystem& timeSystem() PURE; |
There was a problem hiding this comment.
Per discussion, WDYT about just making this return a TimeSource in this PR? We can still take a TimeSystem in the constructor and not change anything else until a follow up, but this would get us closer to where we want to be?
There was a problem hiding this comment.
I think that would expand this PR significantly because there are a few places in the PR where an existing timeSystem() interface is implemented using API::timeSystem(). If that disappeared I'd have to change a bunch of call-sites. This would be trivial but it would make the PR a lot larger, and there is some semantic content here. So I'd prefer to do that in a separate PR. That OK?
I have this practice of trying to make semantically interesting PRs as small as possible, and letting trivial renaming or type-change PRs go large if needed.
There was a problem hiding this comment.
Sure SGTM. I think we are on the same page and heading in the right direction so 👍
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
…stem in various places. (envoyproxy#5660) * Put Event::TimeSystem& into API and plumb that instead of TimeSystem in various places. Signed-off-by: Joshua Marantz <jmarantz@google.com> Signed-off-by: Fred Douglas <fredlas@google.com>
Description: It's better to tunnel more global structures through the API interface rather than passing tons of of global state everywhere, as it makes it much easier to add state as needed, such as Filesystem::Instance (@sesmith177) or Stats::SymbolTable in the futre. This PR puts an Event::TimeSystem& accessor into Api::Api and plumbs that through where needed.
Risk Level: low this is a straight refactor.
Testing: //test/...
Docs Changes: n/a
Release Notes: n/a