Skip to content

Commit

Permalink
test failing extractor config; add break to switch (#23)
Browse files Browse the repository at this point in the history
* test failing extractor config; add break to switch
  • Loading branch information
yuval-k authored and soloio-bulldozer[bot] committed Sep 2, 2019
1 parent 2d3466c commit 90aada7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,15 @@ InjaTransformer::InjaTransformer(
throw EnvoyException(
fmt::format("Failed to parse body template {}", e.what()));
}
break;
}
case envoy::api::v2::filter::http::TransformationTemplate::
kMergeExtractorsToBody: {
merged_extractors_to_body_ = true;
break;
}
case envoy::api::v2::filter::http::TransformationTemplate::kPassthrough:
break;
case envoy::api::v2::filter::http::TransformationTemplate::
BODY_TRANSFORMATION_NOT_SET: {
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ TEST(ExtractorUtil, ExtractIdFromHeader) {
EXPECT_EQ("123", res);
}

TEST(ExtractorUtil, ExtractorFail) {
Http::TestHeaderMapImpl headers{{":method", "GET"},
{":authority", "www.solo.io"},
{":path", "/users/123"}};
envoy::api::v2::filter::http::Extraction extractor;
extractor.set_header(":path");
extractor.set_regex("ILLEGAL REGEX \\ \\ \\ \\ a\\ \\a\\ a\\ \\d+)");
extractor.set_subgroup(1);
EXPECT_THROW_WITH_MESSAGE(Extractor a(extractor), EnvoyException,
"Invalid regex 'ILLEGAL REGEX \\ \\ \\ \\ a\\ "
"\\a\\ a\\ \\d+)': regex_error");
}

TEST(Transformer, transform) {
Http::TestHeaderMapImpl headers{{":method", "GET"},
{":authority", "www.solo.io"},
Expand Down

0 comments on commit 90aada7

Please sign in to comment.