default `ProxyType` for prop override extension

pull/17657/head
Chris Thain 2023-06-12 09:31:13 -07:00
parent 131d234bda
commit 1adc48734d
2 changed files with 4 additions and 1 deletions

View File

@ -261,6 +261,9 @@ func (p *propertyOverride) validate() error {
} }
} }
if p.ProxyType == "" {
p.ProxyType = api.ServiceKindConnectProxy
}
if err := validProxyTypes.CheckRequired(string(p.ProxyType), "ProxyType"); err != nil { if err := validProxyTypes.CheckRequired(string(p.ProxyType), "ProxyType"); err != nil {
resultErr = multierror.Append(resultErr, err) resultErr = multierror.Append(resultErr, err)
} }

View File

@ -236,7 +236,7 @@ func TestConstructor(t *testing.T) {
// enforces expected behavior until we do. Multi-member slices should be unaffected // enforces expected behavior until we do. Multi-member slices should be unaffected
// by WeakDecode as it is a more-permissive version of the default behavior. // by WeakDecode as it is a more-permissive version of the default behavior.
"single value Patches decoded as map construction succeeds": { "single value Patches decoded as map construction succeeds": {
arguments: makeArguments(map[string]any{"Patches": makePatch(map[string]any{})}), arguments: makeArguments(map[string]any{"Patches": makePatch(map[string]any{}), "ProxyType": nil}),
expected: validTestCase(OpAdd, extensioncommon.TrafficDirectionOutbound, ResourceTypeRoute).expected, expected: validTestCase(OpAdd, extensioncommon.TrafficDirectionOutbound, ResourceTypeRoute).expected,
ok: true, ok: true,
}, },