當前位置: 首頁>>代碼示例>>Golang>>正文


Golang fakes.FakeClient類代碼示例

本文整理匯總了Golang中github.com/cloudfoundry-incubator/executor/fakes.FakeClient的典型用法代碼示例。如果您正苦於以下問題:Golang FakeClient類的具體用法?Golang FakeClient怎麽用?Golang FakeClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了FakeClient類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1:

	fake_client "github.com/cloudfoundry-incubator/executor/fakes"
	"github.com/cloudfoundry-incubator/rep/lrp_stopper"
	"github.com/pivotal-golang/lager"
	"github.com/pivotal-golang/lager/lagertest"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/cloudfoundry-incubator/bbs/models"
)

var _ = Describe("LRP Stopper", func() {
	var (
		cellID    string
		stopper   lrp_stopper.LRPStopper
		client    *fake_client.FakeClient
		logger    lager.Logger
		actualLRP *models.ActualLRP
	)

	BeforeEach(func() {
		cellID = "the-cell-id"
		actualLRP = &models.ActualLRP{
			ActualLRPKey: models.NewActualLRPKey(
				"some-process-guid",
				1138,
				"some-domain",
			),
			ActualLRPInstanceKey: models.NewActualLRPInstanceKey(
				"some-instance-guid",
				"some-cell-id",
開發者ID:jianhuiz,項目名稱:rep,代碼行數:31,代碼來源:lrp_stopper_test.go

示例2:

	"net/http"
	"net/http/httptest"
	"net/url"

	executorfakes "github.com/cloudfoundry-incubator/executor/fakes"
	"github.com/cloudfoundry-incubator/rep/handlers"
	"github.com/pivotal-golang/lager"
	"github.com/pivotal-golang/lager/lagertest"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("StopLRPInstanceHandler", func() {
	var stopInstanceHandler *handlers.StopLRPInstanceHandler
	var fakeClient *executorfakes.FakeClient
	var resp *httptest.ResponseRecorder
	var req *http.Request

	BeforeEach(func() {
		var err error
		fakeClient = &executorfakes.FakeClient{}

		logger := lagertest.NewTestLogger("test")
		logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))

		stopInstanceHandler = handlers.NewStopLRPInstanceHandler(logger, fakeClient)

		resp = httptest.NewRecorder()

		req, err = http.NewRequest("POST", "", nil)
開發者ID:jiangytcn,項目名稱:rep,代碼行數:31,代碼來源:stop_lrp_handler_test.go

示例3: EventType

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	. "github.com/onsi/gomega/gbytes"
)

type BogusEvent struct{}

func (BogusEvent) EventType() executor.EventType {
	return executor.EventTypeInvalid
}

var _ = Describe("Generator", func() {
	var (
		cellID             string
		fakeExecutorClient *efakes.FakeClient

		opGenerator generator.Generator
	)

	BeforeEach(func() {
		cellID = "some-cell-id"
		fakeExecutorClient = new(efakes.FakeClient)
		fakeEvacuationReporter := &fake_evacuation_context.FakeEvacuationReporter{}
		opGenerator = generator.New(cellID, fakeBBS, fakeExecutorClient, fakeEvacuationReporter, 0)
	})

	Describe("BatchOperations", func() {
		const sessionName = "test.batch-operations"

		var (
			batch    map[string]operationq.Operation
開發者ID:jianhuiz,項目名稱:rep,代碼行數:31,代碼來源:generator_test.go

示例4:

	"github.com/tedsuo/ifrit"
	"github.com/tedsuo/ifrit/ginkgomon"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("Maintain Presence", func() {
	var (
		config          maintain.Config
		fakeHeartbeater *maintain_fakes.FakeRunner
		fakeClient      *fake_client.FakeClient
		serviceClient   *fake_bbs.FakeServiceClient
		logger          *lagertest.TestLogger

		maintainer        ifrit.Runner
		maintainProcess   ifrit.Process
		heartbeaterErrors chan error
		observedSignals   chan os.Signal
		clock             *fakeclock.FakeClock
		pingErrors        chan error
	)

	BeforeEach(func() {
		pingErrors = make(chan error, 1)
		fakeClient = &fake_client.FakeClient{
			PingStub: func() error {
				return <-pingErrors
			},
		}
		resources := executor.ExecutorResources{MemoryMB: 128, DiskMB: 1024, Containers: 6}
開發者ID:emc-xchallenge,項目名稱:rep,代碼行數:32,代碼來源:maintain_test.go

示例5:

	. "github.com/onsi/gomega"

	"github.com/cloudfoundry-incubator/executor"
	"github.com/cloudfoundry-incubator/executor/depot/metrics"
	"github.com/cloudfoundry-incubator/executor/fakes"
	"github.com/cloudfoundry/dropsonde/metric_sender/fake"
	dropsonde_metrics "github.com/cloudfoundry/dropsonde/metrics"
	"github.com/pivotal-golang/lager/lagertest"
	"github.com/tedsuo/ifrit"
)

var _ = Describe("Reporter", func() {
	var (
		reportInterval time.Duration
		sender         *fake.FakeMetricSender
		executorClient *fakes.FakeClient

		reporter ifrit.Process
		logger   *lagertest.TestLogger
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")
		reportInterval = 100 * time.Millisecond
		executorClient = new(fakes.FakeClient)

		sender = fake.NewFakeMetricSender()
		dropsonde_metrics.Initialize(sender, nil)

		executorClient.TotalResourcesReturns(executor.ExecutorResources{
			MemoryMB:   1024,
			DiskMB:     2048,
開發者ID:snowsnail,項目名稱:executor,代碼行數:32,代碼來源:reporter_test.go

示例6:

	"strings"

	"github.com/cloudfoundry-incubator/executor"
	"github.com/cloudfoundry-incubator/executor/fakes"
	"github.com/cloudfoundry-incubator/rep/generator/internal"
	"github.com/pivotal-golang/archiver/extractor/test_helper"
	"github.com/pivotal-golang/lager/lagertest"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("ContainerDelegate", func() {
	var containerDelegate internal.ContainerDelegate
	var executorClient *fakes.FakeClient
	var logger *lagertest.TestLogger
	var expectedGuid = "some-instance-guid"
	const sessionPrefix = "test"

	BeforeEach(func() {
		executorClient = new(fakes.FakeClient)
		containerDelegate = internal.NewContainerDelegate(executorClient)
		logger = lagertest.NewTestLogger(sessionPrefix)
	})

	Describe("RunContainer", func() {
		var result bool
		var runRequest executor.RunRequest

		BeforeEach(func() {
開發者ID:jiangytcn,項目名稱:rep,代碼行數:31,代碼來源:container_delegate_test.go

示例7:

var _ = Describe("Evacuation", func() {
	const (
		cellID            = "cell-id"
		pollingInterval   = 30 * time.Second
		evacuationTimeout = time.Duration(6) * pollingInterval
	)

	var (
		logger             *lagertest.TestLogger
		fakeClock          *fakeclock.FakeClock
		executorClient     *fakes.FakeClient
		evacuatable        evacuation_context.Evacuatable
		evacuationNotifier evacuation_context.EvacuationNotifier

		evacuator *evacuation.Evacuator
		process   ifrit.Process

		errChan chan error

		TaskTags   map[string]string
		LRPTags    map[string]string
		containers []executor.Container
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")
		fakeClock = fakeclock.NewFakeClock(time.Now())
		executorClient = &fakes.FakeClient{}

		evacuatable, _, evacuationNotifier = evacuation_context.New()
開發者ID:jiangytcn,項目名稱:rep,代碼行數:30,代碼來源:evacuation_test.go

示例8:

	"github.com/cloudfoundry-incubator/bbs/models"
	executor "github.com/cloudfoundry-incubator/executor"
	fake_client "github.com/cloudfoundry-incubator/executor/fakes"
	"github.com/cloudfoundry-incubator/rep"
	"github.com/cloudfoundry-incubator/rep/auction_cell_rep"
	"github.com/cloudfoundry-incubator/rep/evacuation/evacuation_context/fake_evacuation_context"
	"github.com/pivotal-golang/lager/lagertest"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("AuctionCellRep", func() {
	var cellRep rep.AuctionCellClient
	var client *fake_client.FakeClient
	var commonErr error
	var logger *lagertest.TestLogger
	var evacuationReporter *fake_evacuation_context.FakeEvacuationReporter

	const expectedCellID = "some-cell-id"
	var expectedGuid string
	var expectedGuidError error
	var fakeGenerateContainerGuid func() (string, error)

	const linuxStack = "linux"
	const linuxPath = "/data/rootfs/linux"
	var linuxRootFSURL string

	BeforeEach(func() {
		client = new(fake_client.FakeClient)
開發者ID:jiangytcn,項目名稱:rep,代碼行數:30,代碼來源:auction_cell_rep_test.go

示例9:

	containers []executor.Container
	err        error
}

type metricsResults struct {
	metrics executor.ContainerMetrics
	err     error
}

var _ = Describe("StatsReporter", func() {
	var (
		logger *lagertest.TestLogger

		interval           time.Duration
		fakeClock          *fakeclock.FakeClock
		fakeExecutorClient *efakes.FakeClient
		fakeMetricSender   *msfake.FakeMetricSender

		metricsResults chan map[string]executor.Metrics
		process        ifrit.Process
	)

	sendResults := func() {
		metricsResults <- map[string]executor.Metrics{
			"guid-without-index": executor.Metrics{
				MetricsConfig: executor.MetricsConfig{Guid: "metrics-guid-without-index"},
				ContainerMetrics: executor.ContainerMetrics{
					MemoryUsageInBytes: 123,
					DiskUsageInBytes:   456,
					TimeSpentInCPU:     100 * time.Second,
				},
開發者ID:snowsnail,項目名稱:executor,代碼行數:31,代碼來源:stats_reporter_test.go


注:本文中的github.com/cloudfoundry-incubator/executor/fakes.FakeClient類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。