本文整理汇总了Golang中github.com/hashicorp/consul/api.AgentServiceRegistration.Checks方法的典型用法代码示例。如果您正苦于以下问题:Golang AgentServiceRegistration.Checks方法的具体用法?Golang AgentServiceRegistration.Checks怎么用?Golang AgentServiceRegistration.Checks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/hashicorp/consul/api.AgentServiceRegistration
的用法示例。
在下文中一共展示了AgentServiceRegistration.Checks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Register
func (r *ConsulAdapter) Register(service *bridge.Service) error {
registration := new(consulapi.AgentServiceRegistration)
registration.ID = service.ID
registration.Name = service.Name
registration.Port = service.Port
registration.Tags = service.Tags
registration.Address = service.IP
registration.Checks = r.buildChecks(service)
return r.client.Agent().ServiceRegister(registration)
}
示例2:
})
JustBeforeEach(func() {
registrationRunner = locket.NewRegistrationRunner(logger, registration, client, 5*time.Second, clock)
})
Context("when the service is invalid", func() {
JustBeforeEach(func() {
registrationProcess = ifrit.Background(registrationRunner)
})
Context("when the service has a value in the Checks list", func() {
BeforeEach(func() {
registration.Checks = []*api.AgentServiceCheck{
&api.AgentServiceCheck{
TTL: "1m",
},
}
})
It("returns a validation error", func() {
Eventually(registrationProcess.Wait()).Should(Receive(MatchError("Support for multiple service checks not implemented")))
})
It("does not become ready", func() {
Consistently(registrationProcess.Ready()).Should(Not(BeClosed()))
})
It("does not try to register the service", func() {
Consistently(agent.ServiceRegisterCallCount).Should(Equal(0))
})