Merge pull request #42551 from shashidharatd/e2e-tests

Automatic merge from submit-queue (batch tested with PRs 42237, 42297, 42279, 42436, 42551)

Cleanup federation_util.go in e2e/framework

The only function GetValidDNSSubdomainName in  test/e2e/framework/federation_util.go is no longer used for some time now. so cleaning it up.

cc @kubernetes/sig-federation-pr-reviews @madhusudancs
This commit is contained in:
Kubernetes Submit Queue 2017-03-24 14:16:28 -07:00 committed by GitHub
commit a34da7644f
2 changed files with 0 additions and 45 deletions

View File

@ -13,7 +13,6 @@ go_library(
"authorizer_util.go",
"cleanup.go",
"exec_util.go",
"federation_util.go",
"firewall_util.go",
"framework.go",
"get-kubemark-resource-usage.go",
@ -40,7 +39,6 @@ go_library(
"//pkg/api:go_default_library",
"//pkg/api/v1:go_default_library",
"//pkg/api/v1/service:go_default_library",
"//pkg/api/validation:go_default_library",
"//pkg/apis/apps/v1beta1:go_default_library",
"//pkg/apis/authorization/v1beta1:go_default_library",
"//pkg/apis/batch:go_default_library",
@ -118,7 +116,6 @@ go_library(
"//vendor:k8s.io/apimachinery/pkg/util/runtime",
"//vendor:k8s.io/apimachinery/pkg/util/sets",
"//vendor:k8s.io/apimachinery/pkg/util/uuid",
"//vendor:k8s.io/apimachinery/pkg/util/validation",
"//vendor:k8s.io/apimachinery/pkg/util/wait",
"//vendor:k8s.io/apimachinery/pkg/util/yaml",
"//vendor:k8s.io/apimachinery/pkg/watch",

View File

@ -1,42 +0,0 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package framework
import (
"fmt"
"regexp"
validationutil "k8s.io/apimachinery/pkg/util/validation"
"k8s.io/kubernetes/pkg/api/validation"
)
// GetValidDNSSubdomainName massages the given name to be a valid dns subdomain name.
// Most resources (such as secrets, clusters) require the names to be valid dns subdomain.
// This is a generic function (not specific to federation). Should be moved to a more generic location if others want to use it.
func GetValidDNSSubdomainName(name string) (string, error) {
// "_" are not allowed. Replace them by "-".
name = regexp.MustCompile("_").ReplaceAllLiteralString(name, "-")
maxLength := validationutil.DNS1123SubdomainMaxLength
if len(name) > maxLength {
name = name[0 : maxLength-1]
}
// Verify that name now passes the validation.
if errors := validation.NameIsDNSSubdomain(name, false); len(errors) != 0 {
return "", fmt.Errorf("errors in converting name to a valid DNS subdomain %s", errors)
}
return name, nil
}