Allow router to be shutdown for tests

This commit is contained in:
Paul Lorenz
2020-04-23 20:20:49 -04:00
parent 991e9413d0
commit c19f0dbbd4
13 changed files with 184 additions and 46 deletions
+17
View File
@@ -591,3 +591,20 @@ func (network *Network) GetServiceCache() Cache {
type Cache interface {
RemoveFromCache(id string)
}
type MultipleErrors []error
func (e MultipleErrors) Error() string {
if len(e) == 0 {
return "no errors occurred"
}
if len(e) == 1 {
return e[0].Error()
}
buf := strings.Builder{}
buf.WriteString("multiple errors occurred")
for idx, err := range e {
buf.WriteString(fmt.Sprintf(" %v: %v", idx, err))
}
return buf.String()
}