forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp2_integration_test.h
74 lines (56 loc) · 2.52 KB
/
http2_integration_test.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
#include <memory>
#include "envoy/config/bootstrap/v3/bootstrap.pb.h"
#include "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.pb.h"
#include "test/integration/http_integration.h"
#include "absl/synchronization/mutex.h"
#include "gtest/gtest.h"
namespace Envoy {
class Http2IntegrationTest : public testing::TestWithParam<Network::Address::IpVersion>,
public HttpIntegrationTest {
public:
Http2IntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam()) {}
void SetUp() override { setDownstreamProtocol(Http::CodecClient::Type::HTTP2); }
void simultaneousRequest(int32_t request1_bytes, int32_t request2_bytes);
protected:
// Utility function to add filters.
void addFilters(std::vector<std::string> filters) {
for (const auto& filter : filters) {
config_helper_.addFilter(filter);
}
}
};
class Http2RingHashIntegrationTest : public Http2IntegrationTest {
public:
Http2RingHashIntegrationTest();
~Http2RingHashIntegrationTest() override;
void createUpstreams() override;
void sendMultipleRequests(int request_bytes, Http::TestRequestHeaderMapImpl headers,
std::function<void(IntegrationStreamDecoder&)> cb);
std::vector<FakeHttpConnectionPtr> fake_upstream_connections_;
int num_upstreams_ = 5;
};
class Http2MetadataIntegrationTest : public Http2IntegrationTest {
public:
void SetUp() override {
setDownstreamProtocol(Http::CodecClient::Type::HTTP2);
setUpstreamProtocol(FakeHttpConnection::Type::HTTP2);
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); });
}
void testRequestMetadataWithStopAllFilter();
void verifyHeadersOnlyTest();
void runHeaderOnlyTest(bool send_request_body, size_t body_size);
};
} // namespace Envoy