lint: test warnings

This commit is contained in:
Umputun
2019-06-25 20:06:30 -05:00
parent 5b79f7c435
commit f6e69e86bb
12 changed files with 24 additions and 21 deletions
+1 -1
View File
@@ -26,13 +26,13 @@ import (
"github.com/umputun/remark/backend/app/migrator"
"github.com/umputun/remark/backend/app/notify"
"github.com/umputun/remark/backend/app/remote"
"github.com/umputun/remark/backend/app/rest/api"
"github.com/umputun/remark/backend/app/rest/proxy"
"github.com/umputun/remark/backend/app/store"
"github.com/umputun/remark/backend/app/store/admin"
"github.com/umputun/remark/backend/app/store/engine"
"github.com/umputun/remark/backend/app/store/image"
"github.com/umputun/remark/backend/app/store/remote"
"github.com/umputun/remark/backend/app/store/service"
)
@@ -21,6 +21,7 @@ func TestClient_Call(t *testing.T) {
assert.NoError(t, err)
res := ""
err = json.Unmarshal(*resp.Result, &res)
assert.NoError(t, err)
assert.Equal(t, "12345", res)
t.Logf("%v %T", res, res)
}
@@ -43,6 +44,7 @@ func TestClient_CallWithObject(t *testing.T) {
assert.NoError(t, err)
res := ""
err = json.Unmarshal(*resp.Result, &res)
assert.NoError(t, err)
assert.Equal(t, "12345", res)
t.Logf("%v %T", res, res)
}
@@ -55,6 +57,7 @@ func TestClient_CallWithNoParams(t *testing.T) {
assert.NoError(t, err)
res := ""
err = json.Unmarshal(*resp.Result, &res)
assert.NoError(t, err)
assert.Equal(t, "12345", res)
t.Logf("%v %T", res, res)
}
@@ -39,8 +39,8 @@ func TestServerPrimitiveTypes(t *testing.T) {
return r
})
go func() { s.Run(9091) }()
defer func() { assert.NoError(t, s.Shutdown()) }()
go func() { _ = s.Run(9091) }()
defer func() { s.Shutdown() }()
time.Sleep(10 * time.Millisecond)
// check with direct http call
@@ -93,7 +93,7 @@ func TestServerWithObject(t *testing.T) {
return r
})
go func() { s.Run(9091) }()
go func() { _ = s.Run(9091) }()
defer func() { assert.NoError(t, s.Shutdown()) }()
time.Sleep(10 * time.Millisecond)
@@ -145,7 +145,7 @@ func TestServerWithAuth(t *testing.T) {
return r
})
go func() { s.Run(9091) }()
go func() { _ = s.Run(9091) }()
time.Sleep(10 * time.Millisecond)
defer func() { assert.NoError(t, s.Shutdown()) }()
@@ -183,7 +183,7 @@ func TestServerErrReturn(t *testing.T) {
return r
})
go func() { s.Run(9091) }()
go func() { _ = s.Run(9091) }()
defer func() { assert.NoError(t, s.Shutdown()) }()
time.Sleep(10 * time.Millisecond)
@@ -202,7 +202,7 @@ func TestServerGroup(t *testing.T) {
return Response{}
},
})
go func() { s.Run(9091) }()
go func() { _ = s.Run(9091) }()
defer func() { assert.NoError(t, s.Shutdown()) }()
time.Sleep(10 * time.Millisecond)
@@ -221,7 +221,7 @@ func TestServerAddLate(t *testing.T) {
s.Add("fn1", func(id uint64, params json.RawMessage) Response {
return Response{}
})
go func() { s.Run(9091) }()
go func() { _ = s.Run(9091) }()
defer func() { assert.NoError(t, s.Shutdown()) }()
time.Sleep(10 * time.Millisecond)
+1 -1
View File
@@ -9,7 +9,7 @@ package admin
import (
"encoding/json"
"github.com/umputun/remark/backend/app/store/remote"
"github.com/umputun/remark/backend/app/remote"
)
// Remote implements remote engine and delegates all Calls to remote http server
+1 -1
View File
@@ -16,7 +16,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/umputun/remark/backend/app/store/remote"
"github.com/umputun/remark/backend/app/remote"
)
func TestRemote_Key(t *testing.T) {
+6 -6
View File
@@ -19,8 +19,7 @@ func TestBoltDB_CreateAndFind(t *testing.T) {
var b, teardown = prep(t)
defer teardown()
var bb Interface
bb = b
var bb Interface = b
_ = bb
req := FindRequest{Locator: store.Locator{URL: "https://radio-t.com", SiteID: "radio-t"}, Sort: "time"}
@@ -117,8 +116,8 @@ func TestBoltDB_Update(t *testing.T) {
err = b.Update(comment)
assert.EqualError(t, err, `site "bad" not found`)
comment.Locator.SiteID="radio-t"
comment.Locator.URL="https://radio-t.com-bad"
comment.Locator.SiteID = "radio-t"
comment.Locator.URL = "https://radio-t.com-bad"
err = b.Update(comment)
assert.EqualError(t, err, `no bucket https://radio-t.com-bad in store`)
}
@@ -451,6 +450,7 @@ func TestBolt_FlagReadOnlyPost(t *testing.T) {
req = FlagRequest{Locator: store.Locator{SiteID: "radio-t", URL: "url-1"}, Flag: ReadOnly, Update: FlagTrue}
val, err = b.Flag(req)
assert.NoError(t, err)
assert.Equal(t, true, val)
req = FlagRequest{Locator: store.Locator{SiteID: "radio-t", URL: "url-1"}, Flag: ReadOnly}
val, err = b.Flag(req)
assert.NoError(t, err)
@@ -816,7 +816,7 @@ func prep(t *testing.T) (b *BoltDB, teardown func()) {
func getReq(locator store.Locator, commentID string) GetRequest {
return GetRequest{
Locator: locator,
Locator: locator,
CommentID: commentID,
}
}
}
+1 -1
View File
@@ -3,8 +3,8 @@ package engine
import (
"encoding/json"
"github.com/umputun/remark/backend/app/remote"
"github.com/umputun/remark/backend/app/store"
"github.com/umputun/remark/backend/app/store/remote"
)
// Remote implements remote engine and delegates all Calls to remote http server
+1 -1
View File
@@ -12,8 +12,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/umputun/remark/backend/app/remote"
"github.com/umputun/remark/backend/app/store"
"github.com/umputun/remark/backend/app/store/remote"
)
func TestRemote_Create(t *testing.T) {
+3 -3
View File
@@ -957,7 +957,7 @@ func TestService_UserCount(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 1, c)
c, err = b.UserCount("radio-t", "userBad")
_, err = b.UserCount("radio-t", "userBad")
assert.EqualError(t, err, "no comments for user userBad in store for radio-t site")
}
@@ -1082,7 +1082,7 @@ func teardown(_ *testing.T) {
func getReq(locator store.Locator, commentID string) engine.GetRequest {
return engine.GetRequest{
Locator: locator,
Locator: locator,
CommentID: commentID,
}
}
}