mirror of
https://github.com/status-im/consul.git
synced 2025-01-19 10:15:06 +00:00
a7803bd829
* xds: Ensure v2 route match is populated for gRPC Similar to HTTP, ensure that route match config (which is required by Envoy) is populated when default values are used. Because the default matches generated for gRPC contain a single empty `GRPCRouteMatch`, and that proto does not directly support prefix-based config, an interpretation of the empty struct is needed to generate the same output that the `HTTPRouteMatch` is explicitly configured to provide in internal/mesh/internal/controllers/routes/generate.go. * xds: Ensure protocol set for gRPC resources Add explicit protocol in `ProxyStateTemplate` builders and validate it is always set on clusters. This ensures that HTTP filters and `http2_protocol_options` are populated in all the necessary places for gRPC traffic and prevents future unintended omissions of non-TCP protocols. Co-authored-by: John Murret <john.murret@hashicorp.com> --------- Co-authored-by: John Murret <john.murret@hashicorp.com>
20 lines
747 B
Go
20 lines
747 B
Go
package pbproxystate
|
|
|
|
import (
|
|
"testing"
|
|
|
|
pbcatalog "github.com/hashicorp/consul/proto-public/pbcatalog/v2beta1"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// TestMirrorsCatalogProtocol ensures that there is no unintended drift between pbcatalog.Protocol and
|
|
// pbproxystate.Protocol.
|
|
func TestMirrorsCatalogProtocol(t *testing.T) {
|
|
require.Equal(t, pbcatalog.Protocol_value, Protocol_value, "pbcatalog.Protocol and pbproxystate.Protocol have diverged")
|
|
for i := range pbcatalog.Protocol_name {
|
|
require.Equal(t, pbcatalog.Protocol_name[i], Protocol_name[i],
|
|
"pbcatalog.Protocol and pbproxystate.Protocol ordinals do not match;"+
|
|
" ordinals for equivalent values must match so that casting between them produces expected results")
|
|
}
|
|
}
|