Exemplo n.º 1
0
func (t *ATestSuite) TestSetNamespace(c *C) {
	var g *godspeed.AsyncGodspeed
	g, err := godspeed.NewDefaultAsync()
	c.Assert(err, IsNil)
	c.Check(g.Godspeed.Namespace, Equals, "")
	g.SetNamespace("heckman")
	c.Check(g.Godspeed.Namespace, Equals, "heckman")
}
Exemplo n.º 2
0
func (t *ATestSuite) TestAsyncAddTags(c *C) {
	var g *godspeed.AsyncGodspeed
	g, err := godspeed.NewDefaultAsync()
	c.Assert(err, IsNil)

	c.Assert(len(g.Godspeed.Tags), Equals, 0)

	g.AddTag("testing0")
	c.Assert(len(g.Godspeed.Tags), Equals, 1)
	c.Check(g.Godspeed.Tags[0], Equals, "testing0")

	g.AddTags([]string{"testing1", "testing2", "testing0"})
	c.Assert(len(g.Godspeed.Tags), Equals, 3)
	c.Check(g.Godspeed.Tags[0], Equals, "testing0")
	c.Check(g.Godspeed.Tags[1], Equals, "testing1")
	c.Check(g.Godspeed.Tags[2], Equals, "testing2")
}
Exemplo n.º 3
0
func testAsyncBasicFunc(t *ATestSuite, c *C, g *godspeed.AsyncGodspeed) {
	g.AddTag("test0")
	g.SetNamespace("godspeed")

	g.W.Add(1)
	go g.Send("test.metric", "c", 1, 1, []string{"test1", "test2"}, g.W)

	a, ok := <-t.o
	c.Assert(ok, Equals, true)

	b := []byte("godspeed.test.metric:1|c|#test0,test1,test2")
	c.Check(string(a), Equals, string(b))
	c.Check(len(g.Godspeed.Tags), Equals, 1)
	c.Check(g.Godspeed.Namespace, Equals, "godspeed")
}