1
0
Fork 0
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:
Henrik Hautakoski 2023-01-13 13:30:50 +01:00
parent 6b6a375228
commit 45bf043d8a
4 changed files with 70 additions and 2 deletions

View 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())
}