本文整理匯總了Golang中github.com/cockroachdb/cockroach/pkg/testutils/serverutils.TestServerInterface.KVClient方法的典型用法代碼示例。如果您正苦於以下問題:Golang TestServerInterface.KVClient方法的具體用法?Golang TestServerInterface.KVClient怎麽用?Golang TestServerInterface.KVClient使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cockroachdb/cockroach/pkg/testutils/serverutils.TestServerInterface
的用法示例。
在下文中一共展示了TestServerInterface.KVClient方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: runTestFlow
// runTestFlow runs a flow with the given processors and returns the results.
// Any errors stop the current test.
func runTestFlow(
t *testing.T, srv serverutils.TestServerInterface, procs ...distsqlrun.ProcessorSpec,
) sqlbase.EncDatumRows {
kvDB := srv.KVClient().(*client.DB)
distSQLSrv := srv.DistSQLServer().(*distsqlrun.ServerImpl)
req := distsqlrun.SetupFlowRequest{
Txn: client.NewTxn(context.TODO(), *kvDB).Proto,
Flow: distsqlrun.FlowSpec{
FlowID: distsqlrun.FlowID{UUID: uuid.MakeV4()},
Processors: procs,
},
}
var rowBuf distsqlrun.RowBuffer
flow, err := distSQLSrv.SetupSyncFlow(context.TODO(), &req, &rowBuf)
if err != nil {
t.Fatal(err)
}
flow.Start(func() {})
flow.Wait()
flow.Cleanup()
if rowBuf.Err != nil {
t.Fatal(rowBuf.Err)
}
if !rowBuf.Closed {
t.Errorf("output not closed")
}
return rowBuf.Rows
}