Merge pull request #145 from abursavich/master
consul: use empty slice instead of nil slice when no tags exist for /v1/catalog/services
This commit is contained in:
commit
59c0d35184
|
@ -443,6 +443,11 @@ func TestCatalogListServices(t *testing.T) {
|
|||
if len(out.Services) != 2 {
|
||||
t.Fatalf("bad: %v", out)
|
||||
}
|
||||
for _, s := range out.Services {
|
||||
if s == nil {
|
||||
t.Fatalf("bad: %v", s)
|
||||
}
|
||||
}
|
||||
// Consul service should auto-register
|
||||
if _, ok := out.Services["consul"]; !ok {
|
||||
t.Fatalf("bad: %v", out)
|
||||
|
|
|
@ -480,7 +480,7 @@ func (s *StateStore) Services() (uint64, map[string][]string) {
|
|||
srv := r.(*structs.ServiceNode)
|
||||
tags, ok := services[srv.ServiceName]
|
||||
if !ok {
|
||||
services[srv.ServiceName] = tags
|
||||
services[srv.ServiceName] = make([]string, 0)
|
||||
}
|
||||
|
||||
for _, tag := range srv.ServiceTags {
|
||||
|
|
Loading…
Reference in New Issue