Toggle support for Gateway API experimental channel
This commit is contained in:
parent
fc897f6756
commit
c84b510f0d
10 changed files with 140 additions and 44 deletions
|
@ -24,12 +24,12 @@ var _ provider.Provider = (*Provider)(nil)
|
|||
|
||||
func TestLoadHTTPRoutes(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
ingressClass string
|
||||
paths []string
|
||||
namespaces []string
|
||||
expected *dynamic.Configuration
|
||||
entryPoints map[string]Entrypoint
|
||||
desc string
|
||||
ingressClass string
|
||||
paths []string
|
||||
expected *dynamic.Configuration
|
||||
entryPoints map[string]Entrypoint
|
||||
experimentalChannel bool
|
||||
}{
|
||||
{
|
||||
desc: "Empty",
|
||||
|
@ -476,6 +476,7 @@ func TestLoadHTTPRoutes(t *testing.T) {
|
|||
entryPoints: map[string]Entrypoint{"TCP": {
|
||||
Address: ":8080",
|
||||
}},
|
||||
experimentalChannel: true,
|
||||
expected: &dynamic.Configuration{
|
||||
UDP: &dynamic.UDPConfiguration{
|
||||
Routers: map[string]*dynamic.UDPRouter{},
|
||||
|
@ -1664,7 +1665,7 @@ func TestLoadHTTPRoutes(t *testing.T) {
|
|||
return
|
||||
}
|
||||
|
||||
p := Provider{EntryPoints: test.entryPoints}
|
||||
p := Provider{EntryPoints: test.entryPoints, ExperimentalChannel: test.experimentalChannel}
|
||||
|
||||
conf := p.loadConfigurationFromGateway(context.Background(), newClientMock(test.paths...))
|
||||
assert.Equal(t, test.expected, conf)
|
||||
|
@ -2905,7 +2906,7 @@ func TestLoadTCPRoutes(t *testing.T) {
|
|||
return
|
||||
}
|
||||
|
||||
p := Provider{EntryPoints: test.entryPoints}
|
||||
p := Provider{EntryPoints: test.entryPoints, ExperimentalChannel: true}
|
||||
conf := p.loadConfigurationFromGateway(context.Background(), newClientMock(test.paths...))
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
|
@ -4034,7 +4035,7 @@ func TestLoadTLSRoutes(t *testing.T) {
|
|||
return
|
||||
}
|
||||
|
||||
p := Provider{EntryPoints: test.entryPoints}
|
||||
p := Provider{EntryPoints: test.entryPoints, ExperimentalChannel: true}
|
||||
conf := p.loadConfigurationFromGateway(context.Background(), newClientMock(test.paths...))
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
|
@ -4043,11 +4044,12 @@ func TestLoadTLSRoutes(t *testing.T) {
|
|||
|
||||
func TestLoadMixedRoutes(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
ingressClass string
|
||||
paths []string
|
||||
expected *dynamic.Configuration
|
||||
entryPoints map[string]Entrypoint
|
||||
desc string
|
||||
ingressClass string
|
||||
paths []string
|
||||
expected *dynamic.Configuration
|
||||
entryPoints map[string]Entrypoint
|
||||
experimentalChannel bool
|
||||
}{
|
||||
{
|
||||
desc: "Empty",
|
||||
|
@ -4159,6 +4161,7 @@ func TestLoadMixedRoutes(t *testing.T) {
|
|||
"tls-1": {Address: ":10000"},
|
||||
"tls-2": {Address: ":11000"},
|
||||
},
|
||||
experimentalChannel: true,
|
||||
expected: &dynamic.Configuration{
|
||||
UDP: &dynamic.UDPConfiguration{
|
||||
Routers: map[string]*dynamic.UDPRouter{},
|
||||
|
@ -4343,6 +4346,7 @@ func TestLoadMixedRoutes(t *testing.T) {
|
|||
"tls-1": {Address: ":10000"},
|
||||
"tls-2": {Address: ":11000"},
|
||||
},
|
||||
experimentalChannel: true,
|
||||
expected: &dynamic.Configuration{
|
||||
UDP: &dynamic.UDPConfiguration{
|
||||
Routers: map[string]*dynamic.UDPRouter{},
|
||||
|
@ -4499,6 +4503,7 @@ func TestLoadMixedRoutes(t *testing.T) {
|
|||
"tls-1": {Address: ":10000"},
|
||||
"tls-2": {Address: ":11000"},
|
||||
},
|
||||
experimentalChannel: true,
|
||||
expected: &dynamic.Configuration{
|
||||
UDP: &dynamic.UDPConfiguration{
|
||||
Routers: map[string]*dynamic.UDPRouter{},
|
||||
|
@ -4749,6 +4754,7 @@ func TestLoadMixedRoutes(t *testing.T) {
|
|||
"tls-1": {Address: ":10000"},
|
||||
"tls-2": {Address: ":11000"},
|
||||
},
|
||||
experimentalChannel: true,
|
||||
expected: &dynamic.Configuration{
|
||||
UDP: &dynamic.UDPConfiguration{
|
||||
Routers: map[string]*dynamic.UDPRouter{},
|
||||
|
@ -4904,6 +4910,7 @@ func TestLoadMixedRoutes(t *testing.T) {
|
|||
"tcp": {Address: ":9000"},
|
||||
"tls": {Address: ":10000"},
|
||||
},
|
||||
experimentalChannel: true,
|
||||
expected: &dynamic.Configuration{
|
||||
UDP: &dynamic.UDPConfiguration{
|
||||
Routers: map[string]*dynamic.UDPRouter{},
|
||||
|
@ -5042,7 +5049,7 @@ func TestLoadMixedRoutes(t *testing.T) {
|
|||
return
|
||||
}
|
||||
|
||||
p := Provider{EntryPoints: test.entryPoints}
|
||||
p := Provider{EntryPoints: test.entryPoints, ExperimentalChannel: test.experimentalChannel}
|
||||
conf := p.loadConfigurationFromGateway(context.Background(), newClientMock(test.paths...))
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
|
@ -5051,11 +5058,12 @@ func TestLoadMixedRoutes(t *testing.T) {
|
|||
|
||||
func TestLoadRoutesWithReferenceGrants(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
ingressClass string
|
||||
paths []string
|
||||
expected *dynamic.Configuration
|
||||
entryPoints map[string]Entrypoint
|
||||
desc string
|
||||
ingressClass string
|
||||
paths []string
|
||||
expected *dynamic.Configuration
|
||||
entryPoints map[string]Entrypoint
|
||||
experimentalChannel bool
|
||||
}{
|
||||
{
|
||||
desc: "Empty",
|
||||
|
@ -5163,6 +5171,7 @@ func TestLoadRoutesWithReferenceGrants(t *testing.T) {
|
|||
entryPoints: map[string]Entrypoint{
|
||||
"tls": {Address: ":9000"},
|
||||
},
|
||||
experimentalChannel: true,
|
||||
expected: &dynamic.Configuration{
|
||||
UDP: &dynamic.UDPConfiguration{
|
||||
Routers: map[string]*dynamic.UDPRouter{},
|
||||
|
@ -5232,7 +5241,7 @@ func TestLoadRoutesWithReferenceGrants(t *testing.T) {
|
|||
return
|
||||
}
|
||||
|
||||
p := Provider{EntryPoints: test.entryPoints}
|
||||
p := Provider{EntryPoints: test.entryPoints, ExperimentalChannel: test.experimentalChannel}
|
||||
conf := p.loadConfigurationFromGateway(context.Background(), newClientMock(test.paths...))
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue