Add Namespace to e2eservice.TestJig, make all methods use jig namespace and name

Many TestJig methods made the caller pass a serviceName argument, even
though the jig already has a name, and every caller was passing the
same name to each function as they had passed to NewTestJig().

Likewise, many methods made the caller pass a namespace argument, but
only a single test used more than one namespace, and it can easily be
rewritten to use two test jigs as well.
This commit is contained in:
Dan Winship
2019-07-31 17:40:00 -04:00
parent a0ad420018
commit 52b366457f
9 changed files with 274 additions and 272 deletions

View File

@@ -841,8 +841,8 @@ func (cont *NginxIngressController) Init() {
// --publish-service flag (see <IngressManifestPath>/nginx/rc.yaml) to make it work in private
// clusters, i.e. clusters where nodes don't have public IPs.
framework.Logf("Creating load balancer service for nginx ingress controller")
serviceJig := e2eservice.NewTestJig(cont.Client, "nginx-ingress-lb")
_, err := serviceJig.CreateTCPService(cont.Ns, func(svc *v1.Service) {
serviceJig := e2eservice.NewTestJig(cont.Client, cont.Ns, "nginx-ingress-lb")
_, err := serviceJig.CreateTCPService(func(svc *v1.Service) {
svc.Spec.Type = v1.ServiceTypeLoadBalancer
svc.Spec.Selector = map[string]string{"k8s-app": "nginx-ingress-lb"}
svc.Spec.Ports = []v1.ServicePort{
@@ -851,7 +851,7 @@ func (cont *NginxIngressController) Init() {
{Name: "stats", Port: 18080}}
})
framework.ExpectNoError(err)
cont.lbSvc, err = serviceJig.WaitForLoadBalancer(cont.Ns, "nginx-ingress-lb", e2eservice.GetServiceLoadBalancerCreationTimeout(cont.Client))
cont.lbSvc, err = serviceJig.WaitForLoadBalancer(e2eservice.GetServiceLoadBalancerCreationTimeout(cont.Client))
framework.ExpectNoError(err)
read := func(file string) string {