e2e

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InputFilePath = "/file.yaml"
)

Variables

This section is empty.

Functions

func AppendFromFileCommonArgs

func AppendFromFileCommonArgs(args ...string) []string

func CommonExcludedFileArgs

func CommonExcludedFileArgs() []string

func MustMarshal

func MustMarshal(t *testing.T, d any) []byte

func MustMarshalToMultiYAML

func MustMarshalToMultiYAML(t *testing.T, data ...any) []byte

func TimeBubbleStartTime

func TimeBubbleStartTime() time.Time

TimeBubbleStartTime returns the time bubble start time. It can be used in test data definitions.

Types

type NewRootCmdFunc

type NewRootCmdFunc func() (rootCmd *cobra.Command, out *bytes.Buffer)

NewRootCmdFunc returns the root command for the cli and an output buffer which returns the output after command execution

type Test

type Test[Response, RawObject any] struct {
	Name string

	NewRootCmd NewRootCmdFunc
	CmdArgs    []string

	AssertExhaustiveArgs     bool
	AssertExhaustiveExcludes []string

	// output format tests
	WantObject      RawObject     // for rawyaml / rawjson printer
	WantProtoObject proto.Message // for yaml / json printer
	WantTable       *string       // for table printer
	WantWideTable   *string       // for wide table printer
	WantMarkdown    *string       // for markdown printer
	WantTemplate    *string       // for template printer
	WantDefault     *string       // for default printer
	Template        *string       // for template printer

	WantErr error
}

Test can be used to run a cmd test on different output formats. Tests are executed in a time bubble using syntest. At least one "Want" must be specified, otherwise TestCmd will fail.

func (*Test[Response, RawObject]) TestCmd

func (c *Test[Response, RawObject]) TestCmd(t *testing.T)

Jump to

Keyboard shortcuts

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