testutil

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package testutil provides shared testing utilities, fixtures, and mocks for the holodeck test suite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns a pointer to the given bool.

func EnvironmentWithStatus

func EnvironmentWithStatus() *v1alpha1.Environment

EnvironmentWithStatus returns an environment with status properties set.

func FixturePath

func FixturePath(name string) string

FixturePath returns the path to a test fixture file relative to the testdata directory.

func Int32Ptr

func Int32Ptr(i int32) *int32

Int32Ptr returns a pointer to the given int32.

func InvalidEnvironment

func InvalidEnvironment() *v1alpha1.Environment

InvalidEnvironment returns an intentionally invalid environment for testing error handling.

func MustReadFile

func MustReadFile(t testing.TB, path string) string

MustReadFile reads a file and returns its content, failing the test if an error occurs.

func MustWriteFile

func MustWriteFile(t testing.TB, path, content string)

MustWriteFile writes content to a file, failing the test if an error occurs.

func SampleCacheYAML

func SampleCacheYAML() string

SampleCacheYAML returns a YAML string representation of a cached environment with status for testing.

func SampleYAMLEnvironment

func SampleYAMLEnvironment() string

SampleYAMLEnvironment returns a YAML string representation of a valid environment for testing file parsing.

func SetEnv

func SetEnv(t testing.TB, key, value string) func()

SetEnv sets an environment variable and returns a cleanup function that restores the original value.

func StringPtr

func StringPtr(s string) *string

StringPtr returns a pointer to the given string.

func TempDir

func TempDir(t testing.TB) (string, func())

TempDir creates a temporary directory and returns its path along with a cleanup function. The cleanup function removes the directory and all contents.

func TempFile

func TempFile(t testing.TB, name, content string) (string, func())

TempFile creates a temporary file with the given content and returns its path along with a cleanup function.

func UnsetEnv

func UnsetEnv(t testing.TB, key string) func()

UnsetEnv unsets an environment variable and returns a cleanup function that restores the original value.

func ValidAWSEnvironment

func ValidAWSEnvironment() *v1alpha1.Environment

ValidAWSEnvironment returns a minimal valid AWS environment configuration for testing purposes.

func ValidEnvironmentWithContainerRuntime

func ValidEnvironmentWithContainerRuntime() *v1alpha1.Environment

ValidEnvironmentWithContainerRuntime returns an environment with container runtime configuration for testing.

func ValidEnvironmentWithContainerToolkit

func ValidEnvironmentWithContainerToolkit() *v1alpha1.Environment

ValidEnvironmentWithContainerToolkit returns an environment with container toolkit configuration for testing.

func ValidEnvironmentWithKubernetes

func ValidEnvironmentWithKubernetes() *v1alpha1.Environment

ValidEnvironmentWithKubernetes returns an environment with Kubernetes configuration for testing.

func ValidEnvironmentWithNVDriver

func ValidEnvironmentWithNVDriver() *v1alpha1.Environment

ValidEnvironmentWithNVDriver returns an environment with NVIDIA driver configuration for testing.

func ValidSSHEnvironment

func ValidSSHEnvironment() *v1alpha1.Environment

ValidSSHEnvironment returns a minimal valid SSH environment configuration for testing purposes.

Types

This section is empty.

Directories

Path Synopsis
Package mocks provides mock implementations for external dependencies used in testing.
Package mocks provides mock implementations for external dependencies used in testing.

Jump to

Keyboard shortcuts

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