mirror of
https://github.com/alibaba/higress.git
synced 2026-05-27 14:17:27 +08:00
fix UT (#24)
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gogo/protobuf/types"
|
"github.com/gogo/protobuf/types"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
networking "istio.io/api/networking/v1alpha3"
|
networking "istio.io/api/networking/v1alpha3"
|
||||||
)
|
)
|
||||||
@@ -100,9 +101,7 @@ func TestRetryParse(t *testing.T) {
|
|||||||
t.Run("", func(t *testing.T) {
|
t.Run("", func(t *testing.T) {
|
||||||
config := &Ingress{}
|
config := &Ingress{}
|
||||||
_ = retry.Parse(inputCase.input, config, nil)
|
_ = retry.Parse(inputCase.input, config, nil)
|
||||||
if !reflect.DeepEqual(inputCase.expect, config.Retry) {
|
assert.Equal(t, inputCase.expect, config.Retry)
|
||||||
t.Fatalf("Should be equal")
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -379,15 +379,15 @@ func (c *controller) ConvertGateway(convertOptions *common.ConvertOptions, wrapp
|
|||||||
preDomainBuilder, _ := convertOptions.IngressDomainCache.Valid[rule.Host]
|
preDomainBuilder, _ := convertOptions.IngressDomainCache.Valid[rule.Host]
|
||||||
if !exist {
|
if !exist {
|
||||||
wrapperGateway = &common.WrapperGateway{
|
wrapperGateway = &common.WrapperGateway{
|
||||||
Gateway: &networking.Gateway{
|
Gateway: &networking.Gateway{},
|
||||||
Selector: map[string]string{
|
|
||||||
c.options.GatewaySelectorKey: c.options.GatewaySelectorValue,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
WrapperConfig: wrapper,
|
WrapperConfig: wrapper,
|
||||||
ClusterId: c.options.ClusterId,
|
ClusterId: c.options.ClusterId,
|
||||||
Host: rule.Host,
|
Host: rule.Host,
|
||||||
}
|
}
|
||||||
|
if c.options.GatewaySelectorKey != "" {
|
||||||
|
wrapperGateway.Gateway.Selector = map[string]string{c.options.GatewaySelectorKey: c.options.GatewaySelectorValue}
|
||||||
|
|
||||||
|
}
|
||||||
wrapperGateway.Gateway.Servers = append(wrapperGateway.Gateway.Servers, &networking.Server{
|
wrapperGateway.Gateway.Servers = append(wrapperGateway.Gateway.Servers, &networking.Server{
|
||||||
Port: &networking.Port{
|
Port: &networking.Port{
|
||||||
Number: 80,
|
Number: 80,
|
||||||
|
|||||||
@@ -373,15 +373,15 @@ func (c *controller) ConvertGateway(convertOptions *common.ConvertOptions, wrapp
|
|||||||
preDomainBuilder, _ := convertOptions.IngressDomainCache.Valid[rule.Host]
|
preDomainBuilder, _ := convertOptions.IngressDomainCache.Valid[rule.Host]
|
||||||
if !exist {
|
if !exist {
|
||||||
wrapperGateway = &common.WrapperGateway{
|
wrapperGateway = &common.WrapperGateway{
|
||||||
Gateway: &networking.Gateway{
|
Gateway: &networking.Gateway{},
|
||||||
Selector: map[string]string{
|
|
||||||
c.options.GatewaySelectorKey: c.options.GatewaySelectorValue,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
WrapperConfig: wrapper,
|
WrapperConfig: wrapper,
|
||||||
ClusterId: c.options.ClusterId,
|
ClusterId: c.options.ClusterId,
|
||||||
Host: rule.Host,
|
Host: rule.Host,
|
||||||
}
|
}
|
||||||
|
if c.options.GatewaySelectorKey != "" {
|
||||||
|
wrapperGateway.Gateway.Selector = map[string]string{c.options.GatewaySelectorKey: c.options.GatewaySelectorValue}
|
||||||
|
|
||||||
|
}
|
||||||
wrapperGateway.Gateway.Servers = append(wrapperGateway.Gateway.Servers, &networking.Server{
|
wrapperGateway.Gateway.Servers = append(wrapperGateway.Gateway.Servers, &networking.Server{
|
||||||
Port: &networking.Port{
|
Port: &networking.Port{
|
||||||
Number: 80,
|
Number: 80,
|
||||||
|
|||||||
Reference in New Issue
Block a user