示例#1
0
func (suite *TestSuite) SetUpSuite(c *C) {
	runtime.GOMAXPROCS(8)
	rand.Seed(time.Now().UTC().UnixNano())
	suite.goenv = goenv.NewGoenv("../example/config.yml", "gotesting", "../example/log/test.log")
	suite.queue = redismq.NewQueue(suite.goenv, "teststuff")
	suite.consumer, _ = suite.queue.AddConsumer("testconsumer")
}
示例#2
0
func (suite *BenchmarkSuite) SetUpSuite(c *C) {
	runtime.GOMAXPROCS(8)
	rand.Seed(time.Now().UTC().UnixNano())
	suite.goenv = goenv.NewGoenv("../example/config.yml", "gotesting", "../example/log/test.log")
	suite.queue1k = redismq.NewQueue(suite.goenv, "teststuff1k")
	suite.queue4k = redismq.NewQueue(suite.goenv, "teststuff4k")
	suite.consumer1k, _ = suite.queue1k.AddConsumer("testconsumer")
	suite.consumer4k, _ = suite.queue4k.AddConsumer("testconsumer")

	suite.mutliConsumer1k = make([]*redismq.Consumer, 0)
	for i := 0; i < 4; i++ {
		q := redismq.NewQueue(suite.goenv, "teststuff1k")
		c, err := q.AddConsumer("c" + strconv.Itoa(i))
		if err != nil {
			panic(err)
		}
		suite.mutliConsumer1k = append(suite.mutliConsumer1k, c)
	}
	suite.mutliConsumer4k = make([]*redismq.Consumer, 0)
	for i := 0; i < 4; i++ {
		q := redismq.NewQueue(suite.goenv, "teststuff4k")
		c, err := q.AddConsumer("c" + strconv.Itoa(i))
		if err != nil {
			panic(err)
		}
		suite.mutliConsumer4k = append(suite.mutliConsumer4k, c)
	}
}