testutil

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanUpTempDir

func CleanUpTempDir(t *testing.T)

CleanUpTempDir removes temporary files and directories created during tests

func CleanupWeaverPreservingDownloads added in v0.5.0

func CleanupWeaverPreservingDownloads()

CleanupWeaverPreservingDownloads removes all weaver directories except the shared downloads folder This preserves downloaded files with valid checksums to speed up subsequent test runs

func CreateTestTarGz added in v0.5.0

func CreateTestTarGz(outputPath string, files map[string]string) (checksum string, fileChecksums map[string]string, err error)

CreateTestTarGz creates a .tar.gz file at outputPath containing the specified files. If files is nil, it creates a default set of files. It returns the SHA256 checksum of the created archive and a map of individual file checksums.

func FileWithPrefixExists added in v0.5.0

func FileWithPrefixExists(t *testing.T, directory string, prefix string) bool

func InstallCrioRegistriesConf

func InstallCrioRegistriesConf() error

InstallCrioRegistriesConf installs the custom registries.conf with registry mirror configuration This enables CRI-O to use a local registry mirror for caching Kubernetes images This is typically called during integration test setup when cache proxy is available

func PrepareSubCmdForTest

func PrepareSubCmdForTest(sub *cobra.Command) *cobra.Command

PrepareSubCmdForTest creates a root command with the given subcommand added. Use this from tests in other packages to avoid duplicating the helper.

func RequireChattrSupport added in v0.5.0

func RequireChattrSupport(t *testing.T)

RequireChattrSupport checks if chattr immutable attribute is supported Skips the test if chattr is not available or doesn't work (e.g., in containers)

func Reset

func Reset(t *testing.T)

Reset performs a complete cleanup of the Kubernetes environment

func ResetTestEnvironment added in v0.5.0

func ResetTestEnvironment(t *testing.T)

ResetTestEnvironment creates a clean test environment and registers cleanup

func Sudo

func Sudo(cmd *exec.Cmd) *exec.Cmd

Sudo prepends Sudo to the command if not running as root

Types

This section is empty.

Jump to

Keyboard shortcuts

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