Skip to content

Commit 1f2d0ad

Browse files
fix(router_test): update router tests to use global RouterConfig and Tag types
1 parent cf1713d commit 1f2d0ad

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

cluster/router/tag/router_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ import (
2727
)
2828

2929
import (
30-
"dubbo.apache.org/dubbo-go/v3/cluster/router"
3130
"dubbo.apache.org/dubbo-go/v3/common"
3231
common_cfg "dubbo.apache.org/dubbo-go/v3/common/config"
3332
"dubbo.apache.org/dubbo-go/v3/common/constant"
3433
"dubbo.apache.org/dubbo-go/v3/common/extension"
3534
"dubbo.apache.org/dubbo-go/v3/config_center"
3635
"dubbo.apache.org/dubbo-go/v3/config_center/configurator"
36+
"dubbo.apache.org/dubbo-go/v3/global"
3737
"dubbo.apache.org/dubbo-go/v3/protocol/base"
3838
"dubbo.apache.org/dubbo-go/v3/protocol/invocation"
3939
)
@@ -134,7 +134,7 @@ func TestRouter(t *testing.T) {
134134
t.Run("dynamicEmptyTag_requestEmptyTag", func(t *testing.T) {
135135
p, err := NewTagPriorityRouter()
136136
assert.Nil(t, err)
137-
p.routerConfigs.Store(consumerUrl.Service()+constant.TagRouterRuleSuffix, router.RouterConfig{
137+
p.routerConfigs.Store(consumerUrl.Service()+constant.TagRouterRuleSuffix, global.RouterConfig{
138138
Key: consumerUrl.Service() + constant.TagRouterRuleSuffix,
139139
Force: falsePointer,
140140
Enabled: truePointer,
@@ -154,7 +154,7 @@ func TestRouter(t *testing.T) {
154154
t.Run("dynamicEmptyTag_requestHasTag", func(t *testing.T) {
155155
p, err := NewTagPriorityRouter()
156156
assert.Nil(t, err)
157-
p.routerConfigs.Store(consumerUrl.Service()+constant.TagRouterRuleSuffix, router.RouterConfig{
157+
p.routerConfigs.Store(consumerUrl.Service()+constant.TagRouterRuleSuffix, global.RouterConfig{
158158
Key: consumerUrl.Service() + constant.TagRouterRuleSuffix,
159159
Force: falsePointer,
160160
Enabled: truePointer,
@@ -175,12 +175,12 @@ func TestRouter(t *testing.T) {
175175
t.Run("dynamicTag_requestEmptyTag", func(t *testing.T) {
176176
p, err := NewTagPriorityRouter()
177177
assert.Nil(t, err)
178-
p.routerConfigs.Store(strings.Join([]string{consumerUrl.GetParam(constant.ApplicationKey, ""), constant.TagRouterRuleSuffix}, ""), router.RouterConfig{
178+
p.routerConfigs.Store(strings.Join([]string{consumerUrl.GetParam(constant.ApplicationKey, ""), constant.TagRouterRuleSuffix}, ""), global.RouterConfig{
179179
Key: consumerUrl.Service() + constant.TagRouterRuleSuffix,
180180
Force: falsePointer,
181181
Enabled: truePointer,
182182
Valid: truePointer,
183-
Tags: []router.Tag{{
183+
Tags: []global.Tag{{
184184
Name: "tag",
185185
Addresses: []string{"192.168.0.3:20000"},
186186
}},
@@ -199,12 +199,12 @@ func TestRouter(t *testing.T) {
199199
t.Run("dynamicTag_emptyAddress_requestHasTag", func(t *testing.T) {
200200
p, err := NewTagPriorityRouter()
201201
assert.Nil(t, err)
202-
p.routerConfigs.Store(consumerUrl.Service()+constant.TagRouterRuleSuffix, router.RouterConfig{
202+
p.routerConfigs.Store(consumerUrl.Service()+constant.TagRouterRuleSuffix, global.RouterConfig{
203203
Key: consumerUrl.Service() + constant.TagRouterRuleSuffix,
204204
Force: falsePointer,
205205
Enabled: truePointer,
206206
Valid: truePointer,
207-
Tags: []router.Tag{{
207+
Tags: []global.Tag{{
208208
Name: "tag",
209209
}},
210210
})
@@ -223,12 +223,12 @@ func TestRouter(t *testing.T) {
223223
t.Run("dynamicTag_address_requestHasTag", func(t *testing.T) {
224224
p, err := NewTagPriorityRouter()
225225
assert.Nil(t, err)
226-
p.routerConfigs.Store(strings.Join([]string{consumerUrl.GetParam(constant.ApplicationKey, ""), constant.TagRouterRuleSuffix}, ""), router.RouterConfig{
226+
p.routerConfigs.Store(strings.Join([]string{consumerUrl.GetParam(constant.ApplicationKey, ""), constant.TagRouterRuleSuffix}, ""), global.RouterConfig{
227227
Key: consumerUrl.Service() + constant.TagRouterRuleSuffix,
228228
Force: falsePointer,
229229
Enabled: truePointer,
230230
Valid: truePointer,
231-
Tags: []router.Tag{{
231+
Tags: []global.Tag{{
232232
Name: "tag",
233233
Addresses: []string{"192.168.0.3:20000"},
234234
}},
@@ -248,12 +248,12 @@ func TestRouter(t *testing.T) {
248248
t.Run("dynamicTag_twoAddress_requestHasTag", func(t *testing.T) {
249249
p, err := NewTagPriorityRouter()
250250
assert.Nil(t, err)
251-
p.routerConfigs.Store(strings.Join([]string{consumerUrl.GetParam(constant.ApplicationKey, ""), constant.TagRouterRuleSuffix}, ""), router.RouterConfig{
251+
p.routerConfigs.Store(strings.Join([]string{consumerUrl.GetParam(constant.ApplicationKey, ""), constant.TagRouterRuleSuffix}, ""), global.RouterConfig{
252252
Key: consumerUrl.Service() + constant.TagRouterRuleSuffix,
253253
Force: falsePointer,
254254
Enabled: truePointer,
255255
Valid: truePointer,
256-
Tags: []router.Tag{{
256+
Tags: []global.Tag{{
257257
Name: "tag",
258258
Addresses: []string{"192.168.0.1:20000", "192.168.0.3:20000"},
259259
}},
@@ -273,12 +273,12 @@ func TestRouter(t *testing.T) {
273273
t.Run("dynamicTag_addressNotMatch_requestHasTag", func(t *testing.T) {
274274
p, err := NewTagPriorityRouter()
275275
assert.Nil(t, err)
276-
p.routerConfigs.Store(consumerUrl.Service()+constant.TagRouterRuleSuffix, router.RouterConfig{
276+
p.routerConfigs.Store(consumerUrl.Service()+constant.TagRouterRuleSuffix, global.RouterConfig{
277277
Key: consumerUrl.Service() + constant.TagRouterRuleSuffix,
278278
Force: falsePointer,
279279
Enabled: truePointer,
280280
Valid: truePointer,
281-
Tags: []router.Tag{{
281+
Tags: []global.Tag{{
282282
Name: "tag",
283283
Addresses: []string{"192.168.0.4:20000"},
284284
}},
@@ -298,12 +298,12 @@ func TestRouter(t *testing.T) {
298298
t.Run("dynamicTag_notValid", func(t *testing.T) {
299299
p, err := NewTagPriorityRouter()
300300
assert.Nil(t, err)
301-
p.routerConfigs.Store(consumerUrl.Service()+constant.TagRouterRuleSuffix, router.RouterConfig{
301+
p.routerConfigs.Store(consumerUrl.Service()+constant.TagRouterRuleSuffix, global.RouterConfig{
302302
Key: consumerUrl.Service() + constant.TagRouterRuleSuffix,
303303
Force: falsePointer,
304304
Enabled: truePointer,
305305
Valid: falsePointer,
306-
Tags: []router.Tag{{
306+
Tags: []global.Tag{{
307307
Name: "tag",
308308
Addresses: []string{"192.168.0.1:20000", "192.168.0.3:20000"},
309309
}},
@@ -367,7 +367,7 @@ tags:
367367
p.Notify(invokerList)
368368
value, ok := p.routerConfigs.Load(url1.GetParam(constant.ApplicationKey, "") + constant.TagRouterRuleSuffix)
369369
assert.True(t, ok)
370-
routerCfg := value.(router.RouterConfig)
370+
routerCfg := value.(global.RouterConfig)
371371
assert.True(t, routerCfg.Key == "org.apache.dubbo.UserProvider.Test")
372372
assert.True(t, len(routerCfg.Tags) == 2)
373373
assert.True(t, *routerCfg.Enabled)

0 commit comments

Comments
 (0)