package test

import "k8s.io/kubernetes/cmd/kubeadm/test"

Index

Functions

func AssertError

func AssertError(t *testing.T, err error, expected string)

AssertError checks that the provided error matches the expected output

func AssertFileExists

func AssertFileExists(t *testing.T, dirName string, fileNames ...string)

AssertFileExists is a utility function for kubeadm testing that asserts if the given folder contains the given files.

func AssertFilesCount

func AssertFilesCount(t *testing.T, dirName string, count int)

AssertFilesCount is a utility function for kubeadm testing that asserts if the given folder contains count files.

func GetDefaultInternalConfig

func GetDefaultInternalConfig(t *testing.T) *kubeadmapi.InitConfiguration

GetDefaultInternalConfig returns a defaulted kubeadmapi.InitConfiguration

func SetupEmptyFiles

func SetupEmptyFiles(t *testing.T, tmpdir string, fileNames ...string)

SetupEmptyFiles is a utility function for kubeadm testing that creates one or more empty files (touch)

func SetupPkiDirWithCertificateAuthority

func SetupPkiDirWithCertificateAuthority(t *testing.T, tmpdir string) string

SetupPkiDirWithCertificateAuthority is a utility function for kubeadm testing that creates a CertificateAuthority cert/key pair into /pki subfolder of a given temporary directory. The function returns the path of the created pki.

func SetupTempDir

func SetupTempDir(t *testing.T) string

SetupTempDir is a utility function for kubeadm testing, that creates a temporary directory NB. it is up to the caller to cleanup the folder at the end of the test with defer os.RemoveAll(tmpdir)

Source Files

util.go

Directories

PathSynopsis
cmd/kubeadm/test/cmd
cmd/kubeadm/test/kubeconfig
cmd/kubeadm/test/resources
Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
3 hours ago

Tools for package owners.