run

package
v0.0.0-...-bde8f89 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunCmd = &cobra.Command{
	Use:   "run",
	Short: "Run a test",
	Long:  ``,

	Run: func(cmd *cobra.Command, args []string) {
		fileName, err := cmd.Flags().GetString("filename")
		if err != nil {
			log.Fatalf("Error declaring config file/path: %v", err)
		}
		Config, err = LoadConfig(fileName)
		if err != nil {
			log.Fatalf("Error parsing/unmarshalling the config file: %v", err)
		}
		testRun(Config)
	},
}

Functions

This section is empty.

Types

type Assert

type Assert struct {
	Contains []string `yaml:"contains,omitempty"`
}

type AssertJsonPath

type AssertJsonPath struct {
	JsonPath      string `yaml:"jsonpath,omitempty"`
	Validate      bool   `yaml:"validate,omitempty"`
	ExpectedValue string `yaml:"expected-value,omitempty"`
}

type AssertXPath

type AssertXPath struct {
	XPath string `yaml:"xpath,omitempty"`
}

type Execution

type Execution struct {
	Scenario          string         `yaml:"scenario"`
	Executor          string         `yaml:"executor"`
	Concurrency       int            `yaml:"concurrency"`
	HoldFor           int            `yaml:"holdfor"`
	RampUp            int            `yaml:"rampup"`
	Locations         map[string]int `yaml:"locations"`
	LocationsWeighted bool           `yaml:"locations-weighted"`
	Provisioning      string         `yaml:"provisioning"`
}

func (*Execution) GetExecutionDetails

func (e *Execution) GetExecutionDetails() (vu, holdFor int, scenario, provisioning string)

func (*Execution) GetRampUp

func (e *Execution) GetRampUp() (rampUp int, increment []int, err error)

type ExecutionConfig

type ExecutionConfig struct {
	Execution []Execution          `yaml:"execution"`
	Scenarios map[string]Scenarios `yaml:"scenarios"`
}

Define the structs

var Config ExecutionConfig

func LoadConfig

func LoadConfig(filename string) (ExecutionConfig, error)

func (*ExecutionConfig) GetRequestsForScenario

func (c *ExecutionConfig) GetRequestsForScenario(name string) ([]Request, bool)

GetRequestsForScenario returns the requests associated with the given scenario name

func (*ExecutionConfig) GetScenarios

func (c *ExecutionConfig) GetScenarios() []string

type ExtractJsonPath

type ExtractJsonPath struct {
}

type ExtractXPath

type ExtractXPath struct {
}

type Request

type Request struct {
	URL             string              `yaml:"url"`
	Method          string              `yaml:"method"`
	Label           string              `yaml:"label"`
	Body            string              `yaml:"body,omitempty"`
	BodyFile        string              `yaml:"body-file,omitempty"`
	UploadFiles     []UploadFile        `yaml:"upload-files,omitempty"`
	Headers         map[string]string   `yaml:"headers,omitempty"`
	ThinkTime       int                 `yaml:"think-time,omitempty"`
	Timeout         int                 `yaml:"timeout,omitempty"`
	ContentEncoding string              `yaml:"content-encoding,omitempty"`
	FollowRedirects bool                `yaml:"follow-redirects,omitempty"`
	RandomSourceIP  bool                `yaml:"random-source-ip,omitempty"`
	Assert          map[string][]string `yaml:"assert,omitempty"`
	AssertJsonPath  []AssertJsonPath    `yaml:"assert-jsonpath,omitempty"`
	AssertXPath     []AssertXPath       `yaml:"assert-xpath,omitempty"`
	ExtractJsonPath ExtractJsonPath     `yaml:"extract-jsonpath,omitempty"`
	ExtractXPath    ExtractXPath        `yaml:"extract-xpath,omitempty"`
}

type Scenarios

type Scenarios struct {
	Requests []Request `yaml:"requests"`
}

type UploadFile

type UploadFile struct {
	Param    string `yaml:"param"`
	Path     string `yaml:"path"`
	MimeType string `yaml:"mime-type,omitempty"`
}

Jump to

Keyboard shortcuts

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