-
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
Fix ext_proc fuzzer test issues. #27619
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,13 +18,26 @@ namespace UnitTestFuzz { | |
|
||
class FuzzerMocks { | ||
public: | ||
FuzzerMocks() : addr_(std::make_shared<Network::Address::PipeInstance>("/test/test.sock")) { | ||
FuzzerMocks() | ||
: addr_(std::make_shared<Network::Address::PipeInstance>("/test/test.sock")), buffer_("foo") { | ||
ON_CALL(decoder_callbacks_, connection()) | ||
.WillByDefault(Return(OptRef<const Network::Connection>{connection_})); | ||
connection_.stream_info_.downstream_connection_info_provider_->setRemoteAddress(addr_); | ||
connection_.stream_info_.downstream_connection_info_provider_->setLocalAddress(addr_); | ||
ON_CALL(decoder_callbacks_, addDecodedTrailers()).WillByDefault(ReturnRef(request_trailers_)); | ||
ON_CALL(encoder_callbacks_, addEncodedTrailers()).WillByDefault(ReturnRef(response_trailers_)); | ||
ON_CALL(decoder_callbacks_, addDecodedData(_, _)).WillByDefault(Return()); | ||
ON_CALL(encoder_callbacks_, addEncodedData(_, _)).WillByDefault(Return()); | ||
ON_CALL(decoder_callbacks_, decodingBuffer()).WillByDefault(Return(buffer_ptr_ = &buffer_)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason the assignment is being done as part of the I suggest returning the address of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
ON_CALL(encoder_callbacks_, encodingBuffer()).WillByDefault(Return(buffer_ptr_ = &buffer_)); | ||
ON_CALL(decoder_callbacks_, continueDecoding()).WillByDefault(Return()); | ||
ON_CALL(encoder_callbacks_, continueEncoding()).WillByDefault(Return()); | ||
ON_CALL(decoder_callbacks_, modifyDecodingBuffer(_)).WillByDefault(Return()); | ||
ON_CALL(encoder_callbacks_, modifyEncodingBuffer(_)).WillByDefault(Return()); | ||
ON_CALL(decoder_callbacks_, decoderBufferLimit()).WillByDefault(Return(1024)); | ||
ON_CALL(encoder_callbacks_, encoderBufferLimit()).WillByDefault(Return(1024)); | ||
ON_CALL(decoder_callbacks_, injectDecodedDataToFilterChain(_, _)).WillByDefault(Return()); | ||
ON_CALL(encoder_callbacks_, injectEncodedDataToFilterChain(_, _)).WillByDefault(Return()); | ||
} | ||
|
||
NiceMock<Http::MockStreamDecoderFilterCallbacks> decoder_callbacks_; | ||
|
@@ -33,6 +46,8 @@ class FuzzerMocks { | |
NiceMock<Envoy::Network::MockConnection> connection_; | ||
NiceMock<Http::TestRequestTrailerMapImpl> request_trailers_; | ||
NiceMock<Http::TestResponseTrailerMapImpl> response_trailers_; | ||
NiceMock<Buffer::OwnedImpl> buffer_; | ||
NiceMock<Buffer::OwnedImpl>* buffer_ptr_; | ||
testing::NiceMock<StreamInfo::MockStreamInfo> async_client_stream_info_; | ||
}; | ||
|
||
|
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.
Not sure I fully understand this, but I thought that the default behavior of a (Nice)Mock is to return the default value. Do these override a different ON_CALL somewhere?
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.
Yeah,no need. removed.