2020-06-10 11:18:03 +01:00
|
|
|
package registry
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-07-27 13:22:00 +01:00
|
|
|
"github.com/micro/go-micro/v3/registry"
|
2020-06-10 11:18:03 +01:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestStoreRegex(t *testing.T) {
|
|
|
|
router := newRouter()
|
|
|
|
router.store([]*registry.Service{
|
|
|
|
{
|
|
|
|
Name: "Foobar",
|
|
|
|
Version: "latest",
|
|
|
|
Endpoints: []*registry.Endpoint{
|
|
|
|
{
|
|
|
|
Name: "foo",
|
|
|
|
Metadata: map[string]string{
|
|
|
|
"endpoint": "FooEndpoint",
|
|
|
|
"description": "Some description",
|
|
|
|
"method": "POST",
|
|
|
|
"path": "^/foo/$",
|
|
|
|
"handler": "rpc",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Metadata: map[string]string{},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
assert.Len(t, router.ceps["Foobar.foo"].pcreregs, 1)
|
|
|
|
}
|