Documentation ¶
Overview ¶
Package frameworktestutil contains utilities for testing functions written using the framework.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandResultsChecker ¶ added in v0.10.14
type CommandResultsChecker struct { // TestDataDirectory is the directory containing the testdata subdirectories. // CommandResultsChecker will recurse into each test directory and run the Command // if the directory contains both the ConfigInputFilename and at least one // of ExpectedOutputFilname or ExpectedErrorFilename. // Defaults to "testdata" TestDataDirectory string // ConfigInputFilename is the name of the config file provided as the first // argument to the function. Directories without this file will be skipped. // Defaults to "config.yaml" ConfigInputFilename string // InputFilenameGlob matches function inputs // Defaults to "input*.yaml" InputFilenameGlob string // ExpectedOutputFilename is the file with the expected output of the function // Defaults to "expected.yaml". Directories containing neither this file // nor ExpectedErrorFilename will be skipped. ExpectedOutputFilename string // ExpectedErrorFilename is the file containing part of an expected error message // Defaults to "error.yaml". Directories containing neither this file // nor ExpectedOutputFilename will be skipped. ExpectedErrorFilename string // Command provides the function to run. Command func() *cobra.Command // UpdateExpectedFromActual if set to true will write the actual results to the // expected testdata files. This is useful for updating test data. UpdateExpectedFromActual bool // contains filtered or unexported fields }
CommandResultsChecker tests a function by running it with predefined inputs and comparing the outputs to expected results.
type ProcessorResultsChecker ¶ added in v0.10.14
type ProcessorResultsChecker struct { // TestDataDirectory is the directory containing the testdata subdirectories. // CommandResultsChecker will recurse into each test directory and run the Processor // if the directory contains both the InputFilename and at least one // of ExpectedOutputFilename or ExpectedErrorFilename. // Defaults to "testdata" TestDataDirectory string // InputFilename is the name of the file containing the ResourceList input. // Directories without this file will be skipped. // Defaults to "input.yaml" InputFilename string // ExpectedOutputFilename is the file with the expected output of the function // Defaults to "expected.yaml". Directories containing neither this file // nor ExpectedErrorFilename will be skipped. ExpectedOutputFilename string // ExpectedErrorFilename is the file containing part of an expected error message // Defaults to "error.yaml". Directories containing neither this file // nor ExpectedOutputFilename will be skipped. ExpectedErrorFilename string // Processor returns a ResourceListProcessor to run. Processor func() framework.ResourceListProcessor // UpdateExpectedFromActual if set to true will write the actual results to the // expected testdata files. This is useful for updating test data. UpdateExpectedFromActual bool // contains filtered or unexported fields }
ProcessorResultsChecker tests a function by running it with predefined inputs and comparing the outputs to expected results.
Click to show internal directories.
Click to hide internal directories.