go-micro.dev/v5@v5.12.0/util/test/test.go (about) 1 package test 2 3 import ( 4 "go-micro.dev/v5/registry" 5 ) 6 7 var ( 8 // Data is a set of mock registry data. 9 Data = map[string][]*registry.Service{ 10 "foo": { 11 { 12 Name: "foo", 13 Version: "1.0.0", 14 Nodes: []*registry.Node{ 15 { 16 Id: "foo-1.0.0-123", 17 Address: "localhost:9999", 18 }, 19 { 20 Id: "foo-1.0.0-321", 21 Address: "localhost:9999", 22 }, 23 }, 24 }, 25 { 26 Name: "foo", 27 Version: "1.0.1", 28 Nodes: []*registry.Node{ 29 { 30 Id: "foo-1.0.1-321", 31 Address: "localhost:6666", 32 }, 33 }, 34 }, 35 { 36 Name: "foo", 37 Version: "1.0.3", 38 Nodes: []*registry.Node{ 39 { 40 Id: "foo-1.0.3-345", 41 Address: "localhost:8888", 42 }, 43 }, 44 }, 45 }, 46 } 47 ) 48 49 // EmptyChannel will empty out a error channel by checking if an error is 50 // present, and if so return the error. 51 func EmptyChannel(c chan error) error { 52 select { 53 case err := <-c: 54 return err 55 default: 56 return nil 57 } 58 }