2021-12-07 19:45:15 +03:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2021-12-09 18:23:17 +03:00
|
|
|
"github.com/stretchr/testify/assert"
|
2021-12-07 19:45:15 +03:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMemCache_Messages(t *testing.T) {
|
|
|
|
testCacheMessages(t, newMemCache())
|
|
|
|
}
|
2021-12-09 06:57:31 +03:00
|
|
|
|
2021-12-10 19:31:42 +03:00
|
|
|
func TestMemCache_MessagesScheduled(t *testing.T) {
|
|
|
|
testCacheMessagesScheduled(t, newMemCache())
|
|
|
|
}
|
|
|
|
|
2021-12-09 06:57:31 +03:00
|
|
|
func TestMemCache_Topics(t *testing.T) {
|
|
|
|
testCacheTopics(t, newMemCache())
|
|
|
|
}
|
|
|
|
|
2021-12-07 19:45:15 +03:00
|
|
|
func TestMemCache_MessagesTagsPrioAndTitle(t *testing.T) {
|
|
|
|
testCacheMessagesTagsPrioAndTitle(t, newMemCache())
|
|
|
|
}
|
2021-12-09 06:57:31 +03:00
|
|
|
|
|
|
|
func TestMemCache_Prune(t *testing.T) {
|
|
|
|
testCachePrune(t, newMemCache())
|
|
|
|
}
|
2021-12-09 18:23:17 +03:00
|
|
|
|
|
|
|
func TestMemCache_NopCache(t *testing.T) {
|
|
|
|
c := newNopCache()
|
|
|
|
assert.Nil(t, c.AddMessage(newDefaultMessage("mytopic", "my message")))
|
|
|
|
|
2021-12-10 19:31:42 +03:00
|
|
|
messages, err := c.Messages("mytopic", sinceAllMessages, false)
|
2021-12-09 18:23:17 +03:00
|
|
|
assert.Nil(t, err)
|
|
|
|
assert.Empty(t, messages)
|
|
|
|
|
|
|
|
topics, err := c.Topics()
|
|
|
|
assert.Nil(t, err)
|
|
|
|
assert.Empty(t, topics)
|
|
|
|
}
|