本文整理汇总了Golang中github.com/cockroachdb/cockroach/pkg/acceptance/terrafarm.Farmer类的典型用法代码示例。如果您正苦于以下问题:Golang Farmer类的具体用法?Golang Farmer怎么用?Golang Farmer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Farmer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: queryCount
// queryCount returns the total SQL queries executed by the cluster.
func (cl continuousLoadTest) queryCount(f *terrafarm.Farmer) (float64, error) {
var client http.Client
var resp status.NodeStatus
host := f.Hostname(0)
if err := httputil.GetJSON(client, "http://"+host+":8080/_status/nodes/local", &resp); err != nil {
return 0, err
}
count, ok := resp.Metrics["sql.query.count"]
if !ok {
return 0, errors.New("couldn't find SQL query count metric")
}
return count, nil
}
示例2: startLoad
func (cl continuousLoadTest) startLoad(f *terrafarm.Farmer) error {
if *flagCLTWriters > len(f.Nodes()) {
return errors.Errorf("writers (%d) > nodes (%d)", *flagCLTWriters, len(f.Nodes()))
}
// We may have to retry restarting the load generators, because CockroachDB
// might have been started too recently to start accepting connections.
started := make(map[int]bool)
return util.RetryForDuration(10*time.Second, func() error {
for i := 0; i < *flagCLTWriters; i++ {
if !started[i] {
if err := f.Start(i, cl.Process); err != nil {
return err
}
}
}
return nil
})
}
示例3: assert
// assert fails the test if CockroachDB or the load generators are down.
func (cl continuousLoadTest) assert(t *testing.T, f *terrafarm.Farmer) {
f.Assert(t)
for _, host := range f.Nodes()[0:*flagCLTWriters] {
f.AssertState(t, host, cl.Process, "RUNNING")
}
}