testDuration time.Duration
	)

	runtime.GOMAXPROCS(runtime.NumCPU())

	JustBeforeEach(func() {
		syslogServerPort := 4550
		appCount = 5
		testDuration = 5 * time.Second

		appSyslogMap = make(map[*helpers.FakeApp]*helpers.SyslogTCPServer)

		registrar = helpers.NewSyslogRegistrar(etcdAdapter)

		for i := 0; i < appCount; i++ {
			syslogServer, err := helpers.NewSyslogTCPServer("127.0.0.1", syslogServerPort+i)
			Expect(err).NotTo(HaveOccurred())
			go syslogServer.Start()

			appID := fmt.Sprintf("app-%d", i)
			app := helpers.NewFakeApp(appID, 10, logRate)

			appSyslogMap[app] = syslogServer
			registrar.Register(appID, syslogServer.URL())

			go app.Warmup()
		}

		for app, _ := range appSyslogMap {
			Eventually(app.SentLogs).ShouldNot(BeZero())
		}
예제 #2
0
		testDuration time.Duration
	)

	runtime.GOMAXPROCS(runtime.NumCPU())

	JustBeforeEach(func() {
		syslogServerPort := 4550
		appCount = 5
		testDuration = 5 * time.Second

		appSyslogMap = make(map[*helpers.FakeApp]*helpers.SyslogTCPServer)

		registrar = helpers.NewSyslogRegistrar(etcdAdapter)

		for i := 0; i < appCount; i++ {
			syslogServer := helpers.NewSyslogTCPServer("localhost", syslogServerPort+i)
			go syslogServer.Start()

			appID := fmt.Sprintf("app-%d", i)
			app := helpers.NewFakeApp(appID, logRate)
			go app.Start()

			appSyslogMap[app] = syslogServer

			registrar.Register(appID, syslogServer.URL())
		}
	})

	AfterEach(func() {
		for app, syslogServer := range appSyslogMap {
			registrar.UnRegister(app.AppID(), syslogServer.URL())