Documentation
¶
Overview ¶
Package plugintest drives a Go plugin's protocol loop over in-memory pipes, as core would.
Index ¶
- func CaseFile(t testing.TB, name string) []byte
- func Conformance(t *testing.T, p plugin.Package, o Options)
- func ExpectError(t *testing.T, r map[string]any, contains string)
- func FieldNames(describe map[string]any) string
- func FrameBytes(tag byte, body []byte) []byte
- type Check
- type Conversation
- func (c *Conversation) CloseInput()
- func (c *Conversation) Exec(sql string) string
- func (c *Conversation) Hello() map[string]any
- func (c *Conversation) Message() map[string]any
- func (c *Conversation) Open(conn map[string]any)
- func (c *Conversation) OpenReadOnly(conn map[string]any)
- func (c *Conversation) Query(sql string) []arrow.RecordBatch
- func (c *Conversation) Records() []arrow.RecordBatch
- func (c *Conversation) Reply() map[string]any
- func (c *Conversation) ReplySkippingRecords() map[string]any
- func (c *Conversation) Send(v any)
- func (c *Conversation) SendRaw(b []byte)
- func (c *Conversation) SendRecord(rec arrow.RecordBatch)
- type Options
- type Protocol
- type SchemaDoc
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Conformance ¶
Conformance fails t unless every case passes for every role of p.
func ExpectError ¶
ExpectError fails unless r is an error containing contains.
func FieldNames ¶
FieldNames is a describe reply's connection field names, comma-separated.
func FrameBytes ¶
FrameBytes is one frame on the wire.
Types ¶
type Check ¶
type Check struct {
Plugin string
Name string
// Passed is true for a case that passed or didn't apply.
Passed bool
Detail string
// Skipped says why the case didn't apply; empty when it ran.
Skipped string
}
Check is one case's outcome for one plugin.
type Conversation ¶
type Conversation struct {
Code chan int
// Logs holds the `log` and `progress` messages Reply skipped, in order.
Logs []map[string]any
// contains filtered or unexported fields
}
Conversation is one plugin process: requests in, replies out.
func (*Conversation) CloseInput ¶
func (c *Conversation) CloseInput()
CloseInput closes the plugin's stdin.
func (*Conversation) Exec ¶
func (c *Conversation) Exec(sql string) string
Exec runs sql and discards whatever it returns (no_result, or a result set), failing on an error. It returns the first reply's type.
func (*Conversation) Hello ¶
func (c *Conversation) Hello() map[string]any
Hello greets the plugin and returns its hello reply.
func (*Conversation) Message ¶
func (c *Conversation) Message() map[string]any
Message reads the next JSON message, whatever it is.
func (*Conversation) Open ¶
func (c *Conversation) Open(conn map[string]any)
Open opens a session with conn and expects ok.
func (*Conversation) OpenReadOnly ¶
func (c *Conversation) OpenReadOnly(conn map[string]any)
OpenReadOnly opens a session with conn and `read_only: true`, and expects ok.
func (*Conversation) Query ¶
func (c *Conversation) Query(sql string) []arrow.RecordBatch
Query runs sql and returns the result's records, after checking the reply sequence.
func (*Conversation) Records ¶
func (c *Conversation) Records() []arrow.RecordBatch
Records reads one Arrow frame.
func (*Conversation) Reply ¶
func (c *Conversation) Reply() map[string]any
Reply reads one JSON reply, keeping any `log` and `progress` messages before it in Logs.
func (*Conversation) ReplySkippingRecords ¶
func (c *Conversation) ReplySkippingRecords() map[string]any
ReplySkippingRecords is Reply that also discards Arrow frames before the reply, such as a batch already in flight when the plugin was told to cancel.
func (*Conversation) SendRaw ¶
func (c *Conversation) SendRaw(b []byte)
SendRaw writes bytes as they are.
func (*Conversation) SendRecord ¶
func (c *Conversation) SendRecord(rec arrow.RecordBatch)
SendRecord writes one Arrow frame.
type Options ¶
type Options struct {
// Session, when set, runs the session cases (sources).
Session *Session
}
Options say how to run the suite.
type SchemaDoc ¶
type SchemaDoc struct {
// contains filtered or unexported fields
}
SchemaDoc is the parsed schema.
func (*SchemaDoc) CheckResponse ¶
CheckResponse reports why msg (a decoded JSON message) isn't a message a plugin may send.