2021-12-07 16:45:15 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSqliteCache_AddMessage(t *testing.T) {
|
|
|
|
testCacheMessages(t, newSqliteTestCache(t))
|
|
|
|
}
|
|
|
|
|
2021-12-09 03:57:31 +00:00
|
|
|
func TestSqliteCache_Topics(t *testing.T) {
|
|
|
|
testCacheTopics(t, newSqliteTestCache(t))
|
|
|
|
}
|
|
|
|
|
2021-12-07 16:45:15 +00:00
|
|
|
func TestSqliteCache_MessagesTagsPrioAndTitle(t *testing.T) {
|
|
|
|
testCacheMessagesTagsPrioAndTitle(t, newSqliteTestCache(t))
|
|
|
|
}
|
|
|
|
|
2021-12-09 03:57:31 +00:00
|
|
|
func TestSqliteCache_Prune(t *testing.T) {
|
|
|
|
testCachePrune(t, newSqliteTestCache(t))
|
|
|
|
}
|
|
|
|
|
2021-12-07 16:45:15 +00:00
|
|
|
func newSqliteTestCache(t *testing.T) cache {
|
|
|
|
filename := filepath.Join(t.TempDir(), "cache.db")
|
|
|
|
c, err := newSqliteCache(filename)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
return c
|
|
|
|
}
|