mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-28 18:18:11 -07:00
store: use stopper, extraxt StringStore tests
This commit is contained in:
@@ -14,7 +14,7 @@ func init() {
|
||||
tracker.RegisterAnnounceMiddleware("infohash_blacklist", blacklistAnnounceInfohash)
|
||||
tracker.RegisterScrapeMiddlewareConstructor("infohash_blacklist", blacklistScrapeInfohash)
|
||||
mustGetStore = func() store.StringStore {
|
||||
return store.MustGetStore()
|
||||
return store.MustGetStore().StringStore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/chihaya/chihaya"
|
||||
"github.com/chihaya/chihaya/pkg/stopper"
|
||||
"github.com/chihaya/chihaya/server/store"
|
||||
"github.com/chihaya/chihaya/tracker"
|
||||
)
|
||||
@@ -36,6 +37,10 @@ func (ss *storeMock) RemoveString(s string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ss *storeMock) Stop() <-chan error {
|
||||
return stopper.AlreadyStopped
|
||||
}
|
||||
|
||||
var mock store.StringStore = &storeMock{
|
||||
strings: make(map[string]struct{}),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user