Fixed test findings.
This commit is contained in:
parent
881e352d68
commit
880b3dc5f1
4 changed files with 14 additions and 13 deletions
|
@ -33,6 +33,7 @@ var (
|
||||||
annotationSecureVerifyCACert = parser.GetAnnotationWithPrefix("secure-verify-ca-secret")
|
annotationSecureVerifyCACert = parser.GetAnnotationWithPrefix("secure-verify-ca-secret")
|
||||||
annotationPassthrough = parser.GetAnnotationWithPrefix("ssl-passthrough")
|
annotationPassthrough = parser.GetAnnotationWithPrefix("ssl-passthrough")
|
||||||
annotationAffinityType = parser.GetAnnotationWithPrefix("affinity")
|
annotationAffinityType = parser.GetAnnotationWithPrefix("affinity")
|
||||||
|
annotationAffinityMode = parser.GetAnnotationWithPrefix("affinity-mode")
|
||||||
annotationCorsEnabled = parser.GetAnnotationWithPrefix("enable-cors")
|
annotationCorsEnabled = parser.GetAnnotationWithPrefix("enable-cors")
|
||||||
annotationCorsAllowMethods = parser.GetAnnotationWithPrefix("cors-allow-methods")
|
annotationCorsAllowMethods = parser.GetAnnotationWithPrefix("cors-allow-methods")
|
||||||
annotationCorsAllowHeaders = parser.GetAnnotationWithPrefix("cors-allow-headers")
|
annotationCorsAllowHeaders = parser.GetAnnotationWithPrefix("cors-allow-headers")
|
||||||
|
@ -205,8 +206,8 @@ func TestAffinitySession(t *testing.T) {
|
||||||
{map[string]string{annotationAffinityType: "cookie", annotationAffinityMode: "balanced", annotationAffinityCookieName: "route"}, "cookie", "balanced", "route"},
|
{map[string]string{annotationAffinityType: "cookie", annotationAffinityMode: "balanced", annotationAffinityCookieName: "route"}, "cookie", "balanced", "route"},
|
||||||
{map[string]string{annotationAffinityType: "cookie", annotationAffinityMode: "persistent", annotationAffinityCookieName: "route1"}, "cookie", "persistent", "route1"},
|
{map[string]string{annotationAffinityType: "cookie", annotationAffinityMode: "persistent", annotationAffinityCookieName: "route1"}, "cookie", "persistent", "route1"},
|
||||||
{map[string]string{annotationAffinityType: "cookie", annotationAffinityMode: "balanced", annotationAffinityCookieName: ""}, "cookie", "balanced", "INGRESSCOOKIE"},
|
{map[string]string{annotationAffinityType: "cookie", annotationAffinityMode: "balanced", annotationAffinityCookieName: ""}, "cookie", "balanced", "INGRESSCOOKIE"},
|
||||||
{map[string]string{}, "", ""},
|
{map[string]string{}, "", "", ""},
|
||||||
{nil, "", ""},
|
{nil, "", "", ""},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, foo := range fooAnns {
|
for _, foo := range fooAnns {
|
||||||
|
@ -214,7 +215,7 @@ func TestAffinitySession(t *testing.T) {
|
||||||
r := ec.Extract(ing).SessionAffinity
|
r := ec.Extract(ing).SessionAffinity
|
||||||
t.Logf("Testing pass %v %v", foo.affinitytype, foo.name)
|
t.Logf("Testing pass %v %v", foo.affinitytype, foo.name)
|
||||||
|
|
||||||
if (r.Mode != foo.affinitymode) {
|
if r.Mode != foo.affinitymode {
|
||||||
t.Errorf("Returned %v but expected %v for Name", r.Mode, foo.affinitymode)
|
t.Errorf("Returned %v but expected %v for Name", r.Mode, foo.affinitymode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -261,8 +261,8 @@ describe("Sticky", function()
|
||||||
assert.spy(s).was_not_called()
|
assert.spy(s).was_not_called()
|
||||||
end
|
end
|
||||||
|
|
||||||
it("does not set a cookie", test_no_cookie(sticky_balanced))
|
it("does not set a cookie", function() test_no_cookie(sticky_balanced) end)
|
||||||
it("does not set a cookie", test_no_cookie(sticky_persistent))
|
it("does not set a cookie", function() test_no_cookie(sticky_persistent) end)
|
||||||
|
|
||||||
local function test_correct_endpoint(sticky)
|
local function test_correct_endpoint(sticky)
|
||||||
local sticky_balancer_instance = sticky:new(test_backend)
|
local sticky_balancer_instance = sticky:new(test_backend)
|
||||||
|
@ -340,16 +340,16 @@ describe("Sticky", function()
|
||||||
end
|
end
|
||||||
|
|
||||||
it("changes upstream when change_on_failure option is true", function()
|
it("changes upstream when change_on_failure option is true", function()
|
||||||
test(sticky_balanced, 'balanced', true)
|
test(sticky_balanced, true)
|
||||||
end)
|
end)
|
||||||
it("changes upstream when change_on_failure option is true", function()
|
it("changes upstream when change_on_failure option is true", function()
|
||||||
test(sticky_balanced, 'balanced', false)
|
test(sticky_balanced, false)
|
||||||
end)
|
end)
|
||||||
it("changes upstream when change_on_failure option is true", function()
|
it("changes upstream when change_on_failure option is true", function()
|
||||||
test(sticky_persistent, 'balanced', true)
|
test(sticky_persistent, true)
|
||||||
end)
|
end)
|
||||||
it("changes upstream when change_on_failure option is true", function()
|
it("changes upstream when change_on_failure option is true", function()
|
||||||
test(sticky_persistent, 'balanced', false)
|
test(sticky_persistent, false)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in a new issue