From 16d92650130d0e5670300953909dcfcb09dd1547 Mon Sep 17 00:00:00 2001 From: Tim Middleton Date: Tue, 21 May 2024 16:30:57 +0800 Subject: [PATCH 1/2] Minor health command update --- pkg/cmd/utils.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cmd/utils.go b/pkg/cmd/utils.go index d9bdc26..d2f55ec 100644 --- a/pkg/cmd/utils.go +++ b/pkg/cmd/utils.go @@ -685,6 +685,10 @@ func parseHealthEndpoints(endpointCSV string) ([]string, error) { for _, v := range endpoints { _, err := url.ParseRequestURI(v) if err != nil { + if v == "" { + // ignore invalid URLS + continue + } return validEndpoints, fmt.Errorf("url [%s] is not valid", v) } validEndpoints = append(validEndpoints, v) From cd063e0ee13ca3cf596027cc421b260286ef4c3a Mon Sep 17 00:00:00 2001 From: Tim Middleton Date: Tue, 21 May 2024 16:35:14 +0800 Subject: [PATCH 2/2] fix unit test --- pkg/cmd/utils_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/utils_test.go b/pkg/cmd/utils_test.go index e782f07..d1f9130 100644 --- a/pkg/cmd/utils_test.go +++ b/pkg/cmd/utils_test.go @@ -67,7 +67,7 @@ func TestDecodeMemberDetails(t *testing.T) { func TestParseHealthEndpoints(t *testing.T) { g := NewGomegaWithT(t) _, err := parseHealthEndpoints("") - g.Expect(err).To(HaveOccurred()) + g.Expect(err).To(Not(HaveOccurred())) // special empty case _, err = parseHealthEndpoints("rubbish") g.Expect(err).To(HaveOccurred())