fix: empty IngressClassName, Error handling
This commit is contained in:
parent
bbd8073c89
commit
e5fa90db9b
2 changed files with 34 additions and 33 deletions
|
|
@ -39,28 +39,32 @@ func TestIsValidClass(t *testing.T) {
|
|||
}()
|
||||
|
||||
tests := []struct {
|
||||
ingress string
|
||||
controller string
|
||||
defClass string
|
||||
annotation bool
|
||||
k8sClass *networking.IngressClass
|
||||
v1Ready bool
|
||||
isValid bool
|
||||
ingress string
|
||||
controller string
|
||||
defClass string
|
||||
annotation bool
|
||||
ingressClassName bool
|
||||
k8sClass *networking.IngressClass
|
||||
v1Ready bool
|
||||
isValid bool
|
||||
}{
|
||||
{"", "", "nginx", true, nil, false, true},
|
||||
{"", "nginx", "nginx", true, nil, false, true},
|
||||
{"nginx", "nginx", "nginx", true, nil, false, true},
|
||||
{"custom", "custom", "nginx", true, nil, false, true},
|
||||
{"", "killer", "nginx", true, nil, false, false},
|
||||
{"custom", "nginx", "nginx", true, nil, false, false},
|
||||
{"", "custom", "nginx", false,
|
||||
{"", "", "nginx", true, false, nil, false, true},
|
||||
{"", "nginx", "nginx", true, false, nil, false, true},
|
||||
{"nginx", "nginx", "nginx", true, false, nil, false, true},
|
||||
{"custom", "custom", "nginx", true, false, nil, false, true},
|
||||
{"", "killer", "nginx", true, false, nil, false, false},
|
||||
{"custom", "nginx", "nginx", true, false, nil, false, false},
|
||||
{"nginx", "nginx", "nginx", false, true, nil, false, true},
|
||||
{"custom", "nginx", "nginx", false, true, nil, true, false},
|
||||
{"nginx", "nginx", "nginx", false, true, nil, true, true},
|
||||
{"", "custom", "nginx", false, false,
|
||||
&networking.IngressClass{
|
||||
ObjectMeta: meta_v1.ObjectMeta{
|
||||
Name: "custom",
|
||||
},
|
||||
},
|
||||
false, false},
|
||||
{"", "custom", "nginx", false,
|
||||
{"", "custom", "nginx", false, false,
|
||||
&networking.IngressClass{
|
||||
ObjectMeta: meta_v1.ObjectMeta{
|
||||
Name: "custom",
|
||||
|
|
@ -82,6 +86,9 @@ func TestIsValidClass(t *testing.T) {
|
|||
if test.annotation {
|
||||
ing.Annotations[IngressKey] = test.ingress
|
||||
}
|
||||
if test.ingressClassName {
|
||||
ing.Spec.IngressClassName = &[]string{test.ingress}[0]
|
||||
}
|
||||
|
||||
IngressClass = test.controller
|
||||
DefaultClass = test.defClass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue