testenv

package
v0.0.0-...-ad2992c Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package testenv provides functions and data structures for constructing and manipulating a temporary Warewulf environment for use during automated testing.

The testenv package should only be used in tests.

Index

Constants

View Source
const Bindir = "bin"
View Source
const Datadir = "share"
View Source
const Firewallddir = "usr/lib/firewalld/services"
View Source
const Localstatedir = "var/local"
View Source
const Srvdir = "srv"
View Source
const Sysconfdir = "etc"
View Source
const Systemddir = "usr/lib/systemd/system"
View Source
const Tftpdir = "srv/tftp"
View Source
const WWChrootdir = "var/local/warewulf/chroots"
View Source
const WWClientdir = "warewulf"
View Source
const WWOverlaydir = "var/local/warewulf/overlays"
View Source
const WWProvisiondir = "srv/warewulf"

Variables

This section is empty.

Functions

This section is empty.

Types

type TestEnv

type TestEnv struct {
	BaseDir string
}

func New

func New(t *testing.T) (env *TestEnv)

New creates a test environment in a temporary directory and configures Warewulf to use it.

Caller is responsible to delete env.BaseDir by calling env.RemoveAll. Note that this does not restore Warewulf to its previous state.

Asserts no errors occur.

func (*TestEnv) GetPath

func (env *TestEnv) GetPath(fileName string) string

GetPath returns the absolute path name for fileName specified relative to the test environment.

func (*TestEnv) MkdirAll

func (env *TestEnv) MkdirAll(t *testing.T, dirName string)

MkdirAll creates dirName and any intermediate directories relative to the test environment.

Asserts no errors occur.

func (*TestEnv) ReadFile

func (env *TestEnv) ReadFile(t *testing.T, fileName string) string

ReadFile returns the content of fileName as converted to a string.

Asserts no errors occur.

func (*TestEnv) RemoveAll

func (env *TestEnv) RemoveAll(t *testing.T)

RemoveAll deletes the temporary directory, and all its contents, for the test environment.

Asserts no errors occur.

func (*TestEnv) WriteFile

func (env *TestEnv) WriteFile(t *testing.T, fileName string, content string)

WriteFile writes content to fileName, creating any necessary intermediate directories relative to the test environment.

Asserts no errors occur.

Jump to

Keyboard shortcuts

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