本文整理汇总了Golang中github.com/cockroachdb/cockroach/testutils/serverutils.TestServerInterface.Stopper方法的典型用法代码示例。如果您正苦于以下问题:Golang TestServerInterface.Stopper方法的具体用法?Golang TestServerInterface.Stopper怎么用?Golang TestServerInterface.Stopper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cockroachdb/cockroach/testutils/serverutils.TestServerInterface
的用法示例。
在下文中一共展示了TestServerInterface.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 serverutils.TestServerInterface, 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 serverutils.TestServerInterface, 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 err := db.AdminSplit(key); err != nil {
t.Fatal(err)
}
}
// Write keys before, at, and after the split key.
for _, key := range []string{"a", "b", "c", "d", "e", "f", "g", "h"} {
if err := db.Put(key, "value"); err != nil {
t.Fatal(err)
}
}
return db
}