stresser

package
v0.0.0-...-138354b Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2015 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAttributes = map[string]interface{}{
	"name":                            []string{"name"},
	"role":                            []string{"role"},
	"roles":                           []string{"roles"},
	"environment":                     []string{"chef_environment"},
	"ipaddress":                       []string{"ipaddress"},
	"ec2.public_ipv4":                 []string{"ec2", "public_ipv4"},
	"ec2.local_ipv4":                  []string{"ec2", "local_ipv4"},
	"ec2.placement_availability_zone": []string{"ec2", "placement_availability_zone"},
	"cloud.private_ips":               []string{"cloud", "private_ips"},
	"cloud.public_ips":                []string{"cloud", "public_ips"},
	"cloud.provider":                  []string{"cloud", "provider"},
	"cloud.public_ip":                 []string{"cloud", "public_ip"},
	"cloud.private_ip":                []string{"cloud", "private_ip"},
}

DefaultAttributes is the default set of attributes to pull from the ChefServer for stress testing. This is just a random assortment of node data.

View Source
var DefaultQueries = []string{"roles:*", "name:*"}

DefaultQueries is a default set of queries to run when stress testing.

Functions

This section is empty.

Types

type ChefConfig

type ChefConfig struct {
	PemFile    string
	ChefServer string
	ClientName string
}

ChefConfig is a struct that contains all the items we need to build a *chef.Client.

type StressResult

type StressResult struct {
	ID         int
	Duration   int64
	Err        error
	NumResults int
	Query      string
}

StressResult is a struct that contains the information for a single Search result (Partial or Full).

The ID filed is the auto-incremented ID of which goroutine this was, this allows you to know whether it was an earlier or later goroutine.

type StressResults

type StressResults struct {
	Fastest *StressResult
	Slowest *StressResult
	Average float64
	Results []*StressResult
}

StressResults is the entire resultset for the stressin gof the Chef server. The field names should be pretty self-explanatory.

func PartialSearch

func PartialSearch(config ChefConfig, concurrency int, queries []string, attributes map[string]interface{}) *StressResults

PartialSearch is a function to execute a partial search using the attributes param. The provided concurrency is how many concurrent queries you want. The queries parameter is a slice of possible queries to run. The attributes parameter is are the attributes for the partial search. Each entry in the map is usually a []string. This function does not loop and only does one invocation of n queries.

If multiple queries are provided a random query is used per invocation.

func Search(config ChefConfig, concurrency int, queries []string) *StressResults

Search is a function to execute a full search where all node attributes are returned. The provided concurrency param is how many concurrent queries you want. The queries parameter is a slice of possible queries to run. This function does not loop and only does one invocation of n queries.

If multiple queries are provided a random query is used per invocation.

type Stresser

type Stresser struct {
	Queries    []string
	Attributes map[string]interface{}
	Config     ChefConfig
}

Stresser is a struct for easily running different stress tests against the Chef server. The Queries field is a slice of queries to run against the Chef server, with one being picked randomly for each search. The Attributes field is the field required if you want to use PartialSearch. Each item in the map is usually a []string.

func (*Stresser) PartialSearch

func (s *Stresser) PartialSearch(concurrency int) *StressResults

PartialSearch is a function to execute a partial search using the Attributes field. The provided parameter is how many concurrent queries you want. This function wraps PartialSearch().

func (*Stresser) Search

func (s *Stresser) Search(concurrency int) *StressResults

Search is a function to execute a full search. The provided parameter is how many concurrent queries you want. This function wraps Search().

Jump to

Keyboard shortcuts

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