Skip to content

Commit

Permalink
don't use cache in rest tests which don't utilize it
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal authored and umputun committed Apr 14, 2020
1 parent 1c28f44 commit c389693
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
21 changes: 21 additions & 0 deletions backend/app/rest/api/rest_public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,13 @@ func TestRest_LastCommentsStream(t *testing.T) {
srv.pubRest.streamer.TimeOut = 500 * time.Millisecond
srv.pubRest.streamer.MaxActive = 100

// stream endpoint currently relies on real cache being present
cacheBackend, err := cache.NewExpirableCache()
require.NoError(t, err)
memCache := cache.NewScache(cacheBackend)
srv.privRest.cache = memCache
srv.pubRest.cache = memCache

postComment(t, ts.URL)

defer teardown()
Expand Down Expand Up @@ -788,6 +795,13 @@ func TestRest_LastCommentsStreamCancel(t *testing.T) {
srv.pubRest.streamer.TimeOut = 500 * time.Millisecond
srv.pubRest.streamer.MaxActive = 100

// stream endpoint currently relies on real cache being present
cacheBackend, err := cache.NewExpirableCache()
require.NoError(t, err)
memCache := cache.NewScache(cacheBackend)
srv.privRest.cache = memCache
srv.pubRest.cache = memCache

postComment(t, ts.URL)

defer teardown()
Expand Down Expand Up @@ -854,6 +868,13 @@ func TestRest_LastCommentsStreamSince(t *testing.T) {
srv.pubRest.streamer.TimeOut = 500 * time.Millisecond
srv.pubRest.streamer.MaxActive = 100

// stream endpoint currently relies on real cache being present
cacheBackend, err := cache.NewExpirableCache()
require.NoError(t, err)
memCache := cache.NewScache(cacheBackend)
srv.privRest.cache = memCache
srv.pubRest.cache = memCache

postComment(t, ts.URL)

defer teardown()
Expand Down
4 changes: 1 addition & 3 deletions backend/app/rest/api/rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,7 @@ func startupT(t *testing.T) (ts *httptest.Server, srv *Rest, teardown func()) {
b, err := engine.NewBoltDB(bolt.Options{}, engine.BoltSite{FileName: testDb, SiteID: "remark42"})
require.NoError(t, err)

cacheBackend, err := cache.NewExpirableCache()
require.NoError(t, err)
memCache := cache.NewScache(cacheBackend)
memCache := cache.NewScache(cache.NewNopCache())

astore := adminstore.NewStaticStore("123456", []string{"remark42"}, []string{"a1", "a2"}, "admin@remark-42.com")
restrictedWordsMatcher := service.NewRestrictedWordsMatcher(service.StaticRestrictedWordsLister{Words: []string{"duck"}})
Expand Down

0 comments on commit c389693

Please sign in to comment.