-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
filters: allow envoy filters to be created as exception free #30765
Conversation
e0cf27e
to
e410dbf
Compare
Signed-off-by: Alyssa Wilk <[email protected]>
e410dbf
to
ac263ee
Compare
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, awesome! Would you mind updating the PR description briefly to explain the new class name and factory API that this PR introduces?
EXPECT_TRUE(admission_control_filter_factory | ||
.createFilterFactoryFromProtoTyped(proto, "whatever", dual_info_, | ||
factory_context.getServerFactoryContext()) | ||
.ok()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how this construct is working? EXPECT_TRUE
doesn't throw an exception does it? And if the inner part threw an exception then .ok()
wouldn't be true so it seems like it ought to fail either way?
Even if it does work, I think the concept would be more readable like
EXPECT_THAT(admission_control_filter_factory
.createFilterFactoryFromProtoTyped(proto, "whatever", dual_info_,
factory_context.getServerFactoryContext()),
HasStatusMessage(HasSubstr("Success rate threshold cannot be less than 1.0%.")));
Or, if the thing is that it's throwing an exception and the EXPECT_TRUE is being ignored, then
EXPECT_THROW_WITH_MESSAGE(
admission_control_filter_factory
.createFilterFactoryFromProtoTyped(proto, "whatever", dual_info_,
factory_context.getServerFactoryContext())
.IgnoreResult(),
EnvoyException, "Success rate threshold cannot be less than 1.0%.");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the assert is being ignored.
no member named 'IgnoreResult' in 'absl::StatusOr<std::function<void (Envoy::Http::FilterChainFactoryCallbacks &)>>' ditto absl::Status not sure what you're suggesting I use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, memory failure on this. Just dropping the ASSERT
/EXPECT
would be what I would expect to see, I assumed they were there because there was an ABSL_MUST_USE_RESULT
tag involved.
Bit of a search suggests that's probably right (.ok()
is tagged with ABSL_MUST_USE_RESULT
), and I meant replace .ok()
with .IgnoreError()
(from here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oooh yeah that's much cleaner. on it!
Signed-off-by: Alyssa Wilk <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks.
Seems there are three type of ways to handle the return value when we expect a exception. Call thevalue()
directly, call the IgnoreError()
directly, call the status().IgnoreError()
. Is it oversight or by design? (But it's OK for me if CI is passed. I think we will gradually revise these exception to be error message checking?)
@@ -110,7 +112,7 @@ arn: "arn:aws:lambda:region:424242:fun" | |||
testing::NiceMock<Server::Configuration::MockFactoryContext> context; | |||
AwsLambdaFilterFactory factory; | |||
|
|||
EXPECT_THROW(factory.createFilterFactoryFromProto(proto_config, "stats", context), | |||
EXPECT_THROW(factory.createFilterFactoryFromProto(proto_config, "stats", context).value(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: status().IgnoreError()
?
admission_control_filter_factory | ||
.createFilterFactoryFromProtoTyped(proto, "whatever", dual_info_, | ||
factory_context.getServerFactoryContext()) | ||
.IgnoreError(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: status().IgnoreError()
?
EXPECT_THROW(factory_.createFilterFactoryFromProto(config_, "stats", context_).IgnoreError(), | ||
EnvoyException); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto.
Signed-off-by: Alyssa Wilk <[email protected]>
Relates: envoyproxy/envoy#30765 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Relates: envoyproxy/envoy#31189 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Relates: envoyproxy/envoy#31189 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Relates: envoyproxy/envoy#31189 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Relates: envoyproxy/envoy#31189 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Relates: envoyproxy/envoy#31189 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Relates: envoyproxy/envoy#31189 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Relates: envoyproxy/envoy#31189 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Relates: envoyproxy/envoy#31189 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Relates: envoyproxy/envoy#31189 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Relates: envoyproxy/envoy#31189 Signed-off-by: Tam Mach <[email protected]>
Relates: envoyproxy/envoy#30765 Relates: envoyproxy/envoy#31189 Signed-off-by: Tam Mach <[email protected]>
I tried my best here to keep churn minimal, so the default APIs are the same for almost all cc code (though not for tests) and you opt into exceptionless filters.
Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]
envoyproxy/envoy-mobile#176