checks

package
v0.0.0-...-5f823d9 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRequiredArg

func IsRequiredArg(err error) bool

IsRequiredArg returns a boolean indicating if the given err is a RequiredArgError

Types

type AptInstalled

type AptInstalled struct {
	Package string
}

AptInstalled checks if an apt/deb package is installed on the system

Type:

  • apt-installed

Support Platforms:

  • Linux

Arguments:

package (required): A string value that represents the deb package

func (AptInstalled) Check

func (ai AptInstalled) Check() error

Check if a deb package is installed on the system

type ArgFunc

type ArgFunc func(args Args) (Checker, error)

ArgFunc is a function which takes the raw yaml test args and converts them into a Checker

type Args

type Args map[string]interface{}

Args is a convenience type to express the "args" key in the test yaml

type Checker

type Checker interface {
	Check() error
}

Checker is any struct that performs a system check

func AptInstalledFromArgs

func AptInstalledFromArgs(args Args) (Checker, error)

AptInstalledFromArgs will populate the AptInstalled struct with the args given in the tests YAML config

func CompileGccFromArgs

func CompileGccFromArgs(args Args) (Checker, error)

CompileGccFromArgs will populate the CompileGcc with the args given in the tests YAML config

func FileCheckerFromArgs

func FileCheckerFromArgs(args Args) (Checker, error)

FromArgs will populate the FileChecker with the args given in the tests YAML config

func GemInstalledFromArgs

func GemInstalledFromArgs(args Args) (Checker, error)

FromArgs will populate the GemInstalled struct with the args given in the tests YAML config

func LoadCheck

func LoadCheck(name string, args Args) (Checker, error)

LoadCheck will return the appropriate Checker based on the test type name. As documented on the various checkers

func PipInstalledFromArgs

func PipInstalledFromArgs(args Args) (Checker, error)

FromArgs will populate the PipInstalled struct with the args given in the tests YAML config

func RunScriptFromArgs

func RunScriptFromArgs(args Args) (Checker, error)

RunScriptFromArgs will populate the RunScript with the args given in the tests YAML config

func UlimitCheckerFromArgs

func UlimitCheckerFromArgs(args Args) (Checker, error)

FromArgs will populate the UlimitChecker with the args given in the tests YAML config

func YumInstalledFromArgs

func YumInstalledFromArgs(args Args) (Checker, error)

YumInstalledFromArgs will populate the YumInstalled struct with the args given in the tests YAML config

type CompileGcc

type CompileGcc struct {
	Source        string
	Compiler      string
	Cflags        string
	CflagsCommand string `mapstructure:"cflags_command"`
	Run           bool
}

CompileGcc runs gcc compile.

Type:

  • compile-gcc

Support Platforms:

  • Mac
  • Linux
  • Windows

Arguments:

source (required): The source code to compile.
compiler: path to the compiler. Default is 'gcc' from the $PATH
cflags: compiles flags, string, e.g "-lss -lsasl2"
cflags_command: command to get clags, e.g. "net-snmp-config --agent-libs"
run: If true try running the compiled binary

func (CompileGcc) Check

func (cg CompileGcc) Check() error

Check Runs a gcc command and checks the return code

type FileChecker

type FileChecker struct {
	Exists bool
	Name   string
}

FileChecker checks if a file exists or does not

Type:

  • file-exists
  • file-does-not-exist

Supported Platforms:

  • MacOS
  • Linux
  • Windows

Arguments:

  name (required): A string value that points to a path on the filesystem.
  exists: An optional boolean indicating whether the file should exist or not.
			 For file-does-not-exist type tests this is always set to false, for
			 the normal file-exists type tests this value defaults to true, the
			 file should exist, but can be set to false if desired.

Notes:

For Unix systems no `~` expansion is done. So ~/.bashrc is not a valid path,
or at least will not do what you think it will. Additionally, when checking
paths on Windows provide windows style paths (i.e. C:\My\File\Path.txt).

func (FileChecker) Check

func (fc FileChecker) Check() error

Check if a file exists or does not

type GemInstalled

type GemInstalled struct {
	Name string
}

GemInstalled checks if ruby gem is installed on the system

Type:

  • gem-installed

Support Platforms:

  • Linux
  • Windows

Argument:

name (required): A string value that represents the gem name

func (GemInstalled) Check

func (gi GemInstalled) Check() error

Check if a deb package is installed on the system

type PipInstalled

type PipInstalled struct {
	Python       string
	Module       string
	Version      string
	Relationship string
	Statement    string
}

PipInstalled checks if python module is installed on the system And verifies its version.

Type:

  • python-module-version

Supported Platforms:

  • Linux
  • Windows

Argument:

module (required): A string value that represents the python module
version: An optional version number to check
         Leave version blank to just verify module is present
statement: Optional python statement, the result will be passed to print()
           Defaults to module.__version__
relationship: Optional comparison operator for the version provided. Valid
              values are lt, lte, gt, gte, eq. Defaults to gte (greater than or equal to)

func (PipInstalled) Check

func (pmv PipInstalled) Check() error

Check if a python module is installed on the system and verify version if the Version string is set

type RequiredArgError

type RequiredArgError struct {
	RequiredArg  string
	ProvidedArgs Args
}

RequiredArgError is an error which indicates a required arg was not given

func (RequiredArgError) Error

func (rae RequiredArgError) Error() string

type RunScript

type RunScript struct {
	Source      string
	Output      string
	Interpreter string
}

RunScript runs a bash script and optionally checks output.

Type:

  • run-bash-script

Support Platforms:

  • Mac
  • Linux
  • Windows

Arguments:

source (required): The source code of the script.
output: string to which the output of the script will be compared to determine a successful run. If omitted, only checks that the script exits with returncode 0.
interpreter: path to bash. Default is '/bin/bash'.

Notes:

func (RunScript) Check

func (rs RunScript) Check() error

Check Runs a script and checks the return code or output

type UlimitChecker

type UlimitChecker struct {
	Item        string
	Value       int
	IsHard      bool
	GreaterThan bool `mapstructure:"greater_than"`
	Type        string
}

UlimitChecker checks if current process resource limits are above a given minimum

Type:

  • ulimit

Supported Platforms:

  • MacOS
  • Linux

Arguments:

  • item (required): A string value representing the type of limit to check
  • value (required): Numerical value representing the value to be tested
  • type: "hard" or "soft" with a default of "hard"
  • greater_than: If provided will verify that the limit is greater than or equal to value instead of strictly equal to

Notes:

func (UlimitChecker) Check

func (uc UlimitChecker) Check() error

Check if a ulimit is high enough

type YumInstalled

type YumInstalled struct {
	Packages []string
}

YumInstalled checks if an rpm package is installed on the system

Type:

  • yum-installed

Support Platforms:

  • Linux

Arguments:

package (required): A string value that represents the rpm package

func (YumInstalled) Check

func (yi YumInstalled) Check() error

Check if an rpm is installed on the system

Jump to

Keyboard shortcuts

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