test: Refactor OptionsImplTest#651
Conversation
OptionsImpl requires a char** argv, but let's hide that behind a helper function so that each test can just have a string containing an entire command line, instead of needing to break it up. This is preparatory to adding a few more tests as part of envoyproxy#613.
| EXPECT_EXIT(OptionsImpl(argv.size(), const_cast<char**>(&argv[0]), "1", spdlog::level::warn), | ||
| testing::ExitedWithCode(0), ""); | ||
| for (const std::string& s : words) { | ||
| argv.push_back(s.c_str()); |
There was a problem hiding this comment.
This won't actually work. You are storing reference to temporary which will get destroyed when func returns.
There was a problem hiding this comment.
That's why I construct the OptionsImpl within the function -- after that we don't need it, right?
There was a problem hiding this comment.
Sigh, sorry, I'm not having a good code review day. I need to spend more time looking. Yes this is fine.
htuch
left a comment
There was a problem hiding this comment.
LGTM, but I personally would have considered just using C++ vector literals, e.g. {"envoy", "--concurrency", "2", "-c", etc, since this is also concise and would allow hypothetical tests to be written that have non-trivial space escaping or quoting.
|
I'm fine with this change, but if you want to do @htuch suggestion that's fine also. LMK. |
|
I did think about vector literals, but I just couldn't think of a case where we'd feel the need to test that -- in real life we get handed a char** to start with, so this is purely for testing convenience. Happy to go the other way if anyone feels strongly about it. |
Import upstream wasm
Description: update abseil to track upstream Envoy. This will also allow us to test @lizan's suggestion #9654 (comment) Risk Level: low. keeps track with Envoy. Testing: CI Signed-off-by: Jose Nino <jnino@lyft.com> Signed-off-by: JP Simard <jp@jpsim.com>
Description: update abseil to track upstream Envoy. This will also allow us to test @lizan's suggestion #9654 (comment) Risk Level: low. keeps track with Envoy. Testing: CI Signed-off-by: Jose Nino <jnino@lyft.com> Signed-off-by: JP Simard <jp@jpsim.com>
…oyproxy#651) * build(deps): bump setuptools from 59.0.1 to 59.5.0 in /tools/base (envoyproxy#606) Bumps [setuptools](https://github.com/pypa/setuptools) from 59.0.1 to 59.5.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/CHANGES.rst) - [Commits](pypa/setuptools@v59.0.1...v59.5.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump setuptools from 59.5.0 to 60.1.0 in /tools/base (envoyproxy#620) Bumps [setuptools](https://github.com/pypa/setuptools) from 59.5.0 to 60.1.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/CHANGES.rst) - [Commits](pypa/setuptools@v59.5.0...v60.1.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * add support for validating header keys and values fixes envoyproxy#627 Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * address PR feedback Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * add quic header key/value validation Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * add runtime guard: envoy.reloadable_features.validate_upstream_headers Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * honor runtime guard Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * update integration tests for invalid header key/value validation Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * fix http/2 integration tests for invalid header values Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * use nghttp2 for header name and value rfc compliance checks Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * bypass assertions to set invalid header key/value for protocol integration tests Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * fix bad merge on changelog Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * fix unit invalid header integration tests Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * fix tests Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * add entry for new envoy.reloadable_features.validate_upstream_headers runtime guard Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * clarify validate_upstream_headers guard Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * disable validate_upstream_headers guard Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * fix build Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * fix unit tests Signed-off-by: Adam Meily <adam.meily@trailofbits.com> * fix unit test Signed-off-by: Adam Meily <adam.meily@trailofbits.com> Signed-off-by: Adam Meily <adam.meily@trailofbits.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
**Commit Message** `fakeBackends` were utilized before #620 but after that, it's effectively not used anymore. This refactors tests/extproc around on the backend definition so that it will be clearer that the always-failing backend is configured explicitly. --------- Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
OptionsImpl requires a char** argv, but let's hide that behind a helper
function so that each test can just have a string containing an entire
command line, instead of needing to break it up.
This is preparatory to adding a few more tests as part of #613.