예제 #1
0
			err = proto.Unmarshal(buffer[:n], &envelope)
			Expect(err).NotTo(HaveOccurred())
			testMetricsChan <- &envelope
		}
	}()

	port, err := strconv.Atoi(strings.TrimPrefix(testMetricsListener.LocalAddr().String(), "127.0.0.1:"))
	Expect(err).NotTo(HaveOccurred())

	client = bbs.NewClient(bbsURL.String())

	bbsArgs = testrunner.Args{
		Address:                  bbsAddress,
		AdvertiseURL:             bbsURL.String(),
		AuctioneerAddress:        auctioneerServer.URL(),
		ConsulCluster:            consulRunner.ConsulCluster(),
		DropsondePort:            port,
		EtcdCluster:              etcdUrl, // etcd is still being used to test version migration in migration_version_test.go
		DatabaseDriver:           sqlRunner.DriverName(),
		DatabaseConnectionString: sqlRunner.ConnectionString(),
		MetricsReportInterval:    10 * time.Millisecond,
		HealthAddress:            bbsHealthAddress,

		EncryptionKeys:         []string{"label:key"},
		ActiveKeyLabel:         "label",
		ConvergeRepeatInterval: time.Hour,
	}
	storeClient = etcd.NewStoreClient(etcdClient)
	consulHelper = test_helpers.NewConsulHelper(logger, consulClient)
})
		9001+config.GinkgoConfig.ParallelNode*consulrunner.PortOffsetLength,
		1,
		"http",
	)

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

	etcdRunner.Start()
	etcdRunner.Reset()

	etcdClient = etcdRunner.Client()
	etcdClient.SetConsistency(etcdclient.STRONG_CONSISTENCY)

	bbsArgs.ConsulCluster = consulRunner.ConsulCluster()
	bbsArgs.EtcdCluster = etcdUrl

	bbsRunner = testrunner.New(bbsBinPath, bbsArgs)
	bbsProcess = ginkgomon.Invoke(bbsRunner)

	basePath := path.Join(os.Getenv("GOPATH"), "src", "github.com", "cloudfoundry-incubator", "bbs", "cmd", "bbs", "fixtures")
	caFile := path.Join(basePath, "green-certs", "server-ca.crt")
	certFile := path.Join(basePath, "green-certs", "client.crt")
	keyFile := path.Join(basePath, "green-certs", "client.key")

	var err error
	bbsClient, err = bbs.NewSecureClient(bbsURL.String(), caFile, certFile, keyFile, 1, 1)
	Expect(err).NotTo(HaveOccurred())
})