Improve text, error level, tests...

This commit is contained in:
Per Bernhardt 2019-03-12 13:52:52 +01:00
parent 8a40e82ffb
commit c995e13249
2 changed files with 33 additions and 31 deletions

View file

@ -1199,6 +1199,10 @@ func mergeAlternativeBackends(ing *ingress.Ingress, upstreams map[string]*ingres
altUps := upstreams[upsName]
if altUps == nil {
klog.Warningf("alternative backend %s has already been removed", upsName)
} else {
merged := false
for _, loc := range servers[defServerName].Locations {
@ -1217,6 +1221,7 @@ func mergeAlternativeBackends(ing *ingress.Ingress, upstreams map[string]*ingres
delete(upstreams, altUps.Name)
}
}
}
for _, rule := range ing.Spec.Rules {
for _, path := range rule.HTTP.Paths {
@ -1225,7 +1230,7 @@ func mergeAlternativeBackends(ing *ingress.Ingress, upstreams map[string]*ingres
altUps := upstreams[upsName]
if altUps == nil {
klog.Errorf("alternative backend %s has already be removed", upsName)
klog.Warningf("alternative backend %s has already been removed", upsName)
continue
}

View file

@ -759,8 +759,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
})
})
Context("Single canary Ingress with multiple paths to same backend", func() {
It("should work", func() {
It("does not crash when canary ingress has multiple paths to the same non-matching backend", func() {
host := "foo"
canaryIngName := fmt.Sprintf("%v-canary", host)
annotations := map[string]string{
@ -769,7 +768,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
}
paths := []string{"/foo", "/bar"}
ing := framework.NewSingleIngressWithMultiplePaths(canaryIngName, paths, host, f.Namespace, "httpy-svc-canary", 80, &annotations)
f.EnsureIngress(ing)
@ -781,5 +779,4 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
return Expect(server).Should(ContainSubstring("server_name foo"))
})
})
})
})