mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Implement multi-port Endpoints
This is a part of multi-port services.
This commit is contained in:
@@ -220,41 +220,35 @@ func TestEndpointsConversion(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
given: current.Endpoints{
|
||||
TypeMeta: current.TypeMeta{
|
||||
ID: "empty",
|
||||
},
|
||||
Protocol: current.ProtocolTCP,
|
||||
Protocol: "",
|
||||
Endpoints: []string{},
|
||||
},
|
||||
expected: newer.Endpoints{
|
||||
Protocol: newer.ProtocolTCP,
|
||||
Endpoints: []newer.Endpoint{},
|
||||
},
|
||||
},
|
||||
{
|
||||
given: current.Endpoints{
|
||||
TypeMeta: current.TypeMeta{
|
||||
ID: "one",
|
||||
},
|
||||
Protocol: current.ProtocolTCP,
|
||||
Endpoints: []string{"1.2.3.4:88"},
|
||||
},
|
||||
expected: newer.Endpoints{
|
||||
Protocol: newer.ProtocolTCP,
|
||||
Endpoints: []newer.Endpoint{{IP: "1.2.3.4", Port: 88}},
|
||||
Endpoints: []newer.Endpoint{
|
||||
{IP: "1.2.3.4", Ports: []newer.EndpointPort{{Protocol: newer.ProtocolTCP, Port: 88}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
given: current.Endpoints{
|
||||
TypeMeta: current.TypeMeta{
|
||||
ID: "several",
|
||||
},
|
||||
Protocol: current.ProtocolUDP,
|
||||
Endpoints: []string{"1.2.3.4:88", "1.2.3.4:89", "1.2.3.4:90"},
|
||||
},
|
||||
expected: newer.Endpoints{
|
||||
Protocol: newer.ProtocolUDP,
|
||||
Endpoints: []newer.Endpoint{{IP: "1.2.3.4", Port: 88}, {IP: "1.2.3.4", Port: 89}, {IP: "1.2.3.4", Port: 90}},
|
||||
Endpoints: []newer.Endpoint{
|
||||
{IP: "1.2.3.4", Ports: []newer.EndpointPort{{Protocol: newer.ProtocolUDP, Port: 88}}},
|
||||
{IP: "1.2.3.4", Ports: []newer.EndpointPort{{Protocol: newer.ProtocolUDP, Port: 89}}},
|
||||
{IP: "1.2.3.4", Ports: []newer.EndpointPort{{Protocol: newer.ProtocolUDP, Port: 90}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -266,7 +260,7 @@ func TestEndpointsConversion(t *testing.T) {
|
||||
t.Errorf("[Case: %d] Unexpected error: %v", i, err)
|
||||
continue
|
||||
}
|
||||
if got.Protocol != tc.expected.Protocol || !newer.Semantic.DeepEqual(got.Endpoints, tc.expected.Endpoints) {
|
||||
if !newer.Semantic.DeepEqual(got.Endpoints, tc.expected.Endpoints) {
|
||||
t.Errorf("[Case: %d] Expected %v, got %v", i, tc.expected, got)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user