Documentation
¶
Index ¶
Constants ¶
const DurationEpsilon = 3 * time.Second
DurationEpsilon is the difference between two times which we still see as equal. This is useful when tests want to check if the requeue is at the correct point in time, while still allowing for a bit of deviation because of host load.
Variables ¶
var DoNotDeleteFinalizerName = "ctf.backbone81/do-not-delete"
DoNotDeleteFinalizerName provides a name for a finalizer which is not used by the reconcilers themselves. This finalizer is used to prevent a resource from being deleted immediately when you want to test situations where you need to inspect the behavior for deletion.
Functions ¶
func GenerateName ¶
GenerateName simulates the behavior of Kubernetes GenerateName for test situations where we need to know the name beforehand.
func MakeBinDirAvailable ¶
func MakeBinDirAvailable() error
MakeBinDirAvailable adds the bin subdirectory of the current working directory to the PATH environment variable. This is helpful when debugging tests, because some IDEs make it hard to extend the PATH environment variable through their project configuration.
func MoveToProjectRoot ¶
func MoveToProjectRoot() error
MoveToProjectRoot changes the current working directory to the root of the project. This is helpful for running tests, which are executed with the working directory set to the directory the test resides in. This makes it difficult to reference files from other directories. MoveToProjectRoot moves up in the directory tree until it finds the go.mod.
func PrependToPath ¶
PrependToPath prepends the given directory to the PATH environment variable.
func RequestFromObject ¶
RequestFromObject constructs a reconcile request for the given object.
func SetupTestEnv ¶
func SetupTestEnv() (*envtest.Environment, client.Client)
SetupTestEnv prepares envtest and a kubernetes client for interacting with the envtest instance. The client is uncached.
Types ¶
This section is empty.