forked from intel/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp_protocol_integration.cc
101 lines (92 loc) · 4.01 KB
/
http_protocol_integration.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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include "test/integration/http_protocol_integration.h"
#include "absl/strings/str_cat.h"
namespace Envoy {
std::vector<HttpProtocolTestParams> HttpProtocolIntegrationTest::getProtocolTestParams(
const std::vector<Http::CodecType>& downstream_protocols,
const std::vector<Http::CodecType>& upstream_protocols) {
std::vector<HttpProtocolTestParams> ret;
const auto addHttp2TestParametersWithNewCodecWrapperOrDeferredProcessing =
[&ret](Network::Address::IpVersion ip_version, Http::CodecType downstream_protocol,
Http::CodecType upstream_protocol) {
for (Http2Impl impl : {Http2Impl::WrappedNghttp2, Http2Impl::Oghttp2}) {
ret.push_back(HttpProtocolTestParams{ip_version, downstream_protocol, upstream_protocol,
impl, false});
ret.push_back(HttpProtocolTestParams{ip_version, downstream_protocol, upstream_protocol,
impl, true});
}
ret.push_back(HttpProtocolTestParams{ip_version, downstream_protocol, upstream_protocol,
Http2Impl::Nghttp2, true});
};
for (auto ip_version : TestEnvironment::getIpVersionsForTest()) {
for (auto downstream_protocol : downstream_protocols) {
for (auto upstream_protocol : upstream_protocols) {
#ifdef ENVOY_ENABLE_QUIC
ret.push_back(HttpProtocolTestParams{ip_version, downstream_protocol, upstream_protocol,
Http2Impl::Nghttp2, false});
if (downstream_protocol == Http::CodecType::HTTP2 ||
upstream_protocol == Http::CodecType::HTTP2) {
addHttp2TestParametersWithNewCodecWrapperOrDeferredProcessing(
ip_version, downstream_protocol, upstream_protocol);
}
#else
if (downstream_protocol == Http::CodecType::HTTP3 ||
upstream_protocol == Http::CodecType::HTTP3) {
ENVOY_LOG_MISC(warn, "Skipping HTTP/3 as support is compiled out");
} else {
ret.push_back(HttpProtocolTestParams{ip_version, downstream_protocol, upstream_protocol,
Http2Impl::Nghttp2, false});
if (downstream_protocol == Http::CodecType::HTTP2 ||
upstream_protocol == Http::CodecType::HTTP2) {
addHttp2TestParametersWithNewCodecWrapperOrDeferredProcessing(
ip_version, downstream_protocol, upstream_protocol);
}
}
#endif
}
}
}
return ret;
}
absl::string_view upstreamToString(Http::CodecType type) {
switch (type) {
case Http::CodecType::HTTP1:
return "HttpUpstream";
case Http::CodecType::HTTP2:
return "Http2Upstream";
case Http::CodecType::HTTP3:
return "Http3Upstream";
}
return "UnknownUpstream";
}
absl::string_view downstreamToString(Http::CodecType type) {
switch (type) {
case Http::CodecType::HTTP1:
return "HttpDownstream_";
case Http::CodecType::HTTP2:
return "Http2Downstream_";
case Http::CodecType::HTTP3:
return "Http3Downstream_";
}
return "UnknownDownstream";
}
absl::string_view implementationToString(Http2Impl impl) {
switch (impl) {
case Http2Impl::Nghttp2:
return "Nghttp2";
case Http2Impl::WrappedNghttp2:
return "WrappedNghttp2";
case Http2Impl::Oghttp2:
return "Oghttp2";
}
return "UnknownHttp2Impl";
}
std::string HttpProtocolIntegrationTest::protocolTestParamsToString(
const ::testing::TestParamInfo<HttpProtocolTestParams>& params) {
return absl::StrCat((params.param.version == Network::Address::IpVersion::v4 ? "IPv4_" : "IPv6_"),
downstreamToString(params.param.downstream_protocol),
upstreamToString(params.param.upstream_protocol),
implementationToString(params.param.http2_implementation),
params.param.defer_processing_backedup_streams ? "WithDeferredProcessing"
: "NoDeferredProcessing");
}
} // namespace Envoy