本文整理汇总了Golang中github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit.Process类的典型用法代码示例。如果您正苦于以下问题:Golang Process类的具体用法?Golang Process怎么用?Golang Process使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Process类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: forwardSignals
func forwardSignals(signals <-chan os.Signal, process ifrit.Process) {
exit := process.Wait()
for {
select {
case sig := <-signals:
process.Signal(sig)
case <-exit:
return
}
}
}
开发者ID:guanglinlv,项目名称:docker_app_lifecycle,代码行数:11,代码来源:proxy.go
示例2:
"fmt"
"os"
"strings"
"time"
. "github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/onsi/ginkgo"
. "github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/onsi/gomega"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit/ginkgomon"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit/grouper"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/builder"
)
var _ = Describe("Builder runner", func() {
var (
lifecycle ifrit.Process
fakeDeamonRunner func(signals <-chan os.Signal, ready chan<- struct{}) error
)
BeforeEach(func() {
builder := main.Builder{
RepoName: "ubuntu",
Tag: "latest",
OutputFilename: "/tmp/result/result.json",
DockerDaemonTimeout: 300 * time.Millisecond,
CacheDockerImage: true,
}
lifecycle = ifrit.Background(grouper.NewParallel(os.Interrupt, grouper.Members{
{"builder", ifrit.RunFunc(builder.Run)},
{"fake_docker_daemon", ifrit.RunFunc(fakeDeamonRunner)},
}))
开发者ID:guanglinlv,项目名称:docker_app_lifecycle,代码行数:32,代码来源:builder_runner_test.go
示例3:
startedRequestChan <- struct{}{}
<-finishRequestChan
w.Write([]byte("yo"))
})
)
BeforeEach(func() {
startedRequestChan = make(chan struct{}, 1)
finishRequestChan = make(chan struct{}, 1)
port := 8000 + GinkgoParallelNode()
address = fmt.Sprintf("127.0.0.1:%d", port)
server = http_server.New(address, handler)
})
Describe("Envoke", func() {
var process ifrit.Process
Context("when the server starts successfully", func() {
BeforeEach(func() {
process = ifrit.Envoke(server)
})
AfterEach(func() {
process.Signal(syscall.SIGINT)
Eventually(process.Wait()).Should(Receive())
})
Context("and a request is in flight", func() {
type httpResponse struct {
response *http.Response
err error
开发者ID:guanglinlv,项目名称:docker_app_lifecycle,代码行数:31,代码来源:http_server_test.go
示例4:
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit/fake_runner"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit/grouper"
. "github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/onsi/ginkgo"
. "github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/onsi/gomega"
)
var _ = Describe("Ordered Group", func() {
var (
started chan struct{}
groupRunner ifrit.Runner
groupProcess ifrit.Process
members grouper.Members
childRunner1 *fake_runner.TestRunner
childRunner2 *fake_runner.TestRunner
childRunner3 *fake_runner.TestRunner
Δ time.Duration = 10 * time.Millisecond
)
Describe("Start", func() {
BeforeEach(func() {
childRunner1 = fake_runner.NewTestRunner()
childRunner2 = fake_runner.NewTestRunner()
childRunner3 = fake_runner.NewTestRunner()
members = grouper.Members{
{"child1", childRunner1},
开发者ID:guanglinlv,项目名称:docker_app_lifecycle,代码行数:31,代码来源:ordered_test.go
示例5: Kill
func Kill(process ifrit.Process, intervals ...interface{}) {
if process != nil {
process.Signal(os.Kill)
Eventually(process.Wait(), intervals...).Should(Receive(), "killed ginkgomon process failed to exit in time")
}
}
开发者ID:guanglinlv,项目名称:docker_app_lifecycle,代码行数:6,代码来源:helpers.go
示例6: Interrupt
func Interrupt(process ifrit.Process, intervals ...interface{}) {
process.Signal(os.Interrupt)
Eventually(process.Wait(), intervals...).Should(Receive(), "interrupted ginkgomon process failed to exit in time")
}
开发者ID:guanglinlv,项目名称:docker_app_lifecycle,代码行数:4,代码来源:helpers.go
示例7:
package restart_test
import (
"os"
. "github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/onsi/ginkgo"
. "github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/onsi/gomega"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit/fake_runner"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit/restart"
)
var _ = Describe("Restart", func() {
var testRunner *fake_runner.TestRunner
var restarter restart.Restarter
var process ifrit.Process
BeforeEach(func() {
testRunner = fake_runner.NewTestRunner()
restarter = restart.Restarter{
Runner: testRunner,
Load: func(runner ifrit.Runner, err error) ifrit.Runner {
return nil
},
}
})
JustBeforeEach(func() {
process = ifrit.Background(restarter)
})
开发者ID:guanglinlv,项目名称:docker_app_lifecycle,代码行数:30,代码来源:restart_test.go
示例8:
package ifrit_test
import (
. "github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/onsi/ginkgo"
. "github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/onsi/gomega"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit/test_helpers"
"os"
)
var _ = Describe("Process", func() {
Context("when a process is envoked", func() {
var pinger test_helpers.PingChan
var pingProc ifrit.Process
var errChan chan error
BeforeEach(func() {
pinger = make(test_helpers.PingChan)
pingProc = ifrit.Envoke(pinger)
errChan = make(chan error)
})
Describe("Wait()", func() {
BeforeEach(func() {
go func() {
errChan <- <-pingProc.Wait()
}()
go func() {
errChan <- <-pingProc.Wait()
}()
})
开发者ID:guanglinlv,项目名称:docker_app_lifecycle,代码行数:31,代码来源:process_test.go
示例9:
package proxy_test
import (
"os"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit/fake_runner"
"github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit/proxy"
. "github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/onsi/ginkgo"
. "github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/onsi/gomega"
)
var _ = Describe("Proxy", func() {
var testRunner *fake_runner.TestRunner
var process ifrit.Process
var proxySignals chan os.Signal
var receivedSignals <-chan os.Signal
BeforeEach(func() {
proxySignals = make(chan os.Signal, 1)
testRunner = fake_runner.NewTestRunner()
process = ifrit.Background(proxy.New(proxySignals, testRunner))
receivedSignals = testRunner.WaitForCall()
testRunner.TriggerReady()
})
It("sends the proxied signals to the embedded runner", func() {
proxySignals <- os.Interrupt
Eventually(receivedSignals).Should(Receive(Equal(os.Interrupt)))
})
开发者ID:guanglinlv,项目名称:docker_app_lifecycle,代码行数:31,代码来源:proxy_test.go
注:本文中的github.com/cloudfoundry-incubator/docker_app_lifecycle/Godeps/_workspace/src/github.com/tedsuo/ifrit.Process类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论