plugin_helper

package module
v0.0.0-...-91256e5 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 14 Imported by: 2

README

Plugin Helper

A library made to trivialize making your containerized app into a Sonobuoy plugin.

In Scope

  • Submits results to the Sonobuoy aggregator
    • Can submit your own generated data (junit tests or general data)
    • Can write test results files for you
  • Submits progress updates to the aggregator
    • Defaults to submitting a progress update for each test added

Not In Scope

  • This is not trying to be a generalized test runner or test framework. If you want that, there are lots of options which then can utilize this tool to submit the pre-generated data to the aggregator and even easily send updates as tests progress.

Documentation

Index

Constants

View Source
const (
	SonobuoyResultsDirKey = "SONOBUOY_RESULTS_DIR"
	DoneFileName          = "done"
	DefaultTarballName    = "results.tar.gz"
)
View Source
const (
	SonobuoyProgressPortEnvKey = "SONOBUOY_PROGRESS_PORT"
)

Variables

This section is empty.

Functions

func Done

func Done() error

Done will tar up the results directory, write the done file which instructs Sonobuoy to submit results to the aggregator.

func GetResultsDir

func GetResultsDir() string

func WriteDone

func WriteDone(resultsPath string) error

Types

type ProgressReporter

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

func NewProgressReporter

func NewProgressReporter(total int64) ProgressReporter

NewProgressReporter will initialize a progress reporter which expects the given number of tests. If it fails to generate a reporter, it will return the empty reporter which executes noops.

func (*ProgressReporter) SendMessage

func (r *ProgressReporter) SendMessage(msg string) error

SendMessage should be used for sending arbitrary messages. This method waits for a response, use SendMessageAsync for an asynchronous call.

func (*ProgressReporter) SendMessageAsync

func (r *ProgressReporter) SendMessageAsync(msg string)

func (*ProgressReporter) StartTest

func (r *ProgressReporter) StartTest(name string)

StartTest will send a progress update indicating the start of the given test.

func (*ProgressReporter) StopTest

func (r *ProgressReporter) StopTest(name string, failed, skipped bool, err error)

StopTest will increase the tests counts and send an update message accordingly.

type SonobuoyResultsWriter

type SonobuoyResultsWriter struct {
	ResultsDir string
	OutputFile string
	Data       sono.Item
}

SonobuoyResultsWriter will keep track of result items in memory and will write them to the .ResultsDir/.OutputFile. If the ResultsDir is empty, the data will be dumped to stdout instead.

func NewDefaultSonobuoyResultsWriter

func NewDefaultSonobuoyResultsWriter() SonobuoyResultsWriter

func NewSonobuoyResultsWriter

func NewSonobuoyResultsWriter(resultsDir, outputFile string) SonobuoyResultsWriter

func (*SonobuoyResultsWriter) AddTest

func (w *SonobuoyResultsWriter) AddTest(
	testName string,
	result string,
	err error,
	output string,
)

func (*SonobuoyResultsWriter) Done

func (w *SonobuoyResultsWriter) Done(writeDoneFile bool) error

Jump to

Keyboard shortcuts

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