mirror of
https://github.com/eosswedenorg/thalos
synced 2026-08-31 21:08:14 +02:00
Adding transport/redis_pubsub publisher
This commit is contained in:
parent
6b6a375228
commit
45bf043d8a
4 changed files with 70 additions and 2 deletions
24
transport/redis_pubsub/redis_test.go
Normal file
24
transport/redis_pubsub/redis_test.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package redis_pubsub
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-redis/redismock/v8"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestRedisPubsub(t *testing.T) {
|
||||
client, mock := redismock.NewClientMock()
|
||||
|
||||
pubsub := New(client)
|
||||
|
||||
mock.MatchExpectationsInOrder(true)
|
||||
mock.ExpectPublish("test", []byte("some string")).SetVal(0)
|
||||
mock.ExpectPublish("test2", []byte("some other string")).SetVal(0)
|
||||
|
||||
assert.NoError(t, pubsub.Publish("test", []byte("some string")))
|
||||
assert.NoError(t, pubsub.Publish("test2", []byte("some other string")))
|
||||
assert.NoError(t, pubsub.Flush())
|
||||
|
||||
assert.NoError(t, mock.ExpectationsWereMet())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue