mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-18 22:14:35 +00:00
Move the libs/pubsub package to internal scope (#7451)
No API changes, merely changes the import path.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package pubsub_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/internal/pubsub"
|
||||
"github.com/tendermint/tendermint/internal/pubsub/query"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
)
|
||||
|
||||
func TestExample(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
s := newTestServer(ctx, t, log.TestingLogger())
|
||||
|
||||
sub := newTestSub(t).must(s.SubscribeWithArgs(ctx, pubsub.SubscribeArgs{
|
||||
ClientID: "example-client",
|
||||
Query: query.MustCompile(`abci.account.name='John'`),
|
||||
}))
|
||||
|
||||
events := []abci.Event{
|
||||
{
|
||||
Type: "abci.account",
|
||||
Attributes: []abci.EventAttribute{{Key: "name", Value: "John"}},
|
||||
},
|
||||
}
|
||||
require.NoError(t, s.PublishWithEvents(ctx, "Tombstone", events))
|
||||
sub.mustReceive(ctx, "Tombstone")
|
||||
}
|
||||
Reference in New Issue
Block a user