예제 #1
0
func (s *ProxySuite) SetUpTest(c *C) {
	x := config.DefaultConfig()
	x.TraceKey = "my_trace_key"

	mocksController := gomock.NewController(c)
	s.r = NewRegistry(x, test.NewMockCFMessageBus(mocksController))
	s.p = NewProxy(x, s.r, nullVarz{})

	s.done = make(chan bool)
}
예제 #2
0
func (s *RegistrySuite) SetUpTest(c *C) {
	var configObj *config.Config

	configObj = config.DefaultConfig()
	configObj.DropletStaleThreshold = 1

	s.mocksController = gomock.NewController(c)
	s.messageBus = test.NewMockCFMessageBus(s.mocksController)

	s.Registry = NewRegistry(configObj, s.messageBus)
}
예제 #3
0
func BenchmarkRegister(b *testing.B) {
	c := config.DefaultConfig()
	mocksController := gomock.NewController(b)
	r := NewRegistry(c, test.NewMockCFMessageBus(mocksController))
	p := NewProxy(c, r, NewVarz(r))

	for i := 0; i < b.N; i++ {
		str := strconv.Itoa(i)
		rm := &registryMessage{
			Host: "localhost",
			Port: uint16(i),
			Uris: []Uri{Uri("bench.vcap.me." + str)},
		}
		p.Register(rm)
	}
}
예제 #4
0
func (s *VarzSuite) SetUpTest(c *C) {
	mocksController := gomock.NewController(c)
	r := NewRegistry(config.DefaultConfig(), test.NewMockCFMessageBus(mocksController))
	s.Registry = r
	s.Varz = NewVarz(r)
}