Exemplo n.º 1
0
func (s *MgoSuite) SetUpSuite(c *C) {
	if MgoAddr == "" {
		panic("MgoSuite tests must be run with MgoTestPackage")
	}
	mgo.SetStats(true)
	// Make tests that use password authentication faster.
	utils.FastInsecureHash = true
}
Exemplo n.º 2
0
Arquivo: mgo.go Projeto: jkary/core
func (s *MgoSuite) SetUpSuite(c *gc.C) {
	if MgoServer.addr == "" {
		c.Fatalf("No Mongo Server Address, MgoSuite tests must be run with MgoTestPackage")
	}
	mgo.SetDebug(true)
	mgo.SetStats(true)
	// Make tests that use password authentication faster.
	utils.FastInsecureHash = true
}
Exemplo n.º 3
0
func (s *S) SetUpSuite(c *C) {
	mgo.SetDebug(true)
	mgo.SetStats(true)
	s.StartAll()

	session, err := mgo.Dial("localhost:40001")
	c.Assert(err, IsNil)
	s.build, err = session.BuildInfo()
	c.Check(err, IsNil)
	session.Close()
}
Exemplo n.º 4
0
func (s *MgoSuite) SetUpSuite(c *C) {
	mgo.SetDebug(true)
	mgo.SetStats(true)
	dbdir := c.MkDir()
	args := []string{
		"--dbpath", dbdir,
		"--bind_ip", "127.0.0.1",
		"--port", "50017",
		"--nssize", "1",
		"--noprealloc",
		"--smallfiles",
		"--nojournal",
	}
	s.server = exec.Command("mongod", args...)
	s.server.Stdout = &s.output
	s.server.Stderr = &s.output
	err := s.server.Start()
	c.Assert(err, IsNil)
}
Exemplo n.º 5
0
func main() {
	mgo.SetStats(true)
	session, err := mgo.Dial("localhost")
	if err != nil {
		panic(err)
	}
	defer session.Close()

	session.SetMode(mgo.Monotonic, true)

	// go routine to start inserts
	c := session.DB("test").C("mongotest")
	insertonedoc(c)
	ch := make(chan int)
	start := time.Now().UnixNano()
	for a := 0; a < Test_Runs; a++ {

		for j := 0; j < Async_Count; j++ {
			go insertworker(session.Copy(), ch)
		}
		// drain the channel
		for i := 0; i < Async_Count; i++ {
			<-ch
		}
	}
	end := time.Now().UnixNano()
	// try to do query as a test
	findone(c)
	cm := make(chan int)
	for b := 0; b < MapReduce_Count; b++ {
		go testmapreduce(c, cm, b)
	}
	for z := 0; z < MapReduce_Count; z++ {
		<-cm
	}
	for x := 0; x < IndexOp_Count; x++ {
		MakeIndex(c)
		DeleteIndex(c)
	}
	minInsert := MinFloat(Insert_t[:])
	maxInsert := MaxFloat(Insert_t[:])
	avgInsert := AvgFloat(Insert_t[:])
	minMap := MinFloat(Mp_t[:])
	maxMap := MaxFloat(Mp_t[:])
	avgMap := AvgFloat(Mp_t[:])
	minIndexC := MinFloat(Id_t[:])
	maxIndexC := MaxFloat(Id_t[:])
	avgIndexC := AvgFloat(Id_t[:])
	minIndexD := MinFloat(Di_t[:])
	maxIndexD := MaxFloat(Di_t[:])
	avgIndexD := AvgFloat(Di_t[:])
	fmt.Printf("#####################\n")
	fmt.Printf("%v Docs Inserted in %v seconds, using %v threads\n", Test_Runs*Insert_Count*Async_Count, float32(end-start)/1E9, Async_Count)
	fmt.Printf("Min Insert TIme %v\n", minInsert)
	fmt.Printf("Max Insert Time %v\n", maxInsert)
	fmt.Printf("Avg Insert Time %v\n", avgInsert)
	fmt.Printf("#####################\n")
	fmt.Printf("%v MapReduce Runs\n", MapReduce_Count)
	fmt.Printf("Min MapReduce TIme %v\n", minMap)
	fmt.Printf("Max MapReduce Time %v\n", maxMap)
	fmt.Printf("Avg MapReduce Time %v\n", avgMap)
	fmt.Printf("#####################\n")
	fmt.Printf("Query One Time %v\n", Fo_t)
	fmt.Printf("#####################\n")
	fmt.Printf("Min Create Index Time (Blocking) %v\n", minIndexC)
	fmt.Printf("Max Create Index Time (Blocking) %v\n", maxIndexC)
	fmt.Printf("Avg Create Index Time (Blocking) %v\n", avgIndexC)
	fmt.Printf("Min Drop Index Time %v\n", minIndexD)
	fmt.Printf("Max Drop Index Time %v\n", maxIndexD)
	fmt.Printf("Avg Drop Index Time %v\n", avgIndexD)
	fmt.Printf("%+v\n", mgo.GetStats())

}
Exemplo n.º 6
0
func (s *MgoSuite) SetUpSuite(c *C) {
	if MgoAddr == "" {
		panic("MgoSuite tests must be run with MgoTestPackage")
	}
	mgo.SetStats(true)
}