config

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CloudRunMode is the string that will be used to override the run mode of execution to cloud
	CloudRunMode RunMode = "cloud"
	// DefaultRunMode is the default execution run mode
	DefaultRunMode RunMode = "default"
	// DefaultLogMarkerHeaderName is the default log marker header name
	DefaultLogMarkerHeaderName string = "X-CRS-Test"
)

Variables

This section is empty.

Functions

func NewConfigFromEnv

func NewConfigFromEnv() error

NewConfigFromEnv reads configuration information from environment variables that start with `FTW_`

func NewConfigFromFile

func NewConfigFromFile(cfgFile string) error

NewConfigFromFile reads configuration information from the config file if it exists, or uses `.ftw.yaml` as default file

func NewConfigFromString

func NewConfigFromString(conf string) error

NewConfigFromString initializes the configuration from a yaml formatted string. Useful for testing.

func Reset

func Reset()

Reset configuration to uninitialized state

Types

type FTWConfiguration

type FTWConfiguration struct {
	LogFile             string          `koanf:"logfile"`
	TestOverride        FTWTestOverride `koanf:"testoverride"`
	LogMarkerHeaderName string          `koanf:"logmarkerheadername"`
	RunMode             RunMode         `koanf:"mode"`
}

FTWConfiguration FTW global Configuration

var FTWConfig *FTWConfiguration

FTWConfig is being exported to be used across the app

type FTWRegexp added in v0.4.1

type FTWRegexp regexp.Regexp

func (*FTWRegexp) MatchString added in v0.4.1

func (r *FTWRegexp) MatchString(s string) bool

func (*FTWRegexp) UnmarshalText added in v0.4.1

func (r *FTWRegexp) UnmarshalText(b []byte) error

type FTWTestOverride

type FTWTestOverride struct {
	Input     test.Input            `koanf:"input"`
	Ignore    map[*FTWRegexp]string `koanf:"ignore"`
	ForcePass map[*FTWRegexp]string `koanf:"forcepass"`
	ForceFail map[*FTWRegexp]string `koanf:"forcefail"`
}

FTWTestOverride holds four lists:

Input allows you to override input parameters in tests. An example usage is if you want to change the `dest_addr` of all tests to point to an external IP or host.
Ignore is for tests you want to ignore. You should add a comment on why you ignore the test
ForcePass is for tests you want to pass unconditionally. You should add a comment on why you force to pass the test
ForceFail is for tests you want to fail unconditionally. You should add a comment on why you force to fail the test

type RunMode

type RunMode string

RunMode represents the mode of the test run

Jump to

Keyboard shortcuts

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