diff --git a/internal/catalog/internal/types/validators.go b/internal/catalog/internal/types/validators.go index 94691107f9..a9934156e2 100644 --- a/internal/catalog/internal/types/validators.go +++ b/internal/catalog/internal/types/validators.go @@ -139,7 +139,9 @@ func validatePortName(name string) error { func validateProtocol(protocol pbcatalog.Protocol) error { switch protocol { - case pbcatalog.Protocol_PROTOCOL_TCP, + case pbcatalog.Protocol_PROTOCOL_UNSPECIFIED, + // means pbcatalog.FailoverMode_FAILOVER_MODE_TCP + pbcatalog.Protocol_PROTOCOL_TCP, pbcatalog.Protocol_PROTOCOL_HTTP, pbcatalog.Protocol_PROTOCOL_HTTP2, pbcatalog.Protocol_PROTOCOL_GRPC, diff --git a/internal/catalog/internal/types/validators_test.go b/internal/catalog/internal/types/validators_test.go index a3790e9f9e..d62c675cf9 100644 --- a/internal/catalog/internal/types/validators_test.go +++ b/internal/catalog/internal/types/validators_test.go @@ -334,6 +334,26 @@ func TestValidatePortName(t *testing.T) { }) } +func TestValidateProtocol(t *testing.T) { + // this test simply verifies that we accept all enum values specified in our proto + // in order to avoid validator drift. + for name, value := range pbcatalog.Protocol_value { + t.Run(name, func(t *testing.T) { + require.NoError(t, validateProtocol(pbcatalog.Protocol(value))) + }) + } +} + +func TestValidateHealth(t *testing.T) { + // this test simply verifies that we accept all enum values specified in our proto + // in order to avoid validator drift. + for name, value := range pbcatalog.Health_value { + t.Run(name, func(t *testing.T) { + require.NoError(t, validateHealth(pbcatalog.Health(value))) + }) + } +} + func TestValidateWorkloadAddress(t *testing.T) { type testCase struct { addr *pbcatalog.WorkloadAddress