output

package
v1.10.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 11 Imported by: 35

Documentation

Index

Constants

View Source
const TypeError = "error"
View Source
const TypeLogEvent = "event"
View Source
const TypeLogLine = "line"
View Source
const TypeResult = "result"

Variables

This section is empty.

Functions

func ParseRunnerOutput

func ParseRunnerOutput(b []byte) (*testkube.ExecutionResult, error)

ParseRunnerOutput goes over the raw logs in b and parses possible runner output The input is a json stream of the form {"type": "line", "message": "runner execution started ------------", "time": "..."} {"type": "line", "message": "GET /results", "time": "..."} {"type": "result", "result": {"id": "2323", "output": "-----"}, "time": "..."}

func PrintError

func PrintError(w io.Writer, err error)

PrintError - prints error as output json

func PrintEvent

func PrintEvent(message string, obj ...interface{})

PrintEvent - prints event as output json

func PrintLog

func PrintLog(message string)

PrintLog - prints log line as output json

func PrintResult

func PrintResult(result testkube.ExecutionResult)

PrintResult - prints result as output json

Types

type JSONWrapWriter

type JSONWrapWriter struct {
	// contains filtered or unexported fields
}

JSONWrapWriter wraps bytes stream into json Output of type line

func NewJSONWrapWriter

func NewJSONWrapWriter(writer io.Writer, envMngr env.Interface) *JSONWrapWriter

NewJSONWrapWriter returns new NewJSONWrapWriter instance

func (*JSONWrapWriter) Write

func (w *JSONWrapWriter) Write(p []byte) (int, error)

Write io.Writer method implementation

type Output

type Output testkube.ExecutorOutput

Output generic json based output data structure

func GetLogEntry

func GetLogEntry(b []byte) (out Output, err error)

func NewOutputError

func NewOutputError(err error) Output

NewOutputError returns new Output struct of type error

func NewOutputEvent

func NewOutputEvent(message string) Output

NewOutputEvent returns new Output struct of type event

func NewOutputLine

func NewOutputLine(content []byte) Output

NewOutputLine returns new Output struct of type line

func NewOutputResult

func NewOutputResult(result testkube.ExecutionResult) Output

NewOutputResult returns new Output struct of type result - should be last line in stream as it'll stop listening

func (Output) String

func (out Output) String() string

String

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL