fix: formating and typo

This commit is contained in:
Anders Liu 2019-12-14 23:25:52 -08:00
parent d7f14fb38e
commit fbe3521e8e
2 changed files with 71 additions and 71 deletions

View File

@ -283,10 +283,10 @@ func (az *Cloud) getLoadBalancerRuleName(service *v1.Service, protocol v1.Protoc
return ruleName
}
// Load balancer rule name must be less or equal to 80 charactors, so excluding the hyphen two segments cannot exceed 79
// Load balancer rule name must be less or equal to 80 characters, so excluding the hyphen two segments cannot exceed 79
subnetSegment := *subnet
if len(ruleName) + len(subnetSegment) + 1 > loadBalancerRuleNameMaxLength {
subnetSegment = subnetSegment[:loadBalancerRuleNameMaxLength - len(ruleName) - 1]
if len(ruleName)+len(subnetSegment)+1 > loadBalancerRuleNameMaxLength {
subnetSegment = subnetSegment[:loadBalancerRuleNameMaxLength-len(ruleName)-1]
}
return fmt.Sprintf("%s-%s-%s-%d", prefix, subnetSegment, protocol, port)
@ -333,7 +333,7 @@ func (az *Cloud) getFrontendIPConfigName(service *v1.Service) string {
if subnetName != nil {
ipcName := fmt.Sprintf("%s-%s", baseName, *subnetName)
// Azure lb front end configuration name must not exceed 80 charactors
// Azure lb front end configuration name must not exceed 80 characters
if len(ipcName) > frontendIPConfigNameMaxLength {
ipcName = ipcName[:frontendIPConfigNameMaxLength]
}

View File

@ -19,8 +19,8 @@ limitations under the License.
package azure
import (
"testing"
"strconv"
"testing"
"github.com/stretchr/testify/assert"
@ -261,7 +261,7 @@ func TestGetLoadBalancingRuleName(t *testing.T) {
svc := &v1.Service{
ObjectMeta: meta.ObjectMeta{
Annotations: map[string]string{ },
Annotations: map[string]string{},
UID: "257b9655-5137-4ad2-b091-ef3f07043ad3",
},
}
@ -285,7 +285,7 @@ func TestGetLoadBalancingRuleName(t *testing.T) {
expected: "a257b965551374ad2b091ef3f07043ad-shortsubnet-TCP-9000",
},
{
description: "internal standard lb should have subnet name on the rule name but truncated to 80 charactors",
description: "internal standard lb should have subnet name on the rule name but truncated to 80 characters",
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
isInternal: true,
useStandardLB: true,
@ -294,7 +294,7 @@ func TestGetLoadBalancingRuleName(t *testing.T) {
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnngg-TCP-9000",
},
{
description: "internal basic lb should have subnet name on the rule name but truncated to 80 charactors",
description: "internal basic lb should have subnet name on the rule name but truncated to 80 characters",
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
isInternal: true,
useStandardLB: false,
@ -365,14 +365,14 @@ func TestGetFrontendIPConfigName(t *testing.T) {
expected: "a257b965551374ad2b091ef3f07043ad-shortsubnet",
},
{
description: "internal standard lb should have subnet name on the frontend ip configuration name but truncated to 80 charactors",
description: "internal standard lb should have subnet name on the frontend ip configuration name but truncated to 80 characters",
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
isInternal: true,
useStandardLB: true,
expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnnggggggggggg",
},
{
description: "internal basic lb should have subnet name on the frontend ip configuration name but truncated to 80 charactors",
description: "internal basic lb should have subnet name on the frontend ip configuration name but truncated to 80 characters",
subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet",
isInternal: true,
useStandardLB: false,