forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
h2_capture_fuzz_test.cc
31 lines (27 loc) · 1.42 KB
/
h2_capture_fuzz_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
#include "test/integration/h2_fuzz.h"
namespace Envoy {
void H2FuzzIntegrationTest::initialize() {
config_helper_.addConfigModifier([&](envoy::config::bootstrap::v3::Bootstrap& bootstrap) -> void {
RELEASE_ASSERT(bootstrap.mutable_static_resources()->clusters_size() >= 1, "");
ConfigHelper::HttpProtocolOptions protocol_options;
protocol_options.mutable_explicit_http_config()
->mutable_http2_protocol_options()
->set_allow_metadata(true);
ConfigHelper::setProtocolOptions(*bootstrap.mutable_static_resources()->mutable_clusters(0),
protocol_options);
});
config_helper_.addConfigModifier(
[&](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager&
hcm) -> void { hcm.mutable_http2_protocol_options()->set_allow_metadata(true); });
setDownstreamProtocol(Http::CodecClient::Type::HTTP2);
setUpstreamProtocol(FakeHttpConnection::Type::HTTP2);
HttpIntegrationTest::initialize();
}
DEFINE_PROTO_FUZZER(const test::integration::H2CaptureFuzzTestCase& input) {
// Pick an IP version to use for loopback, it doesn't matter which.
FUZZ_ASSERT(!TestEnvironment::getIpVersionsForTest().empty());
const auto ip_version = TestEnvironment::getIpVersionsForTest()[0];
PERSISTENT_FUZZ_VAR H2FuzzIntegrationTest h2_fuzz_integration_test(ip_version);
h2_fuzz_integration_test.replay(input, false);
}
} // namespace Envoy