Fix tests case

pull/115/head
Aloïs Micard 3 years ago
parent 4a0fbd0b9b
commit 12362e0100
No known key found for this signature in database
GPG Key ID: 1A0EB82F071F5EFE

@ -212,7 +212,7 @@ func (state *State) handleNewResourceEvent(subscriber event.Subscriber, msg even
// make sure url has not been published (yet)
count, err := state.urlCache.GetInt64(fmt.Sprintf("urls:%s", u))
if err != nil {
if err != nil && err != cache.ErrNIL {
log.Err(err).
Str("url", u).
Msg("error while checking URL cache")

@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/creekorful/trandoshan/internal/cache"
"github.com/creekorful/trandoshan/internal/cache_mock"
"github.com/creekorful/trandoshan/internal/configapi/client"
"github.com/creekorful/trandoshan/internal/configapi/client_mock"
@ -484,7 +485,7 @@ Thanks to https://help.facebook.onion/ for the hosting :D
}).Return(nil)
// make sure we are pushing found URLs (but only if refresh delay elapsed)
urlCacheMock.EXPECT().GetInt64("urls:https://example.org").Return(int64(0), nil)
urlCacheMock.EXPECT().GetInt64("urls:https://example.org").Return(int64(0), cache.ErrNIL)
indexMock.EXPECT().CountResources(&client2.ResSearchParams{
URL: "https://example.org",
PageSize: 1,
@ -493,7 +494,7 @@ Thanks to https://help.facebook.onion/ for the hosting :D
urlCacheMock.EXPECT().GetInt64("urls:https://help.facebook.onion").Return(int64(1), nil)
urlCacheMock.EXPECT().GetInt64("urls:https://google.com/test?test=test").Return(int64(0), nil)
urlCacheMock.EXPECT().GetInt64("urls:https://google.com/test?test=test").Return(int64(0), cache.ErrNIL)
indexMock.EXPECT().CountResources(&client2.ResSearchParams{
URL: "https://google.com/test?test=test",
PageSize: 1,

Loading…
Cancel
Save