@ -81,20 +81,20 @@ func TestDifferentClients(t *testing.T) {
ctx := context . Background ( )
subscription1 , err := s . Subscribe ( ctx , "client-1" , query . MustParse ( "tm.events.type='NewBlock'" ) )
require . NoError ( t , err )
err = s . PublishWithTags ( ctx , "Iceman" , pubsub . NewTagMap ( map [ string ] string { "tm.events.type" : "NewBlock" } ) )
err = s . PublishWithTags ( ctx , "Iceman" , map [ string ] string { "tm.events.type" : "NewBlock" } )
require . NoError ( t , err )
assertReceive ( t , "Iceman" , subscription1 . Out ( ) )
subscription2 , err := s . Subscribe ( ctx , "client-2" , query . MustParse ( "tm.events.type='NewBlock' AND abci.account.name='Igor'" ) )
require . NoError ( t , err )
err = s . PublishWithTags ( ctx , "Ultimo" , pubsub . NewTagMap ( map [ string ] string { "tm.events.type" : "NewBlock" , "abci.account.name" : "Igor" } ) )
err = s . PublishWithTags ( ctx , "Ultimo" , map [ string ] string { "tm.events.type" : "NewBlock" , "abci.account.name" : "Igor" } )
require . NoError ( t , err )
assertReceive ( t , "Ultimo" , subscription1 . Out ( ) )
assertReceive ( t , "Ultimo" , subscription2 . Out ( ) )
subscription3 , err := s . Subscribe ( ctx , "client-3" , query . MustParse ( "tm.events.type='NewRoundStep' AND abci.account.name='Igor' AND abci.invoice.number = 10" ) )
require . NoError ( t , err )
err = s . PublishWithTags ( ctx , "Valeria Richards" , pubsub . NewTagMap ( map [ string ] string { "tm.events.type" : "NewRoundStep" } ) )
err = s . PublishWithTags ( ctx , "Valeria Richards" , map [ string ] string { "tm.events.type" : "NewRoundStep" } )
require . NoError ( t , err )
assert . Zero ( t , len ( subscription3 . Out ( ) ) )
}
@ -110,7 +110,7 @@ func TestClientSubscribesTwice(t *testing.T) {
subscription1 , err := s . Subscribe ( ctx , clientID , q )
require . NoError ( t , err )
err = s . PublishWithTags ( ctx , "Goblin Queen" , pubsub . NewTagMap ( map [ string ] string { "tm.events.type" : "NewBlock" } ) )
err = s . PublishWithTags ( ctx , "Goblin Queen" , map [ string ] string { "tm.events.type" : "NewBlock" } )
require . NoError ( t , err )
assertReceive ( t , "Goblin Queen" , subscription1 . Out ( ) )
@ -118,7 +118,7 @@ func TestClientSubscribesTwice(t *testing.T) {
require . Error ( t , err )
require . Nil ( t , subscription2 )
err = s . PublishWithTags ( ctx , "Spider-Man" , pubsub . NewTagMap ( map [ string ] string { "tm.events.type" : "NewBlock" } ) )
err = s . PublishWithTags ( ctx , "Spider-Man" , map [ string ] string { "tm.events.type" : "NewBlock" } )
require . NoError ( t , err )
assertReceive ( t , "Spider-Man" , subscription1 . Out ( ) )
}
@ -264,7 +264,7 @@ func benchmarkNClients(n int, b *testing.B) {
b . ReportAllocs ( )
b . ResetTimer ( )
for i := 0 ; i < b . N ; i ++ {
s . PublishWithTags ( ctx , "Gamora" , pubsub . NewTagMap ( map [ string ] string { "abci.Account.Owner" : "Ivan" , "abci.Invoices.Number" : string ( i ) } ) )
s . PublishWithTags ( ctx , "Gamora" , map [ string ] string { "abci.Account.Owner" : "Ivan" , "abci.Invoices.Number" : string ( i ) } )
}
}
@ -295,7 +295,7 @@ func benchmarkNClientsOneQuery(n int, b *testing.B) {
b . ReportAllocs ( )
b . ResetTimer ( )
for i := 0 ; i < b . N ; i ++ {
s . PublishWithTags ( ctx , "Gamora" , pubsub . NewTagMap ( map [ string ] string { "abci.Account.Owner" : "Ivan" , "abci.Invoices.Number" : "1" } ) )
s . PublishWithTags ( ctx , "Gamora" , map [ string ] string { "abci.Account.Owner" : "Ivan" , "abci.Invoices.Number" : "1" } )
}
}