Documentation ¶
Overview ¶
Package reporting implements test result reporting.
Index ¶
- Constants
- Variables
- func WriteJUnitXMLResults(path string, results []*resultsjson.Result) error
- func WriteLegacyResults(path string, results []*resultsjson.Result) error
- func WriteResultsToLogs(ctx context.Context, results []*resultsjson.Result, resDir string, ...)
- type RPCClient
- type RPCTestLogWriter
- type StreamedWriter
Constants ¶
const JUnitXMLFilename = "results.xml"
JUnitXMLFilename is a file name to be used with WriteJUnitXMLResults.
const LegacyResultsFilename = "results.json"
LegacyResultsFilename is a file name to be used with WriteLegacyResults.
const StreamedResultsFilename = "streamed_results.jsonl"
StreamedResultsFilename is a file name to be used with StreamedWriter.
Variables ¶
var ErrTerminate = errors.New("reporting service requested to terminate")
ErrTerminate is returned by ReportResult when the reporting gRPC service requested us to terminate testing.
Functions ¶
func WriteJUnitXMLResults ¶
func WriteJUnitXMLResults(path string, results []*resultsjson.Result) error
WriteJUnitXMLResults saves Tast test results to path in the JUnit XML format.
func WriteLegacyResults ¶
func WriteLegacyResults(path string, results []*resultsjson.Result) error
WriteLegacyResults writes results to path in the Tast's legacy results.json format.
func WriteResultsToLogs ¶
func WriteResultsToLogs(ctx context.Context, results []*resultsjson.Result, resDir string, complete, cmdTimeoutPast bool)
WriteResultsToLogs writes test results to the console via ctx. resDir is the directory where test result files have been saved. complete indicates whether we could run all tests.
Types ¶
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient implements a client of the reporting gRPC service. nil is a valid RPCClient that discards all reports.
func NewRPCClient ¶
NewRPCClient creates a new RPCClient that reports test results to the server at addr. If addr is an empty string, this function returns nil, which is a valid RPCClient that discards all reports.
func (*RPCClient) Close ¶
Close waits until the server acknowledges delivery of all logs messages, and closes the underlying connection of the RPCClient.
func (*RPCClient) NewTestLogWriter ¶
func (c *RPCClient) NewTestLogWriter(testName, logPath string) *RPCTestLogWriter
NewTestLogWriter returns an RPCTestLogWriter that reports written data as test logs via the reporting gRPC service.
func (*RPCClient) ReportResult ¶
ReportResult reports a test result to the reporting gRPC service. It may return ErrTerminate if the server responded with a request to terminate testing.
type RPCTestLogWriter ¶
type RPCTestLogWriter struct {
// contains filtered or unexported fields
}
RPCTestLogWriter is an io.Writer that reports written data as test logs via the reporting gRPC service. nil is a valid RPCTestLogWriter that silently discards all written data.
type StreamedWriter ¶
type StreamedWriter struct {
// contains filtered or unexported fields
}
StreamedWriter writes a stream of JSON-marshaled jsonresults.Result objects to a file.
func NewStreamedWriter ¶
func NewStreamedWriter(path string) (*StreamedWriter, error)
NewStreamedWriter creates and returns a new StreamedWriter for writing to a file at path. If the file already exists, new results are appended to it.
func (*StreamedWriter) Write ¶
func (w *StreamedWriter) Write(res *resultsjson.Result, update bool) error
Write writes the JSON-marshaled representation of res to the file. If update is true, the previous result that was written by this instance is overwritten. Concurrent calls are not supported (note that tests are run serially, and runners send control messages to the tast process serially as well).