kubectl: change legacyscheme codecs to direct codecs (no conversion)

This commit is contained in:
Sean Sullivan
2018-10-31 15:11:40 -07:00
parent b8731a76f0
commit 1e161bb329
4 changed files with 50 additions and 8 deletions

View File

@@ -39,7 +39,23 @@ func TestProtocolsForObject(t *testing.T) {
Ports: []corev1.ContainerPort{
{
ContainerPort: 101,
Protocol: "tcp",
Protocol: "TCP",
},
},
},
},
},
},
},
// No protocol--should default to TCP.
{
object: &corev1.Pod{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Ports: []corev1.ContainerPort{
{
ContainerPort: 101,
},
},
},
@@ -53,7 +69,19 @@ func TestProtocolsForObject(t *testing.T) {
Ports: []corev1.ServicePort{
{
Port: 101,
Protocol: "tcp",
Protocol: "TCP",
},
},
},
},
},
// No protocol for service port--default to TCP
{
object: &corev1.Service{
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{
{
Port: 101,
},
},
},
@@ -69,7 +97,7 @@ func TestProtocolsForObject(t *testing.T) {
Ports: []corev1.ContainerPort{
{
ContainerPort: 101,
Protocol: "tcp",
Protocol: "TCP",
},
},
},
@@ -89,7 +117,7 @@ func TestProtocolsForObject(t *testing.T) {
Ports: []corev1.ContainerPort{
{
ContainerPort: 101,
Protocol: "tcp",
Protocol: "TCP",
},
},
},
@@ -109,7 +137,7 @@ func TestProtocolsForObject(t *testing.T) {
Ports: []corev1.ContainerPort{
{
ContainerPort: 101,
Protocol: "tcp",
Protocol: "TCP",
},
},
},
@@ -124,7 +152,7 @@ func TestProtocolsForObject(t *testing.T) {
expectErr: true,
},
}
expectedPorts := map[string]string{"101": "tcp"}
expectedPorts := map[string]string{"101": "TCP"}
for _, test := range tests {
actual, err := protocolsForObject(test.object)