TEST_F(ClusterInfoImplTest, Http3) {
  const std::string yaml = TestEnvironment::substitute(R"EOF(
    name: name
    connect_timeout: 0.25s
    type: STRICT_DNS
    lb_policy: MAGLEV
    load_assignment:
        endpoints:
          - lb_endpoints:
            - endpoint:
                address:
                  socket_address:
                    address: foo.bar.com
                    port_value: 443
    transport_socket:
      name: envoy.transport_sockets.quic
      typed_config:
        "@type": type.googleapis.com/envoy.extensions.transport_sockets.quic.v3.QuicUpstreamTransport
        upstream_tls_context:
          common_tls_context:
            tls_certificates:
            - certificate_chain:
                filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem"
              private_key:
                filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem"
            validation_context:
              trusted_ca:
                filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem"
              match_typed_subject_alt_names:
              - matcher:
                  exact: localhost
                san_type: URI
              - matcher:
                  exact: 127.0.0.1
                san_type: IP_ADDRESS
  )EOF",
                                                       Network::Address::IpVersion::v4);
  auto cluster1 = makeCluster(yaml);
  ASSERT_TRUE(cluster1->info()->idleTimeout().has_value());
  EXPECT_EQ(std::chrono::hours(1), cluster1->info()->idleTimeout().value());

  const std::string explicit_http3 = R"EOF(
    typed_extension_protocol_options:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        explicit_http_config:
          http3_protocol_options:
            quic_protocol_options:
              max_concurrent_streams: 2
        common_http_protocol_options:
          idle_timeout: 1s
  )EOF";

  const std::string downstream_http3 = R"EOF(
    typed_extension_protocol_options:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        use_downstream_protocol_config:
          http3_protocol_options: {}
        common_http_protocol_options:
          idle_timeout: 1s
  )EOF";

  auto explicit_h3 = makeCluster(yaml + explicit_http3);
  EXPECT_EQ(Http::Protocol::Http3,
            explicit_h3->info()->upstreamHttpProtocol({Http::Protocol::Http10})[0]);
  EXPECT_EQ(
      explicit_h3->info()->http3Options().quic_protocol_options().max_concurrent_streams().value(),
      2);

  auto downstream_h3 = makeCluster(yaml + downstream_http3);
  EXPECT_EQ(Http::Protocol::Http3,
            downstream_h3->info()->upstreamHttpProtocol({Http::Protocol::Http3})[0]);
  EXPECT_FALSE(
      downstream_h3->info()->http3Options().quic_protocol_options().has_max_concurrent_streams());
}
TEST_F(ClusterInfoImplTest, Http3) {
  const std::string yaml = TestEnvironment::substitute(R"EOF(
    name: name
    connect_timeout: 0.25s
    type: STRICT_DNS
    lb_policy: MAGLEV
    load_assignment:
        endpoints:
          - lb_endpoints:
            - endpoint:
                address:
                  socket_address:
                    address: foo.bar.com
                    port_value: 443
    transport_socket:
      name: envoy.transport_sockets.quic
      typed_config:
        "@type": type.googleapis.com/envoy.extensions.transport_sockets.quic.v3.QuicUpstreamTransport
        upstream_tls_context:
          common_tls_context:
            tls_certificates:
            - certificate_chain:
                filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem"
              private_key:
                filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem"
            validation_context:
              trusted_ca:
                filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem"
              match_typed_subject_alt_names:
              - matcher:
                  exact: localhost
                san_type: URI
              - matcher:
                  exact: 127.0.0.1
                san_type: IP_ADDRESS
  )EOF",
                                                       Network::Address::IpVersion::v4);
  auto cluster1 = makeCluster(yaml);
  ASSERT_TRUE(cluster1->info()->idleTimeout().has_value());
  EXPECT_EQ(std::chrono::hours(1), cluster1->info()->idleTimeout().value());

  const std::string explicit_http3 = R"EOF(
    typed_extension_protocol_options:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        explicit_http_config:
          http3_protocol_options:
            quic_protocol_options:
              max_concurrent_streams: 2
        common_http_protocol_options:
          idle_timeout: 1s
  )EOF";

  const std::string downstream_http3 = R"EOF(
    typed_extension_protocol_options:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        use_downstream_protocol_config:
          http3_protocol_options: {}
        common_http_protocol_options:
          idle_timeout: 1s
  )EOF";

  auto explicit_h3 = makeCluster(yaml + explicit_http3);
  EXPECT_EQ(Http::Protocol::Http3,
            explicit_h3->info()->upstreamHttpProtocol({Http::Protocol::Http10})[0]);
  EXPECT_EQ(
      explicit_h3->info()->http3Options().quic_protocol_options().max_concurrent_streams().value(),
      2);

  auto downstream_h3 = makeCluster(yaml + downstream_http3);
  EXPECT_EQ(Http::Protocol::Http3,
            downstream_h3->info()->upstreamHttpProtocol({Http::Protocol::Http3})[0]);
  EXPECT_FALSE(
      downstream_h3->info()->http3Options().quic_protocol_options().has_max_concurrent_streams());
}