Improve memory store tests reliability (#479)

* remove unnecessary GIT_BRANCH export

* go mod tidy

* fix tests naming, improve coverage

* make flaky TestMemData_FlagListBlocked reliable
This commit is contained in:
Dmitry Verkhoturov
2019-11-17 15:47:01 -06:00
committed by Umputun
parent 6f969a0a76
commit 773da16649
7 changed files with 65 additions and 88 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ func (s *RPC) listFlagsHndl(id uint64, params json.RawMessage) (rr jrpc.Response
return jrpc.EncodeResponse(id, flags, err)
}
// deleteHndl remove comment(s)
// deleteHndl delete post(s), user, comment, or everything
func (s *RPC) deleteHndl(id uint64, params json.RawMessage) (rr jrpc.Response) {
req := engine.DeleteRequest{}
if err := json.Unmarshal(params, &req); err != nil {
@@ -14,12 +14,13 @@ import (
"time"
"github.com/go-pkgz/jrpc"
log "github.com/go-pkgz/lgr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"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/memory_store/accessor"
)
@@ -344,9 +345,10 @@ func prepTestStore(t *testing.T) (s *RPC, port int, teardown func()) {
adm.Set("test-site-disabled", admRecDisabled)
go func() {
t.Log(s.Run(port))
log.Printf("%v", s.Run(port))
}()
time.Sleep(time.Millisecond * 10)
time.Sleep(time.Millisecond * 50) // wait for server to start
return s, port, func() {
require.NoError(t, s.Shutdown())