Add appProtocol to EndpointSlice.Port
This commit is contained in:
@@ -88,6 +88,34 @@ func TestValidateEndpointSlice(t *testing.T) {
|
||||
}},
|
||||
},
|
||||
},
|
||||
"app-protocols": {
|
||||
expectedErrors: 0,
|
||||
endpointSlice: &discovery.EndpointSlice{
|
||||
ObjectMeta: standardMeta,
|
||||
AddressType: addressTypePtr(discovery.AddressTypeIP),
|
||||
Ports: []discovery.EndpointPort{{
|
||||
Name: utilpointer.StringPtr("one"),
|
||||
Protocol: protocolPtr(api.ProtocolTCP),
|
||||
AppProtocol: utilpointer.StringPtr("HTTP"),
|
||||
}, {
|
||||
Name: utilpointer.StringPtr("two"),
|
||||
Protocol: protocolPtr(api.ProtocolTCP),
|
||||
AppProtocol: utilpointer.StringPtr("https"),
|
||||
}, {
|
||||
Name: utilpointer.StringPtr("three"),
|
||||
Protocol: protocolPtr(api.ProtocolTCP),
|
||||
AppProtocol: utilpointer.StringPtr("my-protocol"),
|
||||
}, {
|
||||
Name: utilpointer.StringPtr("four"),
|
||||
Protocol: protocolPtr(api.ProtocolTCP),
|
||||
AppProtocol: utilpointer.StringPtr("example.com/custom-protocol"),
|
||||
}},
|
||||
Endpoints: []discovery.Endpoint{{
|
||||
Addresses: generateIPAddresses(1),
|
||||
Hostname: utilpointer.StringPtr("valid-123"),
|
||||
}},
|
||||
},
|
||||
},
|
||||
"empty-port-name": {
|
||||
expectedErrors: 0,
|
||||
endpointSlice: &discovery.EndpointSlice{
|
||||
@@ -390,6 +418,22 @@ func TestValidateEndpointSlice(t *testing.T) {
|
||||
}},
|
||||
},
|
||||
},
|
||||
"bad-app-protocol": {
|
||||
expectedErrors: 1,
|
||||
endpointSlice: &discovery.EndpointSlice{
|
||||
ObjectMeta: standardMeta,
|
||||
AddressType: addressTypePtr(discovery.AddressTypeIP),
|
||||
Ports: []discovery.EndpointPort{{
|
||||
Name: utilpointer.StringPtr("http"),
|
||||
Protocol: protocolPtr(api.ProtocolTCP),
|
||||
AppProtocol: utilpointer.StringPtr("--"),
|
||||
}},
|
||||
Endpoints: []discovery.Endpoint{{
|
||||
Addresses: generateIPAddresses(1),
|
||||
Hostname: utilpointer.StringPtr("valid-123"),
|
||||
}},
|
||||
},
|
||||
},
|
||||
"empty-everything": {
|
||||
expectedErrors: 3,
|
||||
endpointSlice: &discovery.EndpointSlice{
|
||||
|
Reference in New Issue
Block a user