mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #88703 from tanjunchen/simplify-code
test/e2e/framework/service/:simplify function CreateTCPService and remove repeat const
This commit is contained in:
commit
26d497ac57
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user