forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
regex_engine_integration_test.cc
51 lines (40 loc) · 1.45 KB
/
regex_engine_integration_test.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "envoy/extensions/regex_engines/v3/google_re2.pb.h"
#include "envoy/type/matcher/v3/regex.pb.h"
#include "test/integration/base_integration_test.h"
#include "test/test_common/utility.h"
#include "gtest/gtest.h"
namespace Envoy {
namespace {
class RegexEngineIntegrationTest : public testing::TestWithParam<Network::Address::IpVersion>,
public BaseIntegrationTest {
public:
RegexEngineIntegrationTest() : BaseIntegrationTest(GetParam(), config()) {}
// Ensure that regex definitions in the stats matcher config will parse too
static std::string config() {
return absl::StrCat(ConfigHelper::baseConfigNoListeners(), R"EOF(
stats_config:
stats_matcher:
exclusion_list:
patterns:
- safe_regex:
regex: "foobar.+"
- safe_regex:
regex: "barbaz.+"
default_regex_engine:
name: envoy.regex_engines.google_re2
typed_config:
'@type': type.googleapis.com/envoy.extensions.regex_engines.v3.GoogleRE2
)EOF");
}
};
INSTANTIATE_TEST_SUITE_P(IpVersions, RegexEngineIntegrationTest,
testing::ValuesIn(TestEnvironment::getIpVersionsForTest()),
TestUtility::ipTestParamsToString);
TEST_P(RegexEngineIntegrationTest, GoogleRE2) {
initialize();
envoy::type::matcher::v3::RegexMatcher matcher;
*matcher.mutable_regex() = ".*";
EXPECT_NO_THROW(Regex::Utility::parseRegex(matcher));
};
} // namespace
} // namespace Envoy