"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "nsqd/protocol_v2_test.go" between
nsq-1.2.0.tar.gz and nsq-1.2.1.tar.gz

About: nsq is a realtime distributed and and decentralized messaging platform.

protocol_v2_test.go  (nsq-1.2.0):protocol_v2_test.go  (nsq-1.2.1)
skipping to change at line 1608 skipping to change at line 1608
fakeConn.ReadFunc = func(b []byte) (int, error) { fakeConn.ReadFunc = func(b []byte) (int, error) {
return copy(b, []byte("INVALID_COMMAND\n")), nil return copy(b, []byte("INVALID_COMMAND\n")), nil
} }
opts := NewOptions() opts := NewOptions()
opts.Logger = test.NewTestLogger(t) opts.Logger = test.NewTestLogger(t)
opts.LogLevel = LOG_DEBUG opts.LogLevel = LOG_DEBUG
nsqd, err := New(opts) nsqd, err := New(opts)
test.Nil(t, err) test.Nil(t, err)
prot := &protocolV2{ctx: &context{nsqd: nsqd}} prot := &protocolV2{nsqd: nsqd}
defer prot.ctx.nsqd.Exit() defer prot.nsqd.Exit()
err = prot.IOLoop(fakeConn) client := prot.NewClient(fakeConn)
err = prot.IOLoop(client)
test.NotNil(t, err) test.NotNil(t, err)
test.Equal(t, "E_INVALID invalid command INVALID_COMMAND", err.Error()) test.Equal(t, "E_INVALID invalid command INVALID_COMMAND", err.Error())
test.NotNil(t, err.(*protocol.FatalClientErr)) test.NotNil(t, err.(*protocol.FatalClientErr))
} }
func BenchmarkProtocolV2Exec(b *testing.B) { func BenchmarkProtocolV2Exec(b *testing.B) {
b.StopTimer() b.StopTimer()
opts := NewOptions() opts := NewOptions()
opts.Logger = test.NewTestLogger(b) opts.Logger = test.NewTestLogger(b)
nsqd, _ := New(opts) nsqd, _ := New(opts)
ctx := &context{nsqd} p := &protocolV2{nsqd}
p := &protocolV2{ctx} c := newClientV2(0, nil, nsqd)
c := newClientV2(0, nil, ctx)
params := [][]byte{[]byte("NOP")} params := [][]byte{[]byte("NOP")}
b.StartTimer() b.StartTimer()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
p.Exec(c, params) p.Exec(c, params)
} }
} }
func benchmarkProtocolV2PubMultiTopic(b *testing.B, numTopics int) { func benchmarkProtocolV2PubMultiTopic(b *testing.B, numTopics int) {
var wg sync.WaitGroup var wg sync.WaitGroup
 End of changes. 3 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)