Skip to content

Commit

Permalink
unit test fuzzer issue
Browse files Browse the repository at this point in the history
Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
  • Loading branch information
yanjunxiang-google committed Sep 20, 2024
1 parent 4ac853c commit e06a6e0
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ DEFINE_PROTO_FUZZER(
filter->setDecoderFilterCallbacks(mocks.decoder_callbacks_);
filter->setEncoderFilterCallbacks(mocks.encoder_callbacks_);

ExternalProcessing::ExternalProcessorStream* stream = nullptr;
EXPECT_CALL(*client, stream()).WillRepeatedly(Invoke([&stream]() { return stream; }));
EXPECT_CALL(*client, setStream(_))
.WillRepeatedly(Invoke([&stream](ExternalProcessing::ExternalProcessorStream* stream_ptr) {
stream = stream_ptr;
}));
EXPECT_CALL(*client, start(_, _, _, _))
.WillRepeatedly(Invoke([&](ExternalProcessing::ExternalProcessorCallbacks&,
const Grpc::GrpcServiceConfigWithHashKey&,
Expand All @@ -120,8 +114,16 @@ DEFINE_PROTO_FUZZER(
return stream;
}));

ExternalProcessing::ExternalProcessorStream* stream = nullptr;
EXPECT_CALL(*client, stream()).WillRepeatedly(Invoke([&stream]() { return stream; }));
EXPECT_CALL(*client, setStream(_))
.WillRepeatedly(Invoke([&stream](ExternalProcessing::ExternalProcessorStream* stream_ptr) {
stream = stream_ptr;
}));

Envoy::Extensions::HttpFilters::HttpFilterFuzzer fuzzer;
fuzzer.runData(static_cast<Envoy::Http::StreamDecoderFilter*>(filter.get()), input.request());
delete client;
}

} // namespace UnitTestFuzz
Expand Down

0 comments on commit e06a6e0

Please sign in to comment.