本文整理汇总了Golang中github.com/cloudfoundry-incubator/bbs/fake_bbs.FakeClient类的典型用法代码示例。如果您正苦于以下问题:Golang FakeClient类的具体用法?Golang FakeClient怎么用?Golang FakeClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FakeClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
var _ = Describe("EvacuationLrpProcessor", func() {
Describe("Process", func() {
const (
localCellID = "cell-α"
evacuationTTL = 1234
)
var (
logger *lagertest.TestLogger
fakeBBS *fake_bbs.FakeClient
fakeContainerDelegate *fake_internal.FakeContainerDelegate
fakeEvacuationReporter *fake_evacuation_context.FakeEvacuationReporter
lrpProcessor internal.LRPProcessor
processGuid string
desiredLRP models.DesiredLRP
index int
container executor.Container
instanceGuid string
lrpKey models.ActualLRPKey
lrpInstanceKey models.ActualLRPInstanceKey
)
BeforeEach(func() {
logger = lagertest.NewTestLogger("test")
fakeBBS = new(fake_bbs.FakeClient)
fakeContainerDelegate = &fake_internal.FakeContainerDelegate{}
示例2:
processGuid = "process-guid-1"
containerPort = 8080
instanceGuid = "instance-guid-1"
lrpHost = "1.2.3.4"
)
var (
bbsClient *fake_bbs.FakeClient
natsClient *diegonats.FakeNATSClient
syncerRunner *syncer.Syncer
process ifrit.Process
syncMessages routing_table.MessagesToEmit
messagesToEmit routing_table.MessagesToEmit
clock *fakeclock.FakeClock
clockStep time.Duration
syncInterval time.Duration
shutdown chan struct{}
schedulingInfoResponse *models.DesiredLRPSchedulingInfo
actualResponses []*models.ActualLRPGroup
routerStartMessages chan<- *nats.Msg
fakeMetricSender *fake_metrics_sender.FakeMetricSender
)
BeforeEach(func() {
bbsClient = new(fake_bbs.FakeClient)
natsClient = diegonats.NewFakeClient()
clock = fakeclock.NewFakeClock(time.Now())
示例3:
"github.com/pivotal-golang/lager/lagertest"
"github.com/tedsuo/ifrit"
"github.com/tedsuo/ifrit/ginkgomon"
)
var _ = Describe("Processor", func() {
var (
fingerprintsToFetch []cc_messages.CCDesiredAppFingerprint
existingSchedulingInfos []*models.DesiredLRPSchedulingInfo
bbsClient *fake_bbs.FakeClient
fetcher *fakes.FakeFetcher
buildpackRecipeBuilder *fakes.FakeRecipeBuilder
dockerRecipeBuilder *fakes.FakeRecipeBuilder
processor ifrit.Runner
process ifrit.Process
syncDuration time.Duration
metricSender *fake.FakeMetricSender
clock *fakeclock.FakeClock
pollingInterval time.Duration
logger *lagertest.TestLogger
)
BeforeEach(func() {
metricSender = fake.NewFakeMetricSender()
metrics.Initialize(metricSender, nil)
syncDuration = 900900
示例4:
oldmodels "github.com/cloudfoundry-incubator/runtime-schema/models"
"github.com/gogo/protobuf/proto"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pivotal-golang/lager"
)
var _ = Describe("Actual LRP Handlers", func() {
var (
logger lager.Logger
fakeLegacyBBS *fake_legacy_bbs.FakeReceptorBBS
fakeBBS *fake_bbs.FakeClient
responseRecorder *httptest.ResponseRecorder
handler *handlers.ActualLRPHandler
oldActualLRP1 oldmodels.ActualLRP
oldActualLRP2 oldmodels.ActualLRP
oldEvacuatingLRP2 oldmodels.ActualLRP
actualLRP1 models.ActualLRP
actualLRP2 models.ActualLRP
evacuatingLRP2 models.ActualLRP
)
BeforeEach(func() {
fakeLegacyBBS = new(fake_legacy_bbs.FakeReceptorBBS)
fakeBBS = new(fake_bbs.FakeClient)
logger = lager.NewLogger("test")
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))
responseRecorder = httptest.NewRecorder()
handler = handlers.NewActualLRPHandler(fakeBBS, fakeLegacyBBS, logger)
示例5:
"net/url"
"github.com/cloudfoundry-incubator/bbs/fake_bbs"
"github.com/cloudfoundry-incubator/bbs/models"
"github.com/cloudfoundry-incubator/nsync/handlers"
"github.com/pivotal-golang/lager/lagertest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("StopAppHandler", func() {
var (
logger *lagertest.TestLogger
fakeBBS *fake_bbs.FakeClient
request *http.Request
responseRecorder *httptest.ResponseRecorder
)
BeforeEach(func() {
logger = lagertest.NewTestLogger("test")
fakeBBS = new(fake_bbs.FakeClient)
responseRecorder = httptest.NewRecorder()
var err error
request, err = http.NewRequest("DELETE", "", nil)
Expect(err).NotTo(HaveOccurred())
request.Form = url.Values{
":process_guid": []string{"process-guid"},
示例6:
"github.com/cloudfoundry-incubator/receptor/serialization"
fake_legacy_bbs "github.com/cloudfoundry-incubator/runtime-schema/bbs/fake_bbs"
oldmodels "github.com/cloudfoundry-incubator/runtime-schema/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pivotal-golang/lager"
)
var _ = Describe("Actual LRP Handlers", func() {
var (
logger lager.Logger
fakeLegacyBBS *fake_legacy_bbs.FakeReceptorBBS
fakeBBS *fake_bbs.FakeClient
responseRecorder *httptest.ResponseRecorder
handler *handlers.ActualLRPHandler
oldActualLRP2 oldmodels.ActualLRP
oldEvacuatingLRP2 oldmodels.ActualLRP
actualLRP1 *models.ActualLRP
actualLRP2 *models.ActualLRP
evacuatingLRP2 *models.ActualLRP
)
BeforeEach(func() {
fakeLegacyBBS = new(fake_legacy_bbs.FakeReceptorBBS)
fakeBBS = new(fake_bbs.FakeClient)
logger = lager.NewLogger("test")
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))
responseRecorder = httptest.NewRecorder()
handler = handlers.NewActualLRPHandler(fakeBBS, fakeLegacyBBS, logger)
示例7:
"github.com/cloudfoundry/dropsonde/metric_sender/fake"
"github.com/cloudfoundry/dropsonde/metrics"
"github.com/pivotal-golang/lager/lagertest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
)
var _ = Describe("DesireAppHandler", func() {
var (
logger *lagertest.TestLogger
fakeBBS *fake_bbs.FakeClient
buildpackBuilder *fakes.FakeRecipeBuilder
dockerBuilder *fakes.FakeRecipeBuilder
desireAppRequest cc_messages.DesireAppRequestFromCC
metricSender *fake.FakeMetricSender
request *http.Request
responseRecorder *httptest.ResponseRecorder
)
BeforeEach(func() {
var err error
logger = lagertest.NewTestLogger("test")
fakeBBS = new(fake_bbs.FakeClient)
buildpackBuilder = new(fakes.FakeRecipeBuilder)
dockerBuilder = new(fakes.FakeRecipeBuilder)
routingInfo, err := cc_messages.CCHTTPRoutes{
示例8:
"github.com/cloudfoundry-incubator/bbs/fake_bbs"
"github.com/cloudfoundry-incubator/bbs/models"
"github.com/cloudfoundry-incubator/nsync/handlers"
"github.com/pivotal-golang/lager/lagertest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
)
var _ = Describe("CancelTaskHandler", func() {
var (
logger *lagertest.TestLogger
fakeBBSClient *fake_bbs.FakeClient
request *http.Request
responseRecorder *httptest.ResponseRecorder
)
BeforeEach(func() {
var err error
logger = lagertest.NewTestLogger("test")
fakeBBSClient = new(fake_bbs.FakeClient)
responseRecorder = httptest.NewRecorder()
request, err = http.NewRequest("DELETE", "", nil)
Expect(err).NotTo(HaveOccurred())
request.Form = url.Values{
示例9:
)
type EventHolder struct {
event models.Event
}
var nilEventHolder = EventHolder{}
var _ = Describe("Watcher", func() {
var (
eventSource *eventfakes.FakeEventSource
bbsClient *fake_bbs.FakeClient
ccClient *fakes.FakeCcClient
watcherRunner *watcher.Watcher
process ifrit.Process
logger *lagertest.TestLogger
nextErr atomic.Value
nextEvent atomic.Value
)
BeforeEach(func() {
eventSource = new(eventfakes.FakeEventSource)
bbsClient = new(fake_bbs.FakeClient)
bbsClient.SubscribeToEventsReturns(eventSource, nil)
logger = lagertest.NewTestLogger("test")
ccClient = new(fakes.FakeCcClient)
var err error
示例10:
"github.com/cloudfoundry-incubator/bbs/models"
"github.com/cloudfoundry-incubator/bbs/models/internal/model_helpers"
"github.com/cloudfoundry-incubator/receptor"
"github.com/cloudfoundry-incubator/receptor/handlers"
"github.com/cloudfoundry-incubator/receptor/serialization"
"github.com/pivotal-golang/lager"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("TaskHandler", func() {
var (
logger lager.Logger
fakeClient *fake_bbs.FakeClient
responseRecorder *httptest.ResponseRecorder
handler *handlers.TaskHandler
request *http.Request
)
BeforeEach(func() {
fakeClient = &fake_bbs.FakeClient{}
logger = lager.NewLogger("test")
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))
responseRecorder = httptest.NewRecorder()
handler = handlers.NewTaskHandler(fakeClient, logger)
})
Describe("Create", func() {
var validCreateRequest receptor.TaskCreateRequest
var expectedTask *models.Task
示例11:
"github.com/pivotal-golang/lager"
"github.com/pivotal-golang/lager/lagertest"
"github.com/cloudfoundry-incubator/auctioneer/auctionrunnerdelegate"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Auction Runner Delegate", func() {
var (
delegate *auctionrunnerdelegate.AuctionRunnerDelegate
bbsClient *fake_bbs.FakeClient
serviceClient *fake_bbs.FakeServiceClient
metricSender *fake.FakeMetricSender
repClientFactory *repfakes.FakeClientFactory
repClient *repfakes.FakeClient
logger lager.Logger
)
BeforeEach(func() {
metricSender = fake.NewFakeMetricSender()
metrics.Initialize(metricSender, nil)
bbsClient = &fake_bbs.FakeClient{}
serviceClient = &fake_bbs.FakeServiceClient{}
repClientFactory = &repfakes.FakeClientFactory{}
repClient = &repfakes.FakeClient{}
repClientFactory.CreateClientReturns(repClient)
logger = lagertest.NewTestLogger("delegate")
示例12:
"github.com/cloudfoundry-incubator/nsync/handlers"
"github.com/cloudfoundry-incubator/nsync/recipebuilder"
"github.com/cloudfoundry-incubator/runtime-schema/cc_messages"
"github.com/pivotal-golang/lager/lagertest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
)
var _ = Describe("DesireTaskHandler", func() {
var (
logger *lagertest.TestLogger
fakeBBSClient *fake_bbs.FakeClient
buildpackBuilder *fakes.FakeRecipeBuilder
taskRequest cc_messages.TaskRequestFromCC
request *http.Request
responseRecorder *httptest.ResponseRecorder
)
BeforeEach(func() {
var err error
logger = lagertest.NewTestLogger("test")
fakeBBSClient = new(fake_bbs.FakeClient)
buildpackBuilder = new(fakes.FakeRecipeBuilder)
taskRequest = cc_messages.TaskRequestFromCC{
TaskGuid: "the-task-guid",
LogGuid: "some-log-guid",
示例13:
"github.com/cloudfoundry-incubator/receptor/task_handler"
"github.com/pivotal-golang/lager"
"github.com/tedsuo/ifrit"
"github.com/tedsuo/ifrit/ginkgomon"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/ghttp"
)
var _ = Describe("TaskWorker", func() {
var (
fakeBBS *fake_bbs.FakeClient
enqueue chan<- *models.Task
process ifrit.Process
fakeServer *ghttp.Server
logger lager.Logger
timeout time.Duration
)
BeforeEach(func() {
timeout = 1 * time.Second
cf_http.Initialize(timeout)
fakeServer = ghttp.NewServer()
logger = lager.NewLogger("task-watcher-test")
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.INFO))
fakeBBS = new(fake_bbs.FakeClient)
示例14:
"github.com/cloudfoundry-incubator/bbs/models"
"github.com/cloudfoundry-incubator/receptor"
"github.com/cloudfoundry-incubator/receptor/handlers"
"github.com/cloudfoundry-incubator/receptor/serialization"
"github.com/pivotal-golang/lager"
"github.com/vito/go-sse/sse"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Event Stream Handlers", func() {
var (
logger lager.Logger
fakeBBS *fake_bbs.FakeClient
handler *handlers.EventStreamHandler
server *httptest.Server
)
BeforeEach(func() {
fakeBBS = new(fake_bbs.FakeClient)
logger = lager.NewLogger("test")
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))
handler = handlers.NewEventStreamHandler(fakeBBS, logger)
})
AfterEach(func(done Done) {
if server != nil {
server.Close()
示例15:
"github.com/cloudfoundry-incubator/rep/generator/internal"
"github.com/cloudfoundry-incubator/rep/generator/internal/fake_internal"
"github.com/pivotal-golang/lager/lagertest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
)
var _ = Describe("OrdinaryLRPProcessor", func() {
const expectedCellID = "cell-id"
var (
processor internal.LRPProcessor
logger *lagertest.TestLogger
bbsClient *fake_bbs.FakeClient
containerDelegate *fake_internal.FakeContainerDelegate
evacuationReporter *fake_evacuation_context.FakeEvacuationReporter
)
BeforeEach(func() {
bbsClient = new(fake_bbs.FakeClient)
containerDelegate = new(fake_internal.FakeContainerDelegate)
evacuationReporter = &fake_evacuation_context.FakeEvacuationReporter{}
evacuationReporter.EvacuatingReturns(false)
processor = internal.NewLRPProcessor(bbsClient, containerDelegate, expectedCellID, evacuationReporter, 124)
logger = lagertest.NewTestLogger("test")
})
Describe("Process", func() {
const sessionPrefix = "test.ordinary-lrp-processor."