Example #1
0
	binaries := map[string]string{}

	err := json.Unmarshal(payload, &binaries)
	Expect(err).NotTo(HaveOccurred())

	etcdPort = 5001 + GinkgoParallelNode()
	listenerPort = 1518 + GinkgoParallelNode()

	trafficControllerPort = 7001 + GinkgoParallelNode()*2
	trafficControllerAddress = fmt.Sprintf("127.0.0.1:%d", trafficControllerPort)
	trafficControllerURL = fmt.Sprintf("ws://%s", trafficControllerAddress)

	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)

	listenerPath = string(binaries["listener"])
	store = etcdRunner.Adapter(nil)

	consulRunner = consulrunner.NewClusterRunner(
		9001+config.GinkgoConfig.ParallelNode*consulrunner.PortOffsetLength,
		1,
		"http",
	)

	logger = lagertest.NewTestLogger("test")

	bbsPath = string(binaries["bbs"])
	bbsAddress := fmt.Sprintf("127.0.0.1:%d", 13000+GinkgoParallelNode())

	bbsURL = &url.URL{
		Scheme: "http",
		Host:   bbsAddress,
	"testing"
)

var etcdRunner *etcdstorerunner.ETCDClusterRunner
var etcdPort int

var _ = BeforeSuite(func() {
	etcdPort = 5800 + (config.GinkgoConfig.ParallelNode-1)*10
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
	etcdRunner.Start()
})

var _ = AfterSuite(func() {
	etcdRunner.Adapter().Disconnect()
	etcdRunner.Stop()
})

func TestTrafficcontroller(t *testing.T) {
	RegisterFailHandler(Fail)

	RunSpecs(t, "Trafficcontroller Suite")

}

var _ = BeforeEach(func() {
	adapter := etcdRunner.Adapter()
	adapter.Disconnect()
	etcdRunner.Reset()
	adapter.Connect()
})
	command := exec.Command(pathToMetronExecutable, "--config=fixtures/metron.json", "--debug")

	metronSession, err = gexec.Start(command, gexec.NewPrefixedWriter("[o][metron]", GinkgoWriter), gexec.NewPrefixedWriter("[e][metron]", GinkgoWriter))
	Expect(err).ShouldNot(HaveOccurred())

	pathToStatsdInjectorExecutable, err := gexec.Build("statsd-injector")
	Expect(err).NotTo(HaveOccurred())
	command = exec.Command(pathToStatsdInjectorExecutable, "-statsdPort=51162", "-metronPort=51161", "-logLevel=debug")

	statsdInjectorSession, err = gexec.Start(command, gexec.NewPrefixedWriter("[o][statsdInjector]", GinkgoWriter), gexec.NewPrefixedWriter("[e][statsdInjector]", GinkgoWriter))
	Expect(err).ShouldNot(HaveOccurred())

	localIPAddress, _ = localip.LocalIP()

	etcdPort = 5800 + (config.GinkgoConfig.ParallelNode-1)*10
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
	etcdRunner.Start()

	Eventually(metronSession, 1).Should(gbytes.Say("metron started"))
	Eventually(statsdInjectorSession).Should(gbytes.Say("Listening for statsd on host :51162"))
})

var _ = AfterSuite(func() {
	metronSession.Kill().Wait()
	statsdInjectorSession.Kill().Wait()
	gexec.CleanupBuildArtifacts()

	etcdRunner.Adapter(nil).Disconnect()
	etcdRunner.Stop()
})
var _ = SynchronizedBeforeSuite(func() []byte {
	metronPath, err := gexec.Build("metron", "-race")
	Expect(err).ShouldNot(HaveOccurred())
	return []byte(metronPath)
}, func(path []byte) {
	metronPath := string(path)

	var err error
	tmpdir, err = ioutil.TempDir("", "metronmetrics")
	Expect(err).ShouldNot(HaveOccurred())

	etcdPort := 5800 + (config.GinkgoConfig.ParallelNode)*10
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
	etcdRunner.Start()
	etcdAdapter = etcdRunner.Adapter(nil)

	port := 51000 + config.GinkgoConfig.ParallelNode*10
	metronRunner = &runners.MetronRunner{
		Path:          metronPath,
		TempDir:       tmpdir,
		LegacyPort:    port,
		MetronPort:    port + 1,
		DropsondePort: 3457 + config.GinkgoConfig.ParallelNode*10,
		EtcdRunner:    etcdRunner,
	}
})

