AlexStocks commented on a change in pull request #310:
URL: https://github.com/apache/dubbo-go-pixiu/pull/310#discussion_r759896373



##########
File path: pkg/router/route_test.go
##########
@@ -99,72 +92,73 @@ func TestFindMethod(t *testing.T) {
        e = rt.PutAPI(router.API{URLPattern: "/vought/:id/supe/:name", Method: 
n1})
        assert.Nil(t, e)
 
-       m, ok := rt.FindAPI("/theboys", config.MethodGet)
+       m, ok := rt.MatchAPI("/theboys", config.MethodGet)
        assert.True(t, ok)
        assert.NotNil(t, m)
        assert.Equal(t, m.URLPattern, "/theboys")
 
-       m, ok = rt.FindAPI("/theboys", config.MethodPost)
+       m, ok = rt.MatchAPI("/theboys", config.MethodPost)
        assert.False(t, ok)
        assert.Nil(t, m)
 
-       m, ok = rt.FindAPI("/vought/123/supe/startlight", config.MethodPost)
+       m, ok = rt.MatchAPI("/vought/123/supe/startlight", config.MethodPost)
        assert.True(t, ok)
        assert.NotNil(t, m)
        assert.Equal(t, m.URLPattern, "/vought/:id/supe/:name")
 
-       m, ok = rt.FindAPI("/vought/123/supe/startlight", config.MethodPost)
+       m, ok = rt.MatchAPI("/vought/123/supe/startlight", config.MethodPost)
        assert.True(t, ok)
        assert.NotNil(t, m)
        assert.Equal(t, m.URLPattern, "/vought/:id/supe/:name")
 }
 
-func TestUpdateMethod(t *testing.T) {
-       m0 := getMockMethod(config.MethodGet)
-       m1 := getMockMethod(config.MethodGet)
-       m0.DubboBackendConfig.Version = "1.0.0"
-       m1.DubboBackendConfig.Version = "2.0.0"
-
-       rt := NewRoute()
-       rt.PutAPI(router.API{URLPattern: "/marvel", Method: m0})
-       m, _ := rt.FindAPI("/marvel", config.MethodGet)
-       assert.Equal(t, m.DubboBackendConfig.Version, "1.0.0")
-       rt.UpdateAPI(router.API{URLPattern: "/marvel", Method: m1})
-       m, ok := rt.FindAPI("/marvel", config.MethodGet)
-       assert.True(t, ok)
-       assert.Equal(t, m.DubboBackendConfig.Version, "2.0.0")
-
-       rt.PutAPI(router.API{URLPattern: "/theboys/:id", Method: m0})
-       m, _ = rt.FindAPI("/theBoys/12345", config.MethodGet)
-       assert.Equal(t, m.DubboBackendConfig.Version, "1.0.0")
-       rt.UpdateAPI(router.API{URLPattern: "/theBoys/:id", Method: m1})
-       m, ok = rt.FindAPI("/theBoys/12345", config.MethodGet)
-       assert.True(t, ok)
-       assert.Equal(t, m.DubboBackendConfig.Version, "2.0.0")
-}
-
-func TestSearchWildcard(t *testing.T) {
-       rt := &Route{
-               tree:         avltree.NewWithStringComparator(),
-               wildcardTree: avltree.NewWithStringComparator(),
-       }
-       n0 := getMockMethod(config.MethodGet)
-       e := rt.PutAPI(router.API{URLPattern: "/theboys", Method: n0})
-       assert.Nil(t, e)
-       e = rt.PutAPI(router.API{URLPattern: "/theboys/:id", Method: n0})
-       assert.Nil(t, e)
-       e = rt.PutAPI(router.API{URLPattern: "/vought/:id/supe/:name", Method: 
n0})
-       assert.Nil(t, e)
-
-       _, ok := rt.searchWildcard("/marvel")
-       assert.False(t, ok)
-       _, ok = rt.searchWildcard("/theboys/:id/age")
-       assert.False(t, ok)
-       _, ok = rt.searchWildcard("/theboys/butcher")
-       assert.True(t, ok)
-       _, ok = rt.searchWildcard("/vought/:id/supe/homelander")
-       assert.True(t, ok)
-}
+//
+//func TestUpdateMethod(t *testing.T) {

Review comment:
       确定无用了吗?无用就删掉。




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to