本文整理汇总了Golang中github.com/cloudfoundry-incubator/executor/depot/steps.Step类的典型用法代码示例。如果您正苦于以下问题:Golang Step类的具体用法?Golang Step怎么用?Golang Step使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Step类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
)
var _ = Describe("MonitorStep", func() {
var (
fakeStep1 *fakes.FakeStep
fakeStep2 *fakes.FakeStep
checkSteps chan *fakes.FakeStep
checkFunc func() steps.Step
hasBecomeHealthy <-chan struct{}
clock *fakeclock.FakeClock
fakeStreamer *fake_log_streamer.FakeLogStreamer
startTimeout time.Duration
healthyInterval time.Duration
unhealthyInterval time.Duration
step steps.Step
logger *lagertest.TestLogger
)
const numOfConcurrentMonitorSteps = 3
BeforeEach(func() {
startTimeout = 0
healthyInterval = 1 * time.Second
unhealthyInterval = 500 * time.Millisecond
开发者ID:snowsnail,项目名称:executor,代码行数:31,代码来源:monitor_step_test.go
示例2:
"bytes"
"errors"
"github.com/pivotal-golang/lager/lagertest"
"github.com/cloudfoundry-incubator/executor/depot/log_streamer/fake_log_streamer"
"github.com/cloudfoundry-incubator/executor/depot/steps"
"github.com/cloudfoundry-incubator/executor/depot/steps/fakes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("EmitProgressStep", func() {
var step steps.Step
var subStep steps.Step
var cancelled bool
var errorToReturn error
var fakeStreamer *fake_log_streamer.FakeLogStreamer
var startMessage, successMessage, failureMessage string
var logger *lagertest.TestLogger
var stderrBuffer *bytes.Buffer
var stdoutBuffer *bytes.Buffer
BeforeEach(func() {
stderrBuffer = new(bytes.Buffer)
stdoutBuffer = new(bytes.Buffer)
errorToReturn = nil
startMessage, successMessage, failureMessage = "", "", ""
cancelled = false
开发者ID:snowsnail,项目名称:executor,代码行数:31,代码来源:emit_progress_step_test.go
示例3: runStepProcess
func (store *GardenStore) runStepProcess(
logger lager.Logger,
step steps.Step,
hasStartedRunning <-chan struct{},
gardenContainer garden.Container,
guid string,
) {
process := ifrit.Invoke(ifrit.RunFunc(func(signals <-chan os.Signal, ready chan<- struct{}) error {
logger := logger.Session("run-step-process")
logger.Info("started")
defer logger.Info("finished")
seqComplete := make(chan error)
close(ready)
go func() {
seqComplete <- step.Perform()
}()
result := executor.ContainerRunResult{}
toldToStop := false
OUTER_LOOP:
for {
select {
case <-signals:
signals = nil
toldToStop = true
logger.Info("signaled")
step.Cancel()
case <-hasStartedRunning:
hasStartedRunning = nil
logger.Info("transitioning-to-running")
err := store.transitionToRunning(logger, gardenContainer)
if err != nil {
logger.Error("failed-transitioning-to-running", err)
result.Failed = true
result.FailureReason = err.Error()
break OUTER_LOOP
}
logger.Info("succeeded-transitioning-to-running")
case err := <-seqComplete:
if err == nil {
logger.Info("step-finished-normally")
} else if toldToStop {
logger.Info("step-cancelled")
result.Stopped = true
} else {
logger.Info("step-finished-with-error", lager.Data{"error": err.Error()})
result.Failed = true
result.FailureReason = err.Error()
}
break OUTER_LOOP
}
}
logger.Info("transitioning-to-complete")
err := store.transitionToComplete(logger, gardenContainer, result)
if err != nil {
logger.Error("failed-transitioning-to-complete", err)
return nil
}
logger.Info("succeeded-transitioning-to-complete")
return nil
}))
store.processesL.Lock()
store.runningProcesses[guid] = process
numProcesses := len(store.runningProcesses)
store.processesL.Unlock()
logger.Info("stored-step-process", lager.Data{"num-step-processes": numProcesses})
}
开发者ID:snowsnail,项目名称:executor,代码行数:79,代码来源:garden_store.go
示例4:
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/cloudfoundry-incubator/bbs/models"
"github.com/cloudfoundry-incubator/garden"
gfakes "github.com/cloudfoundry-incubator/garden/fakes"
"github.com/pivotal-golang/clock/fakeclock"
"github.com/cloudfoundry-incubator/executor"
"github.com/cloudfoundry-incubator/executor/depot/log_streamer/fake_log_streamer"
"github.com/cloudfoundry-incubator/executor/depot/steps"
"github.com/cloudfoundry-incubator/executor/fakes"
)
var _ = Describe("RunAction", func() {
var step steps.Step
var runAction models.RunAction
var fakeStreamer *fake_log_streamer.FakeLogStreamer
var gardenClient *fakes.FakeGardenClient
var logger *lagertest.TestLogger
var fileDescriptorLimit uint64
var externalIP string
var portMappings []executor.PortMapping
var exportNetworkEnvVars bool
var fakeClock *fakeclock.FakeClock
var spawnedProcess *gfakes.FakeProcess
var runError error
BeforeEach(func() {
开发者ID:snowsnail,项目名称:executor,代码行数:31,代码来源:run_step_test.go
示例5:
"github.com/cloudfoundry-incubator/executor/depot/log_streamer/fake_log_streamer"
"github.com/cloudfoundry-incubator/executor/depot/steps"
"github.com/cloudfoundry-incubator/executor/fakes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
archiveHelper "github.com/pivotal-golang/archiver/extractor/test_helper"
)
var _ = Describe("DownloadAction", func() {
var (
step steps.Step
downloadAction models.DownloadAction
cache *cdfakes.FakeCachedDownloader
gardenClient *fakes.FakeGardenClient
fakeStreamer *fake_log_streamer.FakeLogStreamer
logger *lagertest.TestLogger
rateLimiter chan struct{}
)
handle := "some-container-handle"
BeforeEach(func() {
cache = &cdfakes.FakeCachedDownloader{}
cache.FetchReturns(ioutil.NopCloser(new(bytes.Buffer)), 42, nil)
downloadAction = models.DownloadAction{
From: "http://mr_jones",
To: "/tmp/Antarctica",
CacheKey: "the-cache-key",
开发者ID:snowsnail,项目名称:executor,代码行数:32,代码来源:download_step_test.go
注:本文中的github.com/cloudfoundry-incubator/executor/depot/steps.Step类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论