test: fix bad route entry test cases on Windows#11830
test: fix bad route entry test cases on Windows#11830mattklein123 merged 5 commits intoenvoyproxy:masterfrom nigriMSFT:badrouteconfig-test
Conversation
Signed-off-by: Nick Grifka <nigri@microsoft.com>
|
@lizan it seems ef7d81d change regarding yaml->protobuf conversion changed the expected exception message slightly for BadRouteEntryConfigPrefixAndPath and a few other test cases. On Windows, these test cases still seem to be producing the old exception message. Is this at all expected? Is it important that the exception message check be as specific as it is today? BadRouteEntryConfigPrefixAndPathAndRegex is an example of a more relaxed check that passes on both platforms. For completeness, here is the expected vs. actual exception messages on Windows: |
|
@nigriMSFT I think you need to merge master. |
| TestConfigImpl(parseRouteConfigurationFromYaml(yaml), factory_context_, true), EnvoyException, | ||
| "invalid value oneof field 'path_specifier' is already set. Cannot set '(prefix|path)' for " | ||
| "type oneof"); | ||
| "invalid value oneof field 'path_specifier' is already set."); |
There was a problem hiding this comment.
So part of the message is missing/different when running on windows?
There was a problem hiding this comment.
Yes. For this example specifically, we get "invalid value oneof field 'path_specifier' is already set. Cannot set 'prefix' for type oneof"
There was a problem hiding this comment.
Isn't the (prefix|path) part a regex capture group for the EXPECT_THROW_WITH_REGEX? I looks like this failure is a symptom of googletest not supporting more advanced regex
Running this test locally I see:
[ RUN ] BadHttpRouteConfigurationsTest.BadRouteEntryConfigPrefixAndPath
external/com_google_googletest/googletest/src/gtest-port.cc(860): error: Failed
Syntax error at index 71 in simple regular expression "invalid value oneof field 'path_specifier' is already set. Cannot set '(prefix|path)' for type oneof":
'(' is unsupported.
Stack trace:
...
There was a problem hiding this comment.
@sunjayBhatia is right. I've updated the PR to use GTEST_USES_SIMPLE_RE as we have done in other parts of the codebase, so that this can be simplified if/when google test supports capture groups Windows.
There was a problem hiding this comment.
Realistically the only solve is the adoption of RE2, why Google test doesn't support Google RE2 is a little puzzling :-)
We can in fact shift as a project to pcre if we don't believe this is going to happen any time soon.
|
@nigriMSFT Sorry, I know this is annoying, but you need to fix DCO https://github.com/envoyproxy/envoy/blob/master/CONTRIBUTING.md#fixing-dco 🙏🏽. |
Signed-off-by: Nick Grifka <nigri@microsoft.com>
|
Looks good. Running Format check failed, try apply following patch to fix: diff --git a/test/common/router/config_impl_test.cc b/test/common/router/config_impl_test.cc
index 2eab7fc6e..a0796a9f6 100644
--- a/test/common/router/config_impl_test.cc
+++ b/test/common/router/config_impl_test.cc
@@ -5109,12 +5109,12 @@ virtual_hosts:
EXPECT_THAT_THROWS_MESSAGE(
TestConfigImpl(parseRouteConfigurationFromYaml(yaml), factory_context_, true), EnvoyException,
::testing::AnyOf(
- ::testing::ContainsRegex(
- "invalid value oneof field 'path_specifier' is already set. Cannot set 'prefix' for "
- "type oneof"),
- ::testing::ContainsRegex(
- "invalid value oneof field 'path_specifier' is already set. Cannot set 'path' for "
- "type oneof")));
+ ::testing::ContainsRegex(
+ "invalid value oneof field 'path_specifier' is already set. Cannot set 'prefix' for "
+ "type oneof"),
+ ::testing::ContainsRegex(
+ "invalid value oneof field 'path_specifier' is already set. Cannot set 'path' for "
+ "type oneof")));
#endif
}
@@ -5157,12 +5157,12 @@ virtual_hosts:
EXPECT_THAT_THROWS_MESSAGE(
TestConfigImpl(parseRouteConfigurationFromYaml(yaml), factory_context_, true), EnvoyException,
::testing::AnyOf(
- ::testing::ContainsRegex(
- "invalid value oneof field 'path_specifier' is already set. Cannot set 'prefix' for "
- "type oneof"),
- ::testing::ContainsRegex(
- "invalid value oneof field 'path_specifier' is already set. Cannot set 'regex' for "
- "type oneof")));
+ ::testing::ContainsRegex(
+ "invalid value oneof field 'path_specifier' is already set. Cannot set 'prefix' for "
+ "type oneof"),
+ ::testing::ContainsRegex(
+ "invalid value oneof field 'path_specifier' is already set. Cannot set 'regex' for "
+ "type oneof")));
#endif
}
@@ -5205,12 +5205,12 @@ virtual_hosts:
EXPECT_THAT_THROWS_MESSAGE(
TestConfigImpl(parseRouteConfigurationFromYaml(yaml), factory_context_, true), EnvoyException,
::testing::AnyOf(
- ::testing::ContainsRegex(
- "invalid value oneof field 'path_specifier' is already set. Cannot set 'path' for "
- "type oneof"),
- ::testing::ContainsRegex(
- "invalid value oneof field 'path_specifier' is already set. Cannot set 'regex' for "
- "type oneof")));
+ ::testing::ContainsRegex(
+ "invalid value oneof field 'path_specifier' is already set. Cannot set 'path' for "
+ "type oneof"),
+ ::testing::ContainsRegex(
+ "invalid value oneof field 'path_specifier' is already set. Cannot set 'regex' for "
+ "type oneof")));
#endif
} |
Signed-off-by: Nick Grifka <nigri@microsoft.com>
|
/azp run envoy-presubmit |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run envoy-presubmit |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@nigriMSFT sorry. Seems like you need to sync with head to pick some CI fixes. |
Signed-off-by: Nick Grifka <nigri@microsoft.com>
|
@dio Linux-x64 clang_tidy CI job seemed to have hung on "cCmakeMakeRule external/envoy/bazel/foreign_cc/event/include;" but none of the other jobs did. I'm not sure what else I can do here but retry? Is this a known issue? |
|
/azp run envoy-presubmit |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Nick Grifka <nigri@microsoft.com> Signed-off-by: Kevin Baichoo <kbaichoo@google.com>
Signed-off-by: Nick Grifka <nigri@microsoft.com> Signed-off-by: scheler <santosh.cheler@appdynamics.com>
Signed-off-by: Nick Grifka nigri@microsoft.com
Commit Message: test: fix bad route entry test cases on Windows
Additional Description:
Risk Level: Low
Testing: Ran test cases locally on Windows
Docs Changes: NA
Release Notes: NA