This commit is contained in:
Asim Aslam
2019-08-06 09:15:38 +01:00
parent 52d8d26018
commit e16420fdbd
3 changed files with 56 additions and 30 deletions

View File

@@ -50,22 +50,24 @@ func newConsulTestRegistry(r *mockRegistry) (*consulRegistry, func()) {
}
cfg := consul.DefaultConfig()
cfg.Address = l.Addr().String()
cl, _ := consul.NewClient(cfg)
go newMockServer(r, l)
return &consulRegistry{
Address: cfg.Address,
Client: cl,
opts: registry.Options{},
register: make(map[string]uint64),
lastChecked: make(map[string]time.Time),
queryOptions: &consul.QueryOptions{
AllowStale: true,
},
}, func() {
l.Close()
}
var cr = &consulRegistry{
config: cfg,
Address: []string{cfg.Address},
opts: registry.Options{},
register: make(map[string]uint64),
lastChecked: make(map[string]time.Time),
queryOptions: &consul.QueryOptions{
AllowStale: true,
},
}
cr.Client()
return cr, func() {
l.Close()
}
}
func newServiceList(svc []*consul.ServiceEntry) []byte {