本文整理汇总了Golang中github.com/cloudfoundry/gorouter/test_util.NextAvailPort函数的典型用法代码示例。如果您正苦于以下问题:Golang NextAvailPort函数的具体用法?Golang NextAvailPort怎么用?Golang NextAvailPort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NextAvailPort函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1:
"net/http"
"time"
)
var _ = Describe("Router", func() {
var natsRunner *natsrunner.NATSRunner
var config *cfg.Config
var mbusClient *yagnats.Client
var registry *rregistry.RouteRegistry
var varz vvarz.Varz
var router *Router
var natsPort uint16
BeforeEach(func() {
natsPort = test_util.NextAvailPort()
natsRunner = natsrunner.NewNATSRunner(int(natsPort))
natsRunner.Start()
proxyPort := test_util.NextAvailPort()
statusPort := test_util.NextAvailPort()
config = test_util.SpecConfig(natsPort, statusPort, proxyPort)
config.EndpointTimeout = 5 * time.Second
mbusClient = natsRunner.MessageBus.(*yagnats.Client)
registry = rregistry.NewRouteRegistry(config, mbusClient)
varz = vvarz.NewVarz(registry)
logcounter := vcap.NewLogCounter()
proxy := proxy.NewProxy(proxy.ProxyArgs{
EndpointTimeout: config.EndpointTimeout,
开发者ID:tomzhang,项目名称:golang-devops-stuff,代码行数:31,代码来源:router_drain_test.go
示例2:
gorouterSession = session
return session
}
stopGorouter := func(gorouterSession *Session) {
err := gorouterSession.Command.Process.Signal(syscall.SIGTERM)
Expect(err).ToNot(HaveOccurred())
Eventually(gorouterSession, 5).Should(Exit(0))
}
BeforeEach(func() {
var err error
tmpdir, err = ioutil.TempDir("", "gorouter")
Expect(err).ToNot(HaveOccurred())
natsPort = test_util.NextAvailPort()
natsRunner = test_util.NewNATSRunner(int(natsPort))
natsRunner.Start()
})
AfterEach(func() {
if natsRunner != nil {
natsRunner.Stop()
}
os.RemoveAll(tmpdir)
if gorouterSession != nil && gorouterSession.ExitCode() == -1 {
stopGorouter(gorouterSession)
}
})
开发者ID:yingkitw,项目名称:gorouter,代码行数:31,代码来源:main_test.go
示例3:
return session
}
stopGorouter := func(gorouterSession *Session) {
err := gorouterSession.Command.Process.Signal(syscall.SIGTERM)
Expect(err).ToNot(HaveOccurred())
Eventually(gorouterSession, 5).Should(Exit(0))
}
BeforeEach(func() {
var err error
tmpdir, err = ioutil.TempDir("", "gorouter")
Expect(err).ToNot(HaveOccurred())
natsPort = test_util.NextAvailPort()
natsRunner = natsrunner.NewNATSRunner(int(natsPort))
natsRunner.Start()
})
AfterEach(func() {
if natsRunner != nil {
natsRunner.Stop()
}
os.RemoveAll(tmpdir)
if gorouterSession != nil && gorouterSession.ExitCode() == -1 {
stopGorouter(gorouterSession)
}
})
开发者ID:jungle0755,项目名称:gorouter,代码行数:30,代码来源:main_test.go
示例4:
serveComponent(component)
req := buildGetRequest(component, "/non-existent-path")
req.SetBasicAuth("username", "password")
code, _, _ := doGetRequest(req)
Expect(code).To(Equal(404))
})
Describe("Register", func() {
var mbusClient *nats.Conn
var natsRunner *test_util.NATSRunner
var logger lager.Logger
BeforeEach(func() {
natsPort := test_util.NextAvailPort()
natsRunner = test_util.NewNATSRunner(int(natsPort))
natsRunner.Start()
mbusClient = natsRunner.MessageBus
logger = lagertest.NewTestLogger("test")
})
AfterEach(func() {
natsRunner.Stop()
})
It("subscribes to vcap.component.discover", func() {
done := make(chan struct{})
members := []string{
"type",
开发者ID:yingkitw,项目名称:gorouter,代码行数:31,代码来源:component_test.go
注:本文中的github.com/cloudfoundry/gorouter/test_util.NextAvailPort函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论