var _ = SynchronizedAfterSuite(func() {
	if etcdRunner != nil {
		etcdRunner.Stop()
Example #5
0
	RegisterFailHandler(Fail)

	etcdPort := 5800 + (config.GinkgoConfig.ParallelNode-1)*10
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
	etcdRunner.Start()

	RunSpecs(t, "Store Suite")

	etcdRunner.Adapter().Disconnect()
	etcdRunner.Stop()
}

var _ = BeforeEach(func() {
	etcdRunner.Adapter().Disconnect()
	etcdRunner.Reset()
	etcdRunner.Adapter().Connect()
})

func registerSignalHandler() {
	go func() {
		c := make(chan os.Signal, 1)
		signal.Notify(c, os.Interrupt, os.Kill)

		select {
		case <-c:
			etcdRunner.Stop()
			os.Exit(0)
		}
	}()
}
	dopplerSession *gexec.Session
	localIPAddress string
	etcdPort       int
	etcdRunner     *etcdstorerunner.ETCDClusterRunner
	etcdAdapter    storeadapter.StoreAdapter

	pathToDopplerExec    string
	pathToHTTPEchoServer string
	pathToTCPEchoServer  string
)

var _ = BeforeSuite(func() {
	etcdPort = 5555
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
	etcdRunner.Start()
	etcdAdapter = etcdRunner.Adapter()

	var err error
	pathToDopplerExec, err = gexec.Build("doppler")
	Expect(err).NotTo(HaveOccurred())

	pathToHTTPEchoServer, err = gexec.Build("tools/httpechoserver")
	Expect(err).NotTo(HaveOccurred())

	pathToTCPEchoServer, err = gexec.Build("tools/tcpechoserver")
	Expect(err).NotTo(HaveOccurred())

})

var _ = BeforeEach(func() {
	var err error
Example #7
0
	"github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

func TestDB(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "DB Suite")
}

var etcdClient storeadapter.StoreAdapter
var etcdPort int
var etcdUrl string
var etcdRunner *etcdstorerunner.ETCDClusterRunner
var routingAPIBinPath string

var _ = BeforeEach(func() {
	etcdPort = 4001 + GinkgoParallelNode()
	etcdUrl = fmt.Sprintf("http://127.0.0.1:%d", etcdPort)
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
	etcdRunner.Start()

	etcdClient = etcdRunner.Adapter()
})

var _ = AfterEach(func() {
	etcdClient.Disconnect()
	etcdRunner.Stop()
})
Example #8
0
		bytes, err := json.Marshal(BinPaths{
			Converger: convergerBinPath,
			Bbs:       bbsBinPath,
		})
		Expect(err).NotTo(HaveOccurred())
		return bytes
	}, func(bytes []byte) {
		binPaths = BinPaths{}
		err := json.Unmarshal(bytes, &binPaths)
		Expect(err).NotTo(HaveOccurred())

		etcdPort := 5001 + config.GinkgoConfig.ParallelNode
		etcdCluster := fmt.Sprintf("http://127.0.0.1:%d", etcdPort)
		etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)

		etcdClient = etcdRunner.Adapter(nil)

		consulRunner = consulrunner.NewClusterRunner(
			9001+config.GinkgoConfig.ParallelNode*consulrunner.PortOffsetLength,
			1,
			"http",
		)

		logger = lagertest.NewTestLogger("test")

		bbsAddress := fmt.Sprintf("127.0.0.1:%d", 13000+GinkgoParallelNode())

		bbsURL := &url.URL{
			Scheme: "http",
			Host:   bbsAddress,
		}