From f1ecead06990673bf86ba632063a925ba49bfeaf Mon Sep 17 00:00:00 2001 From: Matt Jaffee Date: Mon, 21 Jan 2019 14:35:06 -0600 Subject: [PATCH] fix failing tests due to staticcheck fixes --- diagnostics_internal_test.go | 8 ++++---- http/handler_internal_test.go | 4 ++-- roaring/roaring_internal_test.go | 6 +++--- server/cluster_test.go | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/diagnostics_internal_test.go b/diagnostics_internal_test.go index f1536e1d1..99c0a83ac 100644 --- a/diagnostics_internal_test.go +++ b/diagnostics_internal_test.go @@ -82,19 +82,19 @@ func TestDiagnosticsVersion_Compare(t *testing.T) { d.SetVersion(version) err := d.compareVersion("v1.7.0") - if !strings.Contains(err.Error(), "A newer version") { + if !strings.Contains(err.Error(), "a newer version") { t.Fatalf("Expected a newer version is available, actual error: %s", err) } err = d.compareVersion("1.7.0") - if !strings.Contains(err.Error(), "A newer version") { + if !strings.Contains(err.Error(), "a newer version") { t.Fatalf("Expected a newer version is available, actual error: %s", err) } err = d.compareVersion("0.7.0") - if !strings.Contains(err.Error(), "The latest Minor release is") { + if !strings.Contains(err.Error(), "the latest minor release is") { t.Fatalf("Expected Minor Version Missmatch, actual error: %s", err) } err = d.compareVersion("0.1.2") - if !strings.Contains(err.Error(), "There is a new patch release of Pilosa") { + if !strings.Contains(err.Error(), "there is a new patch release of Pilosa") { t.Fatalf("Expected Patch Version Missmatch, actual error: %s", err) } err = d.compareVersion("0.1.1") diff --git a/http/handler_internal_test.go b/http/handler_internal_test.go index ecbf8ff87..0cb90655f 100644 --- a/http/handler_internal_test.go +++ b/http/handler_internal_test.go @@ -35,8 +35,8 @@ func TestPostIndexRequestUnmarshalJSON(t *testing.T) { {json: `{"options": {"trackExistence": false}}`, expected: postIndexRequest{Options: pilosa.IndexOptions{TrackExistence: false}}}, {json: `{"options": {"keys": true}}`, expected: postIndexRequest{Options: pilosa.IndexOptions{Keys: true, TrackExistence: true}}}, {json: `{"options": 4}`, err: "options is not map[string]interface{}"}, - {json: `{"option": {}}`, err: "Unknown key: option:map[]"}, - {json: `{"options": {"badKey": "test"}}`, err: "Unknown key: badKey:test"}, + {json: `{"option": {}}`, err: "unknown key: option:map[]"}, + {json: `{"options": {"badKey": "test"}}`, err: "unknown key: badKey:test"}, } for _, test := range tests { actual := &postIndexRequest{} diff --git a/roaring/roaring_internal_test.go b/roaring/roaring_internal_test.go index 33d0c7584..ff45e6c86 100644 --- a/roaring/roaring_internal_test.go +++ b/roaring/roaring_internal_test.go @@ -3224,11 +3224,11 @@ func TestContainerCombinations(t *testing.T) { //func getFunc(func(a, b *container) *container, m, n *container) *container { func runContainerFunc(f interface{}, c ...*Container) *Container { - switch f.(type) { // nolint: staticcheck + switch f := f.(type) { case func(*Container) *Container: - return f.(func(*Container) *Container)(c[0]) + return f(c[0]) case func(*Container, *Container) *Container: - return f.(func(a, b *Container) *Container)(c[0], c[1]) + return f(c[0], c[1]) } return nil } diff --git a/server/cluster_test.go b/server/cluster_test.go index 90467f4b2..617bf6cad 100644 --- a/server/cluster_test.go +++ b/server/cluster_test.go @@ -399,7 +399,7 @@ func TestClusterResize_RemoveNode(t *testing.T) { nodeID := mustNodeID(m0.URL()) resp := test.MustDo("POST", m0.URL()+fmt.Sprintf("/cluster/resize/remove-node"), fmt.Sprintf(`{"id": "%s"}`, nodeID)) - expBody := "removing node: calling node leave: coordinator cannot be removed; first, make a different node the new coordinator." + expBody := "removing node: calling node leave: coordinator cannot be removed; first, make a different node the new coordinator" if resp.StatusCode != http.StatusInternalServerError { t.Fatalf("expected StatusCode %d but got %d", http.StatusInternalServerError, resp.StatusCode) } else if strings.TrimSpace(resp.Body) != expBody {