test/e2e/framework/service/:simplify function CreateTCPService

This commit is contained in:
tanjunchen 2020-03-01 22:33:42 +08:00
parent debb1edee1
commit b63be6a46d
2 changed files with 1 additions and 11 deletions

View File

@ -29,9 +29,7 @@ const (
// Many tests create an endpoint per node, in large clusters, this is
// resource and time intensive.
MaxNodesForEndpointsTests = 3
)
const (
// KubeProxyLagTimeout is the maximum time a kube-proxy daemon on a node is allowed
// to not notice a Service update, such as type=NodePort.
// TODO: This timeout should be O(10s), observed values are O(1m), 5m is very

View File

@ -117,15 +117,7 @@ func (j *TestJig) CreateTCPServiceWithPort(tweak func(svc *v1.Service), port int
// defaults. Callers can provide a function to tweak the Service object before
// it is created.
func (j *TestJig) CreateTCPService(tweak func(svc *v1.Service)) (*v1.Service, error) {
svc := j.newServiceTemplate(v1.ProtocolTCP, 80)
if tweak != nil {
tweak(svc)
}
result, err := j.Client.CoreV1().Services(j.Namespace).Create(context.TODO(), svc, metav1.CreateOptions{})
if err != nil {
return nil, fmt.Errorf("failed to create TCP Service %q: %v", svc.Name, err)
}
return j.sanityCheckService(result, svc.Spec.Type)
return j.CreateTCPServiceWithPort(tweak, 80)
}
// CreateUDPService creates a new UDP Service based on the j's