test: adding an integration test framework for file-based LDS#6933
test: adding an integration test framework for file-based LDS#6933htuch merged 10 commits intoenvoyproxy:masterfrom
Conversation
|
@htuch this is what I had in mind for reload/rollback tests. File-based just because IMO it's easier to manage than an extra upstream, but we could do the work to move it over to gRPC instead. @danzh2010 mind taking a look for how readable this is to someone not steeped in xDS? :-) |
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
htuch
left a comment
There was a problem hiding this comment.
Cool; I actually like that this is file-system based, way easier to debug and no network ick. I'd be keen to see this decoupled from xds_integation_test and demoed in a more standalone way, e.g. with the regular HTTP integration tests. The idea here I gather is that we're not creating better xDS integration tests, but instead making it easy for any integration test to benefit from dynamic config changes.
test/config/utility.h
Outdated
| const envoy::config::bootstrap::v2::Bootstrap& bootstrap() { return bootstrap_; } | ||
|
|
||
| // Allow a finalized configuration to be edited for generating xDS responses | ||
| void allowFurtherEdits() { finalized_ = false; } |
There was a problem hiding this comment.
Can we do something less stateful here? I'm thinking specifically that it's easier to reason about an immutable bootstrap and then immutable updates to this. Why does ConfigHelper need to be edited, could we have a second ConfigHelper instantiated independently? Can we decompose ConfigHelper into parts that deal with downstream (LDS) and upstream (CDS)?
| initialize(); | ||
| fake_upstreams_[0]->set_allow_unexpected_disconnects(true); | ||
| const std::string lds_filename = | ||
| config_helper_.bootstrap().dynamic_resources().lds_config().path(); |
There was a problem hiding this comment.
Can we factor this kind of boiler plate outside of the individual tests. Ideally there are more declarative and have the file naming and renaming handled by some method which is just applyUpdateConfig() or something in the test fixture.
| {Http::CodecClient::Type::HTTP1}, {FakeHttpConnection::Type::HTTP1})), | ||
| HttpProtocolIntegrationTest::protocolTestParamsToString); | ||
|
|
||
| // Sample test making sure our config framework correctly reloads listeners. |
There was a problem hiding this comment.
Yeah, this is already somewhat covered by https://github.com/envoyproxy/envoy/blob/master/test/integration/ads_integration_test.cc#L658 and other xDS integration tests, but if the idea is to show off the new config helper features, this works.
| for (auto& listener : config_helper_.bootstrap().static_resources().listeners()) { | ||
| ProtobufWkt::Any* resource = lds.add_resources(); | ||
| resource->PackFrom(listener); | ||
| } |
There was a problem hiding this comment.
use createLdsResponse() instead?
| "new_lds_file", MessageUtil::getJsonStringFromMessage(lds)); | ||
| TestUtility::renameFile(file, lds_filename); | ||
|
|
||
| test_server_->waitForCounterGe("listener_manager.lds.update_success", 2); |
There was a problem hiding this comment.
Is listener_manager.lds.update_success == 1 after initialize()? If so, can we add an EXPECT there?
| true); | ||
|
|
||
| // Now that the listeners have been written to the lds file, remove them from static resources | ||
| // or they will not be reloadable. |
There was a problem hiding this comment.
I'm curious how does static_resources() get reloaded?
There was a problem hiding this comment.
Never. If you put something in static resources it's loaded into config with a "non-modifiable" tag and all updates to that listener are disregarded. Which I only discovered when debugging this test :-P
There was a problem hiding this comment.
Sorry, what I mean is after clearing static resources, how does a modified listener config in file get reloaded?
There was a problem hiding this comment.
Ah, gotcha.
So by sticking the filename in the dynamic config, we say "config lives here"
There's an initial read on start-up, and then any time a new file is moved there, Envoy will reread and (generally) reload.
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
|
Yep, the goal is to make it really easy to test reloadable config in any of the integration tests. |
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
| public: | ||
| void initializeFilter(const std::string& filter_config) { | ||
| // There's some deadlock issue with simtime where the alarm may be scheduled | ||
| // and will not fire. Waiting for the injected delay appears to help. |
There was a problem hiding this comment.
This is fixed by #6956 - I'll re-enable it when either this PR or that one lands.
If in one event loop, two things tried to post to a dispatcher, the dispatcher would (multiple times) set a 0 ms timer. For both instances, simtime would see the duration was 0, call activateLockHeld, increment pending alarms and set the base alarm to fire. The base alarm would only fire once though, so the pending alarms would decrement once, pending would be true for ever and the whole system would "deadlock" waiting for pending to decrease to 0. The symptom was the fault filter alarm being set to 200ms in #6933 but because of the extra dispatcher post triggering this deadlock the test would spin forever. Risk Level: low (test only) Testing: new unit test, verified fault filter test now works in the LDS PR Docs Changes: n/a Release Notes: n/a Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
* master: (65 commits) proto: Add PATCH method to RequestMethod enum (envoyproxy#6737) exe: drop unused deps on zlib compressor code (envoyproxy#7022) coverage: fix some misc coverage (envoyproxy#7033) Enable proto schema for router_check_tool (envoyproxy#6992) stats: rework stat sink flushing to centralize counter latching (envoyproxy#6996) [test] convert lds api test config stubs to v2 (envoyproxy#7021) router: scoped rds (2c): implement scoped rds API (envoyproxy#6932) build: Add option for size-optimized binary (envoyproxy#6960) test: adding an integration test framework for file-based LDS (envoyproxy#6933) doc: update obsolete ref to api/XDS_PROTOCOL.md (envoyproxy#7002) dispatcher: faster runOnAllThreads (envoyproxy#7011) example: add csrf sandbox (envoyproxy#6805) fix syntax of gcov exclusion zone. (envoyproxy#7023) /runtime_modify: add support for query params in body (envoyproxy#6977) stats: Create stats for http codes with the symbol table. (envoyproxy#6733) health check: fix more fallout from inline deletion change (envoyproxy#6988) Max heap fix (envoyproxy#7016) Add support to unregister from lifecycle notifications (envoyproxy#6984) build spdy_core_alt_svc_wire_format (envoyproxy#7010) ext_authz: Make sure initiateCall only called once (envoyproxy#6949) ... Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Risk Level: low (test only)
Testing: new LDS test
Docs Changes: n/a
Release Notes: n/a
#5624