本文整理匯總了Golang中github.com/cockroachdb/cockroach/server.TestServer.Stopper方法的典型用法代碼示例。如果您正苦於以下問題:Golang TestServer.Stopper方法的具體用法?Golang TestServer.Stopper怎麽用?Golang TestServer.Stopper使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cockroachdb/cockroach/server.TestServer
的用法示例。
在下文中一共展示了TestServer.Stopper方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: setupMultipleRanges
// setupMultipleRanges creates a test server and splits the
// key range at the given keys. Returns the test server and client.
// The caller is responsible for stopping the server and
// closing the client.
func setupMultipleRanges(t *testing.T, ts *server.TestServer, splitAt ...string) *client.DB {
db := createTestClient(t, ts.Stopper(), ts.ServingAddr())
// Split the keyspace at the given keys.
for _, key := range splitAt {
if err := db.AdminSplit(key); err != nil {
// Don't leak server goroutines.
t.Fatal(err)
}
}
return db
}
示例2: initReverseScanTestEnv
func initReverseScanTestEnv(s *server.TestServer, t *testing.T) *client.DB {
db := createTestClient(t, s.Stopper(), s.ServingAddr())
// Set up multiple ranges:
// ["", "b"),["b", "e") ,["e", "g") and ["g", "\xff\xff").
for _, key := range []string{"b", "e", "g"} {
// Split the keyspace at the given key.
if pErr := db.AdminSplit(key); pErr != nil {
t.Fatal(pErr)
}
}
// Write keys before, at, and after the split key.
for _, key := range []string{"a", "b", "c", "d", "e", "f", "g", "h"} {
if pErr := db.Put(key, "value"); pErr != nil {
t.Fatal(pErr)
}
}
return db
}