"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "nsqd/stats_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.

stats_test.go  (nsq-1.2.0):stats_test.go  (nsq-1.2.1)
skipping to change at line 41 skipping to change at line 41
msg = NewMessage(accompanyTopic.GenerateID(), []byte("accompany test body ")) msg = NewMessage(accompanyTopic.GenerateID(), []byte("accompany test body "))
accompanyTopic.PutMessage(msg) accompanyTopic.PutMessage(msg)
conn, err := mustConnectNSQD(tcpAddr) conn, err := mustConnectNSQD(tcpAddr)
test.Nil(t, err) test.Nil(t, err)
defer conn.Close() defer conn.Close()
identify(t, conn, nil, frameTypeResponse) identify(t, conn, nil, frameTypeResponse)
sub(t, conn, topicName, "ch") sub(t, conn, topicName, "ch")
stats := nsqd.GetStats(topicName, "ch", true) stats := nsqd.GetStats(topicName, "ch", true).Topics
t.Logf("stats: %+v", stats) t.Logf("stats: %+v", stats)
test.Equal(t, 1, len(stats)) test.Equal(t, 1, len(stats))
test.Equal(t, 1, len(stats[0].Channels)) test.Equal(t, 1, len(stats[0].Channels))
test.Equal(t, 1, len(stats[0].Channels[0].Clients)) test.Equal(t, 1, len(stats[0].Channels[0].Clients))
test.Equal(t, 1, stats[0].Channels[0].ClientCount) test.Equal(t, 1, stats[0].Channels[0].ClientCount)
stats = nsqd.GetStats(topicName, "ch", false) stats = nsqd.GetStats(topicName, "ch", false).Topics
t.Logf("stats: %+v", stats) t.Logf("stats: %+v", stats)
test.Equal(t, 1, len(stats)) test.Equal(t, 1, len(stats))
test.Equal(t, 1, len(stats[0].Channels)) test.Equal(t, 1, len(stats[0].Channels))
test.Equal(t, 0, len(stats[0].Channels[0].Clients)) test.Equal(t, 0, len(stats[0].Channels[0].Clients))
test.Equal(t, 1, stats[0].Channels[0].ClientCount) test.Equal(t, 1, stats[0].Channels[0].ClientCount)
stats = nsqd.GetStats(topicName, "none_exist_channel", false) stats = nsqd.GetStats(topicName, "none_exist_channel", false).Topics
t.Logf("stats: %+v", stats) t.Logf("stats: %+v", stats)
test.Equal(t, 0, len(stats)) test.Equal(t, 0, len(stats))
stats = nsqd.GetStats("none_exist_topic", "none_exist_channel", false) stats = nsqd.GetStats("none_exist_topic", "none_exist_channel", false).To pics
t.Logf("stats: %+v", stats) t.Logf("stats: %+v", stats)
test.Equal(t, 0, len(stats)) test.Equal(t, 0, len(stats))
} }
func TestClientAttributes(t *testing.T) { func TestClientAttributes(t *testing.T) {
userAgent := "Test User Agent" userAgent := "Test User Agent"
opts := NewOptions() opts := NewOptions()
opts.Logger = test.NewTestLogger(t) opts.Logger = test.NewTestLogger(t)
skipping to change at line 153 skipping to change at line 153
go func() { go func() {
for i := 0; i < 25; i++ { for i := 0; i < 25; i++ {
nsqd.GetStats("", "", true) nsqd.GetStats("", "", true)
} }
wg.Done() wg.Done()
}() }()
wg.Wait() wg.Wait()
stats := nsqd.GetStats(topicName, "channel", false) stats := nsqd.GetStats(topicName, "channel", false).Topics
t.Logf("stats: %+v", stats) t.Logf("stats: %+v", stats)
test.Equal(t, 1, len(stats)) test.Equal(t, 1, len(stats))
test.Equal(t, 1, len(stats[0].Channels)) test.Equal(t, 1, len(stats[0].Channels))
test.Equal(t, 25, stats[0].Channels[0].InFlightCount) test.Equal(t, 25, stats[0].Channels[0].InFlightCount)
} }
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

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