本文整理汇总了Golang中github.com/hashicorp/nomad/nomad/structs.ServiceCheck.Timeout方法的典型用法代码示例。如果您正苦于以下问题:Golang ServiceCheck.Timeout方法的具体用法?Golang ServiceCheck.Timeout怎么用?Golang ServiceCheck.Timeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/hashicorp/nomad/nomad/structs.ServiceCheck
的用法示例。
在下文中一共展示了ServiceCheck.Timeout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestConsul_ModifyCheck
func TestConsul_ModifyCheck(t *testing.T) {
apiClient := &mockConsulApiClient{}
c := newConsulService()
c.client = apiClient
task := newTask()
var checks []*structs.ServiceCheck
s1 := structs.Service{
Name: "example-cache-redis",
Tags: []string{"global"},
PortLabel: "db",
Checks: checks,
}
task.Services = append(task.Services, &s1)
c.Register(task, mock.Alloc())
check1 := structs.ServiceCheck{
Name: "alive",
Type: "tcp",
Interval: 10 * time.Second,
Timeout: 5 * time.Second,
}
s1.Checks = append(s1.Checks, &check1)
c.performSync()
if apiClient.checkRegisterCallCount != 1 {
t.Fatalf("Expected number of check registrations: %v, Actual: %v", 1, apiClient.checkRegisterCallCount)
}
check1.Timeout = 2 * time.Second
c.performSync()
if apiClient.checkRegisterCallCount != 2 {
t.Fatalf("Expected number of check registrations: %v, Actual: %v", 2, apiClient.checkRegisterCallCount)
}
}