Bumping k8s dependencies to 1.13

This commit is contained in:
Cheng Xing
2018-11-16 14:08:25 -08:00
parent 305407125c
commit b4c0b68ec7
8002 changed files with 884099 additions and 276228 deletions

View File

@@ -61,13 +61,13 @@ func TestGetPreferredAddress(t *testing.T) {
Preferences: []v1.NodeAddressType{v1.NodeHostName, v1.NodeExternalIP},
ExpectAddress: "status-hostname",
},
"found label address": {
"label address ignored": {
Labels: map[string]string{kubeletapis.LabelHostname: "label-hostname"},
Addresses: []v1.NodeAddress{
{Type: v1.NodeExternalIP, Address: "1.2.3.5"},
},
Preferences: []v1.NodeAddressType{v1.NodeHostName, v1.NodeExternalIP},
ExpectAddress: "label-hostname",
ExpectAddress: "1.2.3.5",
},
}
@@ -89,3 +89,35 @@ func TestGetPreferredAddress(t *testing.T) {
}
}
}
func TestGetHostname(t *testing.T) {
testCases := []struct {
hostName string
expectedHostName string
expectError bool
}{
{
hostName: " ",
expectError: true,
},
{
hostName: " abc ",
expectedHostName: "abc",
expectError: false,
},
}
for idx, test := range testCases {
hostName, err := GetHostname(test.hostName)
if err != nil && !test.expectError {
t.Errorf("[%d]: unexpected error: %s", idx, err)
}
if err == nil && test.expectError {
t.Errorf("[%d]: expected error, got none", idx)
}
if test.expectedHostName != hostName {
t.Errorf("[%d]: expected output %q, got %q", idx, test.expectedHostName, hostName)
}
}
}