cmd

package
v0.18.6 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ExitCodeExecutionError error during execution
	ExitCodeExecutionError int = 0x80 + iota
	// ExitCodeJSONParseError error parsing JSON config
	ExitCodeJSONParseError
	// ExitCodeJSONValidateError validating JSON config failed
	ExitCodeJSONValidateError
	// ExitCodeLogFormatError error resolving log format
	ExitCodeLogFormatError
	// ExitCodeObjectDefError error reading object definitions
	ExitCodeObjectDefError
	// ExitCodeProfilingError error starting profiling
	ExitCodeProfilingError
	// ExitCodeMetricError error starting prometheus
	ExitCodeMetricError
	// ExitCodeOsError error when interacting with host OS
	ExitCodeOsError
	// ExitCodeSummaryTypeError incorrect summary type
	ExitCodeSummaryTypeError
	// ExitCodeConnectionError error during test connection
	ExitCodeConnectionError
	// ExitCodeAppStructure error during get app structure
	ExitCodeAppStructure
	// ExitCodeMissingParameter
	ExitCodeMissingParameter
	// ExitCodeForceQuit
	ExitCodeForceQuit
	// ExitCodeMaxErrorsReached
	ExitCodeMaxErrorsReached
)

Unfortunately go doesn't support negative exit codes, so same logic as sdkexerciser can't be used (positive for error count and negative for other errors) as exit codes seems to be limited to 8 bits (even though defined as an int), we will use setting the highest bit as a representation of negative values, i.e. errors not corresponding to simulation errors. Exit codes with highest bit set to 0 corresponds to error count from simulation, where 0x7F will represent >127 errors.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "gopherciser",
	Short: "User simulation tool",
	Long:  `Tool to simulate user actions in a sense application`,
}

RootCmd represents the base command when called without any sub-commands

Functions

func AddAllSharedParameters

func AddAllSharedParameters(cmd *cobra.Command)

AddAllSharedParameters add shared parameters to command

func AddConfigParameter

func AddConfigParameter(cmd *cobra.Command)

AddConfigParameter add config file parameter to command

func AddLoggingParameters added in v0.5.2

func AddLoggingParameters(cmd *cobra.Command)

AddLoggingParameters add logging parameters to command

func AddOverrideParameters added in v0.6.15

func AddOverrideParameters(cmd *cobra.Command)

AddOverrideParameters to command

func ConfigOverrideLogSettings added in v0.5.2

func ConfigOverrideLogSettings(cfg *config.Config) error

ConfigOverrideLogSettings override log settings with parameters

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func HasPipe added in v0.11.4

func HasPipe() (bool, error)

HasPipe discovers if process has a chardevice attached

func IsLaunchedByDebugger added in v0.11.4

func IsLaunchedByDebugger() bool

IsLaunchedByDebugger discovers if pararent process is deleve

func MultiErrorCode added in v0.13.3

func MultiErrorCode(err *multierror.Error) int

MultiErrorCode error count truncated to 0x7F

func PrintOverrides added in v0.6.15

func PrintOverrides(overrides []string)

PrintOverrides to script

func ReadObjectDefinitions

func ReadObjectDefinitions() error

func TruncatedMultiErrorMessage added in v0.13.3

func TruncatedMultiErrorMessage(err *multierror.Error) string

TruncatedMultiErrorMessage to first message + error count

Types

type JSONParseError

type JSONParseError string

JSONParseError error during unmarshal of JSON file

func (JSONParseError) Error

func (err JSONParseError) Error() string

Error implementation of Error interface

type JSONValidateError

type JSONValidateError string

JSONValidateError error during validation of JSON file

func (JSONValidateError) Error

func (err JSONValidateError) Error() string

Error implementation of Error interface

type LogFormatError

type LogFormatError string

LogFormatError error resolving log format

func (LogFormatError) Error

func (err LogFormatError) Error() string

Error implementation of Error interface

type MaxErrorsReachedError added in v0.13.3

type MaxErrorsReachedError struct {
	SubError error
	Msg      string
}

MaxErrorsReachedError max errors limit was reached during execution

func (MaxErrorsReachedError) Error added in v0.13.3

func (err MaxErrorsReachedError) Error() string

Error max error limit reached

type MetricError

type MetricError string

MetricError error starting profiling

func (MetricError) Error

func (err MetricError) Error() string

Error implementation of Error interface

type MetricLevel added in v0.17.5

type MetricLevel int

MetricLevel indicates what level if any to expose metrics, default is no metrics

const (
	MetricOff MetricLevel = iota
	MetricPull
	MetricPush
	MetricPushAPI
)

MetricsLevel enum

func (MetricLevel) GetEnumMap added in v0.17.5

func (value MetricLevel) GetEnumMap() *enummap.EnumMap

type ObjectDefError

type ObjectDefError string

ObjectDefError error reading object definitions

func (ObjectDefError) Error

func (err ObjectDefError) Error() string

Error implementation of Error interface

type OsError

type OsError string

OsError error when interacting with host OS

func (OsError) Error

func (err OsError) Error() string

Error implementation of Error interface

type ProfilingError

type ProfilingError string

ProfilingError error starting profiling

func (ProfilingError) Error

func (err ProfilingError) Error() string

Error implementation of Error interface

type SummaryTypeError

type SummaryTypeError string

SummaryTypeError incorrect summary type

func (SummaryTypeError) Error

func (err SummaryTypeError) Error() string

Error incorrect summary type

Jump to

Keyboard shortcuts

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