mirror of
https://github.com/status-im/consul.git
synced 2025-02-03 01:14:23 +00:00
use empty slice instead of nil slice when no tags exist for service
This commit is contained in:
parent
686fac0e49
commit
f48dcf0984
@ -449,6 +449,11 @@ func TestCatalogListServices(t *testing.T) {
|
|||||||
if len(out.Services) != 2 {
|
if len(out.Services) != 2 {
|
||||||
t.Fatalf("bad: %v", out)
|
t.Fatalf("bad: %v", out)
|
||||||
}
|
}
|
||||||
|
for _, s := range out.Services {
|
||||||
|
if s == nil {
|
||||||
|
t.Fatalf("bad: %v", s)
|
||||||
|
}
|
||||||
|
}
|
||||||
// Consul service should auto-register
|
// Consul service should auto-register
|
||||||
if _, ok := out.Services["consul"]; !ok {
|
if _, ok := out.Services["consul"]; !ok {
|
||||||
t.Fatalf("bad: %v", out)
|
t.Fatalf("bad: %v", out)
|
||||||
|
@ -480,7 +480,7 @@ func (s *StateStore) Services() (uint64, map[string][]string) {
|
|||||||
srv := r.(*structs.ServiceNode)
|
srv := r.(*structs.ServiceNode)
|
||||||
tags, ok := services[srv.ServiceName]
|
tags, ok := services[srv.ServiceName]
|
||||||
if !ok {
|
if !ok {
|
||||||
services[srv.ServiceName] = tags
|
services[srv.ServiceName] = make([]string, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tag := range srv.ServiceTags {
|
for _, tag := range srv.ServiceTags {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user