From 7b732b566f259eff6cea9a02ce7f29a136ca09a3 Mon Sep 17 00:00:00 2001 From: Sidhartha Mani Date: Tue, 31 Mar 2020 01:15:21 -0700 Subject: [PATCH] [Bugfix] Fix Net tests being omitted (#9234) --- cmd/admin-handlers.go | 5 ++--- cmd/notification.go | 10 +++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index 100e28367..bd96238ac 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -1388,10 +1388,9 @@ func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request) w.Header().Set(xhttp.ContentType, string(mimeJSON)) w.WriteHeader(http.StatusOK) + enc := json.NewEncoder(w) partialWrite := func() { - jsonBytes, _ := json.Marshal(obdInfo) - _, err := w.Write(jsonBytes) - logger.LogIf(ctx, err) + logger.LogIf(ctx, enc.Encode(obdInfo)) } finish := func() { diff --git a/cmd/notification.go b/cmd/notification.go index 2f771cc83..c29d005bf 100644 --- a/cmd/notification.go +++ b/cmd/notification.go @@ -911,17 +911,13 @@ func (sys *NotificationSys) NetOBDInfo(ctx context.Context) madmin.ServerNetOBDI 'x's should be tested, and 'o's should be skipped */ - stripPath := func(hostPath string) string { - return strings.Split(hostPath, slashSeparator)[0] - } hostSet := set.NewStringSet() for _, ez := range globalEndpoints { for _, e := range ez.Endpoints { - host := stripPath(e.Host) - if hostSet.Contains(host) { - sortedGlobalEndpoints = append(sortedGlobalEndpoints, host) - hostSet.Add(host) + if !hostSet.Contains(e.Host) { + sortedGlobalEndpoints = append(sortedGlobalEndpoints, e.Host) + hostSet.Add(e.Host) } } }