當前位置: 首頁>>代碼示例>>Golang>>正文


Golang terrafarm.Farmer類代碼示例

本文整理匯總了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
}
開發者ID:BramGruneir,項目名稱:cockroach,代碼行數:14,代碼來源:continuous_load_test.go

示例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
	})
}
開發者ID:hvaara,項目名稱:cockroach,代碼行數:19,代碼來源:continuous_load_test.go

示例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")
	}
}
開發者ID:hvaara,項目名稱:cockroach,代碼行數:7,代碼來源:continuous_load_test.go


注:本文中的github.com/cockroachdb/cockroach/pkg/acceptance/terrafarm.Farmer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。