test: add tests for corner-cases around sending requests before run() starts or after run() ends.#4114
Conversation
…s or after run() ends. Also adds some test infrastructure to make it easier to work with condvar/mutex combos. Signed-off-by: Joshua Marantz <jmarantz@google.com>
…s destroyed. Signed-off-by: Joshua Marantz <jmarantz@google.com>
… tests. Many of the MainCommon tests do not require multiple threads and sync-points, so this factors out a new test-class to encapsulate these. Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
|
@dnoe PTAL |
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
test/exe/main_common_test.cc
Outdated
| addArg("--disable-hot-restart"); | ||
| } | ||
|
|
||
| // Runs a an admin request specified in path, blocking until completion, and |
There was a problem hiding this comment.
"Runs a an admin" -> "Runs an admin request"
test/exe/main_common_test.cc
Outdated
| } | ||
|
|
||
| // Conditionally pauses at a critical point in the Envoy thread waiting, waiting | ||
| // the for the test thread to try something. The test thread can then call resume_.Notify() |
There was a problem hiding this comment.
Extra the snuck in. And I can't tell if the repetition of waiting is intention. If it is, SGTM :)
|
|
||
| // The admin handler can't be called until after we let run() go. | ||
| EXPECT_FALSE(admin_handler_was_called); | ||
|
|
There was a problem hiding this comment.
We could add EXPECT_THAT(out, IsEmpty()) too, right?
| adminRequest("/quitquitquit", "POST"); | ||
| EXPECT_TRUE(waitForEnvoyToExit()); | ||
| EXPECT_TRUE(admin_handler_was_called); | ||
| EXPECT_THAT(out, HasSubstr("filesystem.reopen_failed")); |
There was a problem hiding this comment.
Seems like a weird thing to look for in the output. What's trying to be reopened here and what's failed? Can you add a comment that points to the bit that logs that line?
There was a problem hiding this comment.
I was just checking for any stat. Adding comment.
| // Class to track whether an object has been destroyed, which it does by bumping an atomic. | ||
| class DestroyCounter { | ||
| public: | ||
| explicit DestroyCounter(std::atomic<uint64_t>& destroy_count) : destroy_count_(destroy_count) {} |
There was a problem hiding this comment.
Taking and storing a reference like this is definitely not the norm, although it seems intended here since there's no accessor. Can you add a comment about the ownership semantics here?
| pause_point_.WaitForNotification(); // run() finished, but main_common_ still exists. | ||
|
|
||
| // Admin requests will not work, but will never complete. The lambda itself will be | ||
| // destroyed on thread exit, which we'll track with an object that counts destructor calls. |
Signed-off-by: Joshua Marantz <jmarantz@google.com>
|
Changes look good. Any idea what's up with the ASAN failure? |
|
asan failure seems to be just a CI timeout, but I'm not sure. This change is only a unit test so it seems unlikely to affect a different test :) |
|
Trying out new 'git kick-ci' from slack |
|
I think ipv6_tests failure is a flake unrelated to this change too, so maybe you get to try kick-ci again: HDS integration test failed with this:
Looks like #4135 And the echo integration test timed out (maybe CI problem?) |
* origin/master: (38 commits) test: add tests for corner-cases around sending requests before run() starts or after run() ends. (envoyproxy#4114) perf: reduce the memory usage of LC Trie construction (envoyproxy#4117) test: moving redundant code in websocket_integration_test to utilities (envoyproxy#4127) test: make YamlLoadFromStringFail less picky about error msg. (envoyproxy#4141) rbac: add rbac network filter. (envoyproxy#4083) fuzz: route lookup and header finalization fuzzer. (envoyproxy#4116) Set content-type and content-length (envoyproxy#4113) fault: use FractionalPercent for percent (envoyproxy#3978) test: Fix inverted exact match logic in IntegrationTcpClient::waitForData() (envoyproxy#4134) Added cluster_name to load assignment config for static cluster (envoyproxy#4123) ssl: refactor ContextConfig to use TlsCertificateConfig (envoyproxy#4115) syscall: refactor OsSysCalls for deeper errno latching (envoyproxy#4111) thrift_proxy: fix oneway bugs (envoyproxy#4025) Do not crash when converting YAML to JSON fails (envoyproxy#4110) config: allow unknown fields flag (take 2) (envoyproxy#4096) Use a jittered backoff strategy for handling HdsDelegate stream/connection failures (envoyproxy#4108) bazel: use GCS remote cache (envoyproxy#4050) Add thread local cache of overload action states (envoyproxy#4090) Added TCP healthcheck capabilities to the HdsDelegate (envoyproxy#4079) secret: add secret provider interface and use it for TlsCertificates (envoyproxy#4086) ... Signed-off-by: Snow Pettersen <snowp@squareup.com>
Signed-off-by: Joshua Marantz jmarantz@google.com
Description: There was concern around wanting to understand exactly what happens if an adminRequest gets issued prior run() starting, or right after run() ends.
Risk Level: none (just new tests)
Testing: //test/exe:main_common_test
Docs Changes: n/a
Release Notes: n/a