diff --git a/nginx-controller/controller/controller.go b/nginx-controller/controller/controller.go index 563bf1b128..d10c4165f0 100644 --- a/nginx-controller/controller/controller.go +++ b/nginx-controller/controller/controller.go @@ -679,7 +679,7 @@ func (lbc *LoadBalancerController) syncIng(task Task) { } return } - err = lbc.cnf.AddOrUpdateMergableIngress(mergeableIngExs) + err = lbc.cnf.AddOrUpdateMergeableIngress(mergeableIngExs) if err != nil { lbc.recorder.Eventf(ing, api_v1.EventTypeWarning, "AddedOrUpdatedWithError", "Configuration for %v(Master) was added or updated, but not applied: %v", key, err) for _, minion := range mergeableIngExs.Minions { @@ -804,7 +804,7 @@ func (lbc *LoadBalancerController) syncSecret(task Task) { glog.Errorf("Ignoring Ingress %v(Minion): %v", minion.Name, err) continue } - err = lbc.cnf.AddOrUpdateMergableIngress(mergeableIngress) + err = lbc.cnf.AddOrUpdateMergeableIngress(mergeableIngress) if err != nil { glog.Errorf("Failed to update Ingress %v(Master) of %v(Minion): %v", master.Name, minion.Name, err) } @@ -864,7 +864,7 @@ func (lbc *LoadBalancerController) syncSecret(task Task) { glog.Errorf("Ignoring Ingress %v(Minion): %v", minion.Name, err) continue } - err = lbc.cnf.AddOrUpdateMergableIngress(mergeableIngress) + err = lbc.cnf.AddOrUpdateMergeableIngress(mergeableIngress) if err != nil { glog.Errorf("Failed to update Ingress %v(Master) of %v(Minion): %v", master.Name, minion.Name, err) } diff --git a/nginx-controller/nginx/configurator.go b/nginx-controller/nginx/configurator.go index f31296cf8d..1f002a7297 100644 --- a/nginx-controller/nginx/configurator.go +++ b/nginx-controller/nginx/configurator.go @@ -80,8 +80,8 @@ func (cnf *Configurator) addOrUpdateIngress(ingEx *IngressEx) error { return nil } -// AddOrUpdateMergableIngress adds or updates NGINX configuration for the Ingress resources with Mergeable Types -func (cnf *Configurator) AddOrUpdateMergableIngress(mergeableIngs *MergeableIngresses) error { +// AddOrUpdateMergeableIngress adds or updates NGINX configuration for the Ingress resources with Mergeable Types +func (cnf *Configurator) AddOrUpdateMergeableIngress(mergeableIngs *MergeableIngresses) error { if err := cnf.addOrUpdateMergeableIngress(mergeableIngs); err != nil { return fmt.Errorf("Error when adding or updating ingress %v/%v: %v", mergeableIngs.Master.Ingress.Namespace, mergeableIngs.Master.Ingress.Name, err) } diff --git a/nginx-controller/nginx/configurator_test.go b/nginx-controller/nginx/configurator_test.go index fbb8732d6e..f63f4688f1 100644 --- a/nginx-controller/nginx/configurator_test.go +++ b/nginx-controller/nginx/configurator_test.go @@ -668,20 +668,20 @@ func TestAddOrUpdateIngress(t *testing.T) { } } -func TestAddOrUpdateMergableIngress(t *testing.T) { +func TestAddOrUpdateMergeableIngress(t *testing.T) { cnf, err := createTestConfigurator() if err != nil { t.Errorf("Failed to create a test configurator: %v", err) } mergeableIngess := createMergeableCafeIngress() - err = cnf.AddOrUpdateMergableIngress(mergeableIngess) + err = cnf.AddOrUpdateMergeableIngress(mergeableIngess) if err != nil { - t.Errorf("AddOrUpdateMergableIngress returned \n%v, expected \n%v", err, nil) + t.Errorf("AddOrUpdateMergeableIngress returned \n%v, expected \n%v", err, nil) } - cnfHasMergableIngress := cnf.HasIngress(mergeableIngess.Master.Ingress) - if !cnfHasMergableIngress { - t.Errorf("AddOrUpdateMergableIngress didn't add mergable ingress successfully. HasIngress returned %v, expected %v", cnfHasMergableIngress, true) + cnfHasMergeableIngress := cnf.HasIngress(mergeableIngess.Master.Ingress) + if !cnfHasMergeableIngress { + t.Errorf("AddOrUpdateMergeableIngress didn't add mergeable ingress successfully. HasIngress returned %v, expected %v", cnfHasMergeableIngress, true) } } @@ -698,16 +698,16 @@ func TestAddOrUpdateIngressFailsWithInvalidIngressTemplate(t *testing.T) { } } -func TestAddOrUpdateMergableIngressFailsWithInvalidIngressTemplate(t *testing.T) { +func TestAddOrUpdateMergeableIngressFailsWithInvalidIngressTemplate(t *testing.T) { cnf, err := createTestConfiguratorInvalidIngressTemplate() if err != nil { t.Errorf("Failed to create a test configurator: %v", err) } mergeableIngess := createMergeableCafeIngress() - err = cnf.AddOrUpdateMergableIngress(mergeableIngess) + err = cnf.AddOrUpdateMergeableIngress(mergeableIngess) if err == nil { - t.Errorf("AddOrUpdateMergableIngress returned \n%v, but expected \n%v", nil, "template execution error") + t.Errorf("AddOrUpdateMergeableIngress returned \n%v, but expected \n%v", nil, "template execution error") } }