remove log package usage from tests, sort imports

This commit is contained in:
Dmitry Verkhoturov
2020-04-13 16:01:51 -05:00
committed by Umputun
parent 360f47e16b
commit afc94adc1b
22 changed files with 24 additions and 25 deletions
@@ -10,6 +10,7 @@ import (
"encoding/json"
"github.com/go-pkgz/jrpc"
"github.com/umputun/remark/backend/app/store/admin"
)
@@ -14,6 +14,7 @@ import (
"github.com/go-pkgz/jrpc"
"github.com/stretchr/testify/assert"
"github.com/umputun/remark/backend/app/store/admin"
)
@@ -10,6 +10,7 @@ import (
"encoding/json"
"github.com/go-pkgz/jrpc"
"github.com/umputun/remark/backend/app/store"
"github.com/umputun/remark/backend/app/store/engine"
)
@@ -15,6 +15,7 @@ import (
"github.com/go-pkgz/jrpc"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/umputun/remark/backend/app/store"
"github.com/umputun/remark/backend/app/store/engine"
)
@@ -19,6 +19,7 @@ import (
"github.com/go-pkgz/jrpc"
"github.com/stretchr/testify/assert"
"github.com/umputun/remark/backend/app/store/image"
)
+1 -1
View File
@@ -8,10 +8,10 @@ package server
import (
"github.com/go-pkgz/jrpc"
"github.com/umputun/remark/backend/app/store/image"
"github.com/umputun/remark/backend/app/store/admin"
"github.com/umputun/remark/backend/app/store/engine"
"github.com/umputun/remark/backend/app/store/image"
)
// RPC handler wraps both engine and remote server and implements all handlers for data store and admin store
@@ -15,7 +15,6 @@ import (
"time"
"github.com/go-pkgz/jrpc"
log "github.com/go-pkgz/lgr"
"github.com/stretchr/testify/require"
"github.com/umputun/remark/memory_store/accessor"
@@ -64,7 +63,7 @@ func prepTestStore(t *testing.T) (s *RPC, port int, teardown func()) {
port = chooseRandomUnusedPort()
go func() {
log.Printf("%v", s.Run(port))
t.Logf("%v", s.Run(port))
}()
waitForHTTPServerStart(port)
+1 -1
View File
@@ -3,9 +3,9 @@ package cmd
import (
"path"
bolt "go.etcd.io/bbolt"
log "github.com/go-pkgz/lgr"
"github.com/pkg/errors"
bolt "go.etcd.io/bbolt"
"github.com/go-pkgz/auth/avatar"
)
+1 -1
View File
@@ -14,13 +14,13 @@ import (
"syscall"
"time"
bolt "go.etcd.io/bbolt"
"github.com/dgrijalva/jwt-go"
"github.com/go-pkgz/jrpc"
log "github.com/go-pkgz/lgr"
"github.com/kyokomi/emoji"
authcache "github.com/patrickmn/go-cache"
"github.com/pkg/errors"
bolt "go.etcd.io/bbolt"
"github.com/go-pkgz/auth"
"github.com/go-pkgz/auth/avatar"
+1 -2
View File
@@ -13,7 +13,6 @@ import (
"testing"
"time"
log "github.com/go-pkgz/lgr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -62,7 +61,7 @@ func TestGetDump(t *testing.T) {
assert.True(t, strings.Contains(dump, "goroutine"))
assert.True(t, strings.Contains(dump, "[running]"))
assert.True(t, strings.Contains(dump, "backend/app/main.go"))
log.Printf("\n dump: %s", dump)
t.Logf("\n dump: %s", dump)
}
func chooseRandomUnusedPort() (port int) {
+1 -1
View File
@@ -6,9 +6,9 @@ import (
"testing"
"time"
bolt "go.etcd.io/bbolt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
bolt "go.etcd.io/bbolt"
"github.com/umputun/remark/backend/app/store"
"github.com/umputun/remark/backend/app/store/admin"
+1 -1
View File
@@ -6,9 +6,9 @@ import (
"testing"
"time"
bolt "go.etcd.io/bbolt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
bolt "go.etcd.io/bbolt"
"github.com/umputun/remark/backend/app/store"
"github.com/umputun/remark/backend/app/store/admin"
+2 -3
View File
@@ -10,10 +10,9 @@ import (
"testing"
"time"
bolt "go.etcd.io/bbolt"
log "github.com/go-pkgz/lgr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
bolt "go.etcd.io/bbolt"
"github.com/umputun/remark/backend/app/store"
"github.com/umputun/remark/backend/app/store/admin"
@@ -35,7 +34,7 @@ func TestNative_Export(t *testing.T) {
assert.Equal(t, 2, size)
c1 := buf.String()
log.Print(c1)
t.Log(c1)
dec := json.NewDecoder(strings.NewReader(c1))
+1 -1
View File
@@ -6,9 +6,9 @@ import (
"testing"
"time"
bolt "go.etcd.io/bbolt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
bolt "go.etcd.io/bbolt"
"github.com/umputun/remark/backend/app/store"
"github.com/umputun/remark/backend/app/store/admin"
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"testing"
"time"
jwt "github.com/dgrijalva/jwt-go"
"github.com/dgrijalva/jwt-go"
"github.com/go-pkgz/auth/token"
cache "github.com/go-pkgz/lcw"
R "github.com/go-pkgz/rest"
+1 -4
View File
@@ -17,15 +17,14 @@ import (
"testing"
"time"
bolt "go.etcd.io/bbolt"
"github.com/go-pkgz/auth"
"github.com/go-pkgz/auth/avatar"
"github.com/go-pkgz/auth/token"
cache "github.com/go-pkgz/lcw"
log "github.com/go-pkgz/lgr"
R "github.com/go-pkgz/rest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
bolt "go.etcd.io/bbolt"
"github.com/umputun/remark/backend/app/migrator"
"github.com/umputun/remark/backend/app/notify"
@@ -327,8 +326,6 @@ func TestRest_cacheControl(t *testing.T) {
}
func startupT(t *testing.T) (ts *httptest.Server, srv *Rest, teardown func()) {
log.Setup(log.CallerFile, log.CallerFunc, log.Msec, log.LevelBraces)
tmp := os.TempDir()
var testDb string
// pick a file name which is not in use for sure
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/umputun/remark/backend/app/store"
)
@@ -20,7 +21,7 @@ func TestUser_GetUserInfo(t *testing.T) {
assert.Equal(t, store.User{Name: "test", ID: "id", SiteID: "test"}, u)
}
func TestUSer_MustGetUserInfo(t *testing.T) {
func TestUser_MustGetUserInfo(t *testing.T) {
defer func() {
if r := recover(); r != nil {
t.Log("recovered from panic")
+1 -1
View File
@@ -7,10 +7,10 @@ import (
"strings"
"time"
bolt "go.etcd.io/bbolt"
log "github.com/go-pkgz/lgr"
"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
bolt "go.etcd.io/bbolt"
"github.com/umputun/remark/backend/app/store"
)
+1 -1
View File
@@ -6,9 +6,9 @@ import (
"testing"
"time"
bolt "go.etcd.io/bbolt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
bolt "go.etcd.io/bbolt"
"github.com/umputun/remark/backend/app/store"
)
+1 -1
View File
@@ -7,9 +7,9 @@ import (
"path"
"time"
bolt "go.etcd.io/bbolt"
log "github.com/go-pkgz/lgr"
"github.com/pkg/errors"
bolt "go.etcd.io/bbolt"
)
const imagesStagedBktName = "imagesStaged"
+1 -1
View File
@@ -15,12 +15,12 @@ import (
"testing"
"time"
bolt "go.etcd.io/bbolt"
"github.com/go-pkgz/lgr"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
bolt "go.etcd.io/bbolt"
"github.com/umputun/remark/backend/app/store"
"github.com/umputun/remark/backend/app/store/admin"
+1 -2
View File
@@ -6,7 +6,6 @@ import (
"testing"
"time"
log "github.com/go-pkgz/lgr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -84,7 +83,7 @@ func TestMakeEmptySubtree(t *testing.T) {
res := MakeTree(comments, "time", 0)
resJSON, err := json.Marshal(&res)
require.NoError(t, err)
log.Print(string(resJSON))
t.Log(string(resJSON))
expJSON := mustLoadJSONFile(t, "testdata/tree_del.json")
assert.Equal(t, string(expJSON), string(resJSON))