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",
"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)
. "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
"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}
. "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,
"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() {
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()
"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)
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, },