test

package
v1.16.4 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: GPL-2.0, GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadTestdata added in v1.16.1

func ReadTestdata(t *testing.T, filename string) []byte

ReadTestdata reads the content of a testdata file.

func TestdataPath added in v1.16.1

func TestdataPath(t *testing.T, filename string) string

TestdataPath returns the path to a testdata file.

Types

type Agent added in v1.16.0

type Agent struct {
	*Helper
	*digraph.DAG
	*agent.Agent
	// contains filtered or unexported fields
}

func (*Agent) Abort added in v1.16.0

func (a *Agent) Abort()

func (*Agent) RunCancel added in v1.16.0

func (a *Agent) RunCancel(t *testing.T)

func (*Agent) RunCheckErr added in v1.16.0

func (a *Agent) RunCheckErr(t *testing.T, expectedErr string)

func (*Agent) RunError added in v1.16.0

func (a *Agent) RunError(t *testing.T)

func (*Agent) RunSuccess added in v1.16.0

func (a *Agent) RunSuccess(t *testing.T)

type AgentOption added in v1.16.0

type AgentOption func(*Agent)

func WithAgentOptions added in v1.16.0

func WithAgentOptions(options agent.Options) AgentOption

type CmdTest added in v1.16.4

type CmdTest struct {
	Name        string   // Name of the test.
	Args        []string // Arguments to pass to the command.
	ExpectedOut []string // Expected output to be present in the standard output / error.
}

CmdTest is a helper struct to test commands.

type CmdTestHelper added in v1.16.4

type CmdTestHelper struct {
	Helper
}

CmdTestHelper is a helper struct to test commands.

func SetupCommand added in v1.16.4

func SetupCommand(t *testing.T) CmdTestHelper

func (CmdTestHelper) RunCommand added in v1.16.4

func (th CmdTestHelper) RunCommand(t *testing.T, cmd *cobra.Command, testCase CmdTest)

type Contains added in v1.16.3

type Contains string

type DAG added in v1.16.0

type DAG struct {
	*Helper
	*digraph.DAG
}

func (*DAG) Agent added in v1.16.0

func (d *DAG) Agent(opts ...AgentOption) *Agent

func (*DAG) AssertCurrentStatus added in v1.16.0

func (d *DAG) AssertCurrentStatus(t *testing.T, expected scheduler.Status)

func (*DAG) AssertHistoryCount added in v1.16.0

func (d *DAG) AssertHistoryCount(t *testing.T, expected int)

func (*DAG) AssertLatestStatus added in v1.16.0

func (d *DAG) AssertLatestStatus(t *testing.T, expected scheduler.Status)

func (*DAG) AssertOutputs added in v1.16.1

func (d *DAG) AssertOutputs(t *testing.T, outputs map[string]any)

AssertOutputs checks the given outputs against the actual outputs of the DAG Note that this function does not respect dependencies between nodes making the outputs with the same key indeterministic

type Helper added in v1.16.0

type Helper struct {
	Context       context.Context
	Cancel        context.CancelFunc
	Config        *config.Config
	LoggingOutput *SyncBuffer
	Client        client.Client
	HistoryStore  persistence.HistoryStore
	DAGStore      persistence.DAGStore
	// contains filtered or unexported fields
}

Helper provides test utilities and configuration

func Setup

func Setup(t *testing.T, opts ...TestHelperOption) Helper

Setup creates a new Helper instance for testing

func (Helper) Cleanup added in v1.16.0

func (h Helper) Cleanup()

Cleanup removes temporary test directories

func (Helper) DAG added in v1.16.1

func (h Helper) DAG(t *testing.T, name string) DAG

DAG loads a test DAG from the testdata directory

func (Helper) DAGExpectError added in v1.16.1

func (h Helper) DAGExpectError(t *testing.T, name string, expectedErr string)

type NotEmpty added in v1.16.2

type NotEmpty struct{}

type SyncBuffer added in v1.16.0

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

SyncBuffer provides thread-safe buffer operations

func (*SyncBuffer) String added in v1.16.0

func (b *SyncBuffer) String() string

func (*SyncBuffer) Write added in v1.16.0

func (b *SyncBuffer) Write(p []byte) (n int, err error)

type TestHelperOption added in v1.16.0

type TestHelperOption func(*TestOptions)

TestHelperOption defines functional options for Helper

func WithCaptureLoggingOutput added in v1.16.0

func WithCaptureLoggingOutput() TestHelperOption

WithCaptureLoggingOutput creates a logging capture option

func WithDAGsDir added in v1.16.3

func WithDAGsDir(dir string) TestHelperOption

type TestOptions added in v1.16.1

type TestOptions struct {
	CaptureLoggingOutput bool // CaptureLoggingOutput enables capturing of logging output
	DAGsDir              string
}

Jump to

Keyboard shortcuts

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