mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-03 11:53:41 +02:00
transport/redis_pubsub/redis.go rename to publisher.go
This commit is contained in:
parent
b46c070948
commit
19b93495ee
3 changed files with 11 additions and 11 deletions
26
transport/redis_pubsub/publisher_test.go
Normal file
26
transport/redis_pubsub/publisher_test.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package redis_pubsub
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"eosio-ship-trace-reader/transport"
|
||||
|
||||
"github.com/go-redis/redismock/v8"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestPublisher_Publish(t *testing.T) {
|
||||
client, mock := redismock.NewClientMock()
|
||||
|
||||
pub := NewPublisher(client, Namespace{ChainID: "id"})
|
||||
|
||||
mock.MatchExpectationsInOrder(true)
|
||||
mock.ExpectPublish("ship::id::test", []byte("some string")).SetVal(0)
|
||||
mock.ExpectPublish("ship::id::test2", []byte("some other string")).SetVal(0)
|
||||
|
||||
assert.NoError(t, pub.Publish(transport.Channel{"test"}, []byte("some string")))
|
||||
assert.NoError(t, pub.Publish(transport.Channel{"test2"}, []byte("some other string")))
|
||||
assert.NoError(t, pub.Flush())
|
||||
|
||||
assert.NoError(t, mock.ExpectationsWereMet())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue