fix todo: use the ServiceTestJig replace of service

This commit is contained in:
hangaoshuai
2018-02-03 12:06:52 +08:00
parent 230726ffbe
commit 7c7be149d9
2 changed files with 31 additions and 33 deletions

View File

@@ -211,6 +211,20 @@ func (j *ServiceTestJig) CreateExternalNameServiceOrFail(namespace string, tweak
return result
}
// CreateServiceWithServicePort creates a new Service with ServicePort.
func (j *ServiceTestJig) CreateServiceWithServicePort(labels map[string]string, namespace string, ports []v1.ServicePort) (*v1.Service, error) {
service := &v1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: j.Name,
},
Spec: v1.ServiceSpec{
Selector: labels,
Ports: ports,
},
}
return j.Client.CoreV1().Services(namespace).Create(service)
}
func (j *ServiceTestJig) ChangeServiceType(namespace, name string, newType v1.ServiceType, timeout time.Duration) {
ingressIP := ""
svc := j.UpdateServiceOrFail(namespace, name, func(s *v1.Service) {