Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit 27ff1b6

Browse files
committed
fix error messages in test. Fatalf=>Errorf to see more errors.
1 parent f8a8a5d commit 27ff1b6

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

server/handler_test.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,9 @@ func TestHandler_Endpoints(t *testing.T) {
690690
r = test.MustNewHTTPRequest("POST", "/index/idx1", strings.NewReader(""))
691691
h.ServeHTTP(w, r)
692692
if w.Code != gohttp.StatusConflict {
693-
t.Fatalf("unexpected status code: %d", w.Code)
694-
} else if w.Body.String() != `{"success":false,"error":{"message":"index already exists"}}`+"\n" {
695-
t.Fatalf("unexpected body: %q", w.Body.String())
693+
t.Errorf("unexpected status code: %d", w.Code)
694+
} else if w.Body.String() != `{"success":false,"error":{"message":"creating index: index already exists"}}`+"\n" {
695+
t.Errorf("unexpected body: %q", w.Body.String())
696696
}
697697

698698
// create field
@@ -710,9 +710,9 @@ func TestHandler_Endpoints(t *testing.T) {
710710
r = test.MustNewHTTPRequest("POST", "/index/idx1/field/fld1", strings.NewReader(""))
711711
h.ServeHTTP(w, r)
712712
if w.Code != gohttp.StatusConflict {
713-
t.Fatalf("unexpected status code: %d", w.Code)
714-
} else if w.Body.String() != `{"success":false,"error":{"message":"field already exists"}}`+"\n" {
715-
t.Fatalf("unexpected body: %q", w.Body.String())
713+
t.Errorf("unexpected status code: %d", w.Code)
714+
} else if w.Body.String() != `{"success":false,"error":{"message":"creating field: field already exists"}}`+"\n" {
715+
t.Errorf("unexpected body: %q", w.Body.String())
716716
}
717717

718718
// delete field
@@ -730,9 +730,9 @@ func TestHandler_Endpoints(t *testing.T) {
730730
r = test.MustNewHTTPRequest("DELETE", "/index/idx1/field/fld1", strings.NewReader(""))
731731
h.ServeHTTP(w, r)
732732
if w.Code != gohttp.StatusNotFound {
733-
t.Fatalf("unexpected status code: %d", w.Code)
734-
} else if w.Body.String() != `{"success":false,"error":{"message":"field not found"}}`+"\n" {
735-
t.Fatalf("unexpected body: %q", w.Body.String())
733+
t.Errorf("unexpected status code: %d", w.Code)
734+
} else if w.Body.String() != `{"success":false,"error":{"message":"deleting field: field not found"}}`+"\n" {
735+
t.Errorf("unexpected body: %q", w.Body.String())
736736
}
737737

738738
// delete index
@@ -750,9 +750,9 @@ func TestHandler_Endpoints(t *testing.T) {
750750
r = test.MustNewHTTPRequest("DELETE", "/index/idx1", strings.NewReader(""))
751751
h.ServeHTTP(w, r)
752752
if w.Code != gohttp.StatusNotFound {
753-
t.Fatalf("unexpected status code: %d", w.Code)
754-
} else if w.Body.String() != `{"success":false,"error":{"message":"index not found"}}`+"\n" {
755-
t.Fatalf("unexpected body: %q", w.Body.String())
753+
t.Errorf("unexpected status code: %d", w.Code)
754+
} else if w.Body.String() != `{"success":false,"error":{"message":"deleting index: index not found"}}`+"\n" {
755+
t.Errorf("unexpected body: %q", w.Body.String())
756756
}
757757
})
758758

0 commit comments

Comments
 (0)