예제 #1
0
func TestLoggregator(t *testing.T) {

	RegisterFailHandler(Fail)

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

	etcdUrl := fmt.Sprintf("http://localhost:%d", etcdPort)
	loggregatorConfig := &loggregator.Config{
		EtcdUrls:                  []string{etcdUrl},
		EtcdMaxConcurrentRequests: 10,

		Index:                  0,
		IncomingPort:           3456,
		OutgoingPort:           8083,
		LogFilePath:            "",
		MaxRetainedLogMessages: 100,
		WSMessageBufferSize:    100,
		SharedSecret:           "secret",
		SkipCertVerify:         true,
		BlackListIps:           []iprange.IPRange{},
	}
	cfcomponent.Logger = loggertesthelper.Logger()

	l := loggregator.New("127.0.0.1", loggregatorConfig, loggertesthelper.Logger())
	go l.Start()

	RunSpecs(t, "Loggregator Suite")

	l.Stop()
	etcdRunner.Stop()
}
예제 #2
0
파일: simulator.go 프로젝트: vito/diego-sim
func main() {
	flag.Parse()

	//make the out dir
	logger.Component = "SIMULATOR"
	if outDir == "" {
		logger.Fatal("out.dir.unspecified")
	}
	err := os.MkdirAll(outDir, 0777)
	if err != nil {
		logger.Fatal("out.dir.creation.failed", err)
	}

	//set up logging
	outputFile, err := os.Create(filepath.Join(outDir, "simulator.log"))
	if err != nil {
		logger.Fatal("failed.to.create.simulator.log", err)
	}
	logger.Writer = io.MultiWriter(os.Stdout, outputFile)
	cleanup.Register(func() {
		outputFile.Sync()
	})

	//compile the executor
	logger.Info("compiling.executor")
	output, err := exec.Command("go", "install", "github.com/cloudfoundry-incubator/simulator/game_executor").CombinedOutput()
	if err != nil {
		logger.Fatal("failed.to.compile.executor", string(output))
	}

	//write info to the output dir
	writeInfo()

	//start etcd
	logger.Info("starting.etcd", etcdNodes)
	etcd = etcdstorerunner.NewETCDClusterRunner(4001, etcdNodes)
	etcd.Start()

	//set up the bbs
	pool := workerpool.NewWorkerPool(50)
	etcdAdapter = etcdstoreadapter.NewETCDStoreAdapter(etcd.NodeURLS(), pool)
	etcdAdapter.Connect()
	bbs = Bbs.New(etcdAdapter, timeprovider.NewTimeProvider())

	//monitor etcd
	monitorETCD()

	//start executors
	startExecutors()

	cleanup.Register(func() {
		logger.Info("stopping.etcd", etcdNodes)
		etcd.Stop()
	})

	//run the simulator
	runSimulation()

	cleanup.Exit(0)
}
예제 #3
0
func (coordinator *MCATCoordinator) StartETCD() {
	etcdPort := 5000 + (coordinator.ParallelNode-1)*10
	coordinator.StoreRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
	coordinator.StoreRunner.Start()

	coordinator.StoreAdapter = etcdstoreadapter.NewETCDStoreAdapter(coordinator.StoreRunner.NodeURLS(), workerpool.NewWorkerPool(coordinator.Conf.StoreMaxConcurrentRequests))
	err := coordinator.StoreAdapter.Connect()
	Ω(err).ShouldNot(HaveOccurred())
}
예제 #4
0
func TestHM9000(t *testing.T) {
	RegisterFailHandler(Fail)

	etcdRunner = etcdstorerunner.NewETCDClusterRunner(5001, 1)
	etcdRunner.Start()

	RunSpecs(t, "HM9000 CLI Suite")

	etcdRunner.Stop()
}
예제 #5
0
func TestStore(t *testing.T) {
	registerSignalHandler()
	RegisterFailHandler(Fail)

	etcdRunner = etcdstorerunner.NewETCDClusterRunner(5001+config.GinkgoConfig.ParallelNode, 1, nil)

	etcdRunner.Start()
	RunSpecs(t, "Store Suite")
	etcdRunner.Stop()
}
예제 #6
0
func TestDB(t *testing.T) {
	RegisterFailHandler(Fail)

	etcdPort = 4001 + GinkgoParallelNode()
	etcdUrl = fmt.Sprintf("http://127.0.0.1:%d", etcdPort)
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
	etcdRunner.Start()
	etcdClient = etcdRunner.Adapter()

	RunSpecs(t, "DB Suite")

	etcdRunner.Stop()
}
예제 #7
0
func (coordinator *MCATCoordinator) StartETCD() {
	etcdPort := 5000 + (coordinator.ParallelNode-1)*10
	coordinator.StoreRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
	coordinator.StoreRunner.Start()

	pool, err := workpool.NewWorkPool(coordinator.Conf.StoreMaxConcurrentRequests)
	Expect(err).NotTo(HaveOccurred())

	coordinator.StoreAdapter, err = etcdstoreadapter.New(&etcdstoreadapter.ETCDOptions{ClusterUrls: coordinator.StoreRunner.NodeURLS()}, pool)
	Expect(err).NotTo(HaveOccurred())
	err = coordinator.StoreAdapter.Connect()
	Expect(err).NotTo(HaveOccurred())
}
func TestStoreAdapter(t *testing.T) {
	registerSignalHandler()
	RegisterFailHandler(Fail)

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

	etcdRunner.Start()

	RunSpecs(t, "ETCD Store Adapter Suite")

	stopStores()
}
예제 #9
0
func TestStore(t *testing.T) {
	cfcomponent.Logger = loggertesthelper.Logger()
	registerSignalHandler()

	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()
}
예제 #10
0
var etcdDBWithFakeStore db.DB
var workPoolCreateError error

var cryptor encryption.Cryptor

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

var _ = BeforeSuite(func() {
	clock = fakeclock.NewFakeClock(time.Unix(0, 1138))

	etcdPort = 4001 + GinkgoParallelNode()
	etcdUrl = fmt.Sprintf("http://127.0.0.1:%d", etcdPort)
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)

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

	consulRunner.Start()
	consulRunner.WaitUntilReady()

	etcdRunner.Start()

	Expect(workPoolCreateError).ToNot(HaveOccurred())

	encryptionKey, err := encryption.NewKey("label", "passphrase")
예제 #11
0
var bbsBinPath string
var bbsRunner *ginkgomon.Runner
var bbsProcess ifrit.Process
var bbsClient bbs.Client

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

var _ = SynchronizedBeforeSuite(func() []byte {
	bbsBinPath, err := gexec.Build("github.com/cloudfoundry-incubator/bbs/cmd/bbs")
	Expect(err).NotTo(HaveOccurred())
	return []byte(bbsBinPath)
}, func(payload []byte) {
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(5001+config.GinkgoConfig.ParallelNode, 1, nil)

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

	etcdRunner.Start()
	bbsAddress := fmt.Sprintf("127.0.0.1:%d", 13000+GinkgoParallelNode())
	bbsBinPath = string(payload)
	bbsArgs = bbsrunner.Args{
		Address:           bbsAddress,
		AdvertiseURL:      "http://" + bbsAddress,
		AuctioneerAddress: "some-address",
		EtcdCluster:       etcdRunner.NodeURLS()[0],
	etcdRunner  *etcdstorerunner.ETCDClusterRunner
	etcdAdapter storeadapter.StoreAdapter

	metronExecutablePath            string
	dopplerExecutablePath           string
	trafficControllerExecutablePath string

	metronSession  *gexec.Session
	dopplerSession *gexec.Session
	tcSession      *gexec.Session
)

var _ = BeforeSuite(func() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(49623, 1, nil)
	etcdRunner.Start()
	etcdAdapter = etcdRunner.Adapter(nil)
	metronExecutablePath = buildComponent("metron")
	dopplerExecutablePath = buildComponent("doppler")
	trafficControllerExecutablePath = buildComponent("trafficcontroller")

	// Wait for etcd to startup
	waitOnURL("http://localhost:49623")
})

var _ = BeforeEach(func() {
	const (
		BLUE       = 34
		PURPLE     = 35
		LIGHT_BLUE = 36
func setupEtcdAdapter() {
	etcdPort = 4001
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
	etcdRunner.Start()
}
)

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

var (
	pathToMetronBenchmarkExec string
	pathToMetronExecutable    string
	metronSession             *gexec.Session
	etcdRunner                *etcdstorerunner.ETCDClusterRunner
)

var _ = BeforeSuite(func() {
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(4001, 1, nil)
	etcdRunner.Start()

	var err error
	pathToMetronExecutable, err = gexec.Build("metron")
	Expect(err).ToNot(HaveOccurred())
	pathToMetronBenchmarkExec, err = gexec.Build("tools/metronbenchmark")
	Expect(err).NotTo(HaveOccurred())
})

var _ = AfterSuite(func() {
	gexec.CleanupBuildArtifacts()

	etcdRunner.Adapter(nil).Disconnect()
	etcdRunner.Stop()
})
		AuctioneerAddress:     auctioneerServer.URL(),
		MetricsReportInterval: 10 * time.Millisecond,

		EncryptionKeys: []string{"label:key"},
		ActiveKeyLabel: "label",
	}
})

var _ = JustBeforeEach(func() {
	etcdPort = 4001 + GinkgoParallelNode()
	etcdScheme := "http"
	if etcdSSLConfig != nil {
		etcdScheme = "https"
	}
	etcdUrl = fmt.Sprintf(etcdScheme+"://127.0.0.1:%d", etcdPort)
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, etcdSSLConfig)

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

	consulRunner.Start()
	consulRunner.WaitUntilReady()
	consulRunner.Reset()

	etcdRunner.Start()
	etcdRunner.Reset()

	etcdClient = etcdRunner.Client()
예제 #16
0
	. "github.com/onsi/gomega"

	"github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner"

	"testing"
)

var etcdRunner *etcdstorerunner.ETCDClusterRunner

func TestHM9000(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "HM9000 CLI Suite")
}

var _ = SynchronizedBeforeSuite(func() []byte {
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(5001, 1)
	etcdRunner.Start()
	return nil
}, func([]byte) {

})

var _ = SynchronizedAfterSuite(func() {
	etcdRunner.Stop()
}, func() {

})

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