Documentation ¶
Index ¶
- Constants
- Variables
- func CopyFile(source, destination string, mode os.FileMode) error
- func CreateTempDir() (string, error)
- func Download(url, path string) error
- func GetExtras(tarball, path string, extras []string, depth int) error
- func IOToFile(r io.Reader, path string) error
- func IsRepo(version string) bool
- func Percent(a, b int64) float64
- func RecursiveCopy(src, dst string) error
- func ToMiB(i int64) float64
- type Binary
- type Build
- type BuildStep
- type CIConfig
- type Comparison
- type Config
- type Executor
- type GitServer
- type GitServerConfig
- type PromConfig
- type Releases
- type RepoDescription
- type Repositories
- type Result
- type Server
- type Tool
Constants ¶
const ( Memory = "memory" Time = "time" )
Variables ¶
var ( // ErrReferenceNotFound means that the provided reference is not found ErrReferenceNotFound = errors.NewKind("Reference %s not found") // ErrInvalidVersion means that the provided version is malformed ErrInvalidVersion = errors.NewKind("Version %s is invalid") )
var ( ErrVersionNotFound = errors.NewKind("Version '%s' not found") ErrAssetNotFound = errors.NewKind( "Asset named '%s' not found in release '%s'") )
var CompareFormat = "%s: %v -> %v (%v), %v\n"
var ErrBinaryNotFound = errors.NewKind("binary not found in release tarball")
ErrBinaryNotFound is returned when the executable is not found in the release tarball.
var ErrExtraFile = errors.NewKind("cannot save extra file %s")
ErrExtraFile is returned when there is a problem saving an extra file.
var ErrNotRun = fmt.Errorf("command still was not executed")
ErrNotRun means that the command was not started
var ErrRusageNotAvailable = fmt.Errorf("rusage information not available")
ErrRusageNotAvailable means that resource usage could not be collected
var ErrTarball = errors.NewKind("cannot unpack tarball %s")
ErrTarball is returned when there is a problem with a tarball.
Functions ¶
func CreateTempDir ¶
CreateTempDir creates a new temporary directory in the default temp dir.
func GetExtras ¶
GetExtras extracts the files from the tarball contained in the extras list to the provided path. It can skip directories with the parameter depth.
func IsRepo ¶
IsRepo returns true if the version provided matches the repository format, for example: remote:master.
func RecursiveCopy ¶
RecursiveCopy copies a directory to a destination path. It creates all needed directories if destination path does not exist.
Types ¶
type Binary ¶
Binary struct contains information and functionality to prepare and use a binary version.
func (*Binary) Download ¶
Download prepares a binary version if it's still not in the binaries directory.
type Build ¶
type Build struct { // Version is the reference that will be built Version string // GoPath is the directory where the temporary path where the tool is built GoPath string // contains filtered or unexported fields }
Build structure holds information and functionality to generate binaries from source code.
type BuildStep ¶
type BuildStep struct { // Dir is the path where this command is executed. Dir string // Command is the executable to run. Command string // Args contains the list of options to use with Command. Args []string // Env contains the list of environment variable to use with Command. Env []string }
BuildStep describes a command used to build a tool.
type CIConfig ¶
type CIConfig struct { Branch string `env:"GIT_BRANCH" default:"" long:"ci-branch" description:"branch env"` Commit string `env:"GIT_COMMIT" default:"" long:"ci-commit" description:"commit env"` }
CIConfig is config that represents CI build metadata, values of CIConfig will be added to metrics as labels
type Comparison ¶
Comparison has the percentages of change between two runs.
type Config ¶
type Config struct { // Versions has the list of releases to test Versions []string // OS holds the operating system OS string // BinaryCache is the path to the binaries cache BinaryCache string `env:"REG_BINARIES" default:"binaries" long:"binaries" description:"Directory to store binaries"` // GitURL is the git repository url to download the tool GitURL string `env:"REG_GITURL" default:"" long:"url" description:"URL to the tool repo"` // Repeat is the number of times each test will be run Repeat int `env:"REG_REPEAT" default:"3" long:"repeat" short:"n" description:"Number of times a test is run"` // ShowRepos when --show-repos is specified ShowRepos bool `long:"show-repos" description:"List available repositories to test"` // GitHubToken specifies the token to use to use GitHub API GitHubToken string `env:"REG_TOKEN" long:"token" short:"t" description:"Token used to connect to the API"` }
Config holds the general configuration for tests
func (*Config) BinaryPath ¶
BinaryPath returns the binary path an specific version.
func (*Config) VersionPath ¶
VersionPath returns the path of the binary cache for an specific version.
type Executor ¶
type Executor struct { Executed bool // contains filtered or unexported fields }
Executor structure holds information and functionality to execute commands and get resource usage.
func NewExecutor ¶
NewExecutor creates a new Executor struct.
type GitServer ¶
type GitServer struct { *Server // contains filtered or unexported fields }
func NewGitServer ¶
func NewGitServer(config GitServerConfig) *GitServer
type GitServerConfig ¶
type GitServerConfig struct { // GitServerPort is the port where the local git server will listen GitServerPort int `env:"REG_GITPORT" default:"9418" long:"gitport" description:"Port for local git server"` // RepositoriesFile RepositoriesFile string `env:"REG_REPOS_FILE" default:"" long:"repos-file" description:"YAML file with the list of repos"` // RepositoriesCache is the path to the downloaded repositories RepositoriesCache string `env:"REG_REPOS" default:"repos" long:"repos" description:"Directory to store repositories"` // Complexity has the max number of complexity of repos to test Complexity int `env:"REG_COMPLEXITY" default:"1" long:"complexity" short:"c" description:"Complexity of the repositories to test"` }
GitServerConfig holds the configuration for GitServer
type PromConfig ¶
type PromConfig struct { Address string `env:"PROM_ADDRESS" default:"" long:"prom-address" description:"prometheus pushgateway address"` Job string `env:"PROM_JOB" default:"" long:"prom-job" description:"prometheus job"` }
PromConfig contains prometheus pushgateway configuration info
type Releases ¶
type Releases struct {
// contains filtered or unexported fields
}
func NewReleases ¶
type RepoDescription ¶
type RepoDescription struct { Name string `json:"name"` URL string `json:"url"` Description string `json:"description"` Complexity int `json:"complexity"` }
RepoDescription holds the information about a single repository
type Repositories ¶
type Repositories struct { Repos []RepoDescription // contains filtered or unexported fields }
Repositories struct has the information about a set of repositories and functionality to download them.
func NewRepositories ¶
func NewRepositories(config GitServerConfig) (*Repositories, error)
NewRepositories creates a new Repositories set. If config.RepositoriesFile is set it will try to load it and use as a load it as the repositories list.
func (*Repositories) Download ¶
func (r *Repositories) Download() error
Download clones all repositories in the list that have equal or lower complexity specified in config.
func (*Repositories) LinksDir ¶
func (r *Repositories) LinksDir() (string, error)
LinksDir returns a path of a temporary directory with repos within the config complexity.
func (*Repositories) Names ¶
func (r *Repositories) Names() []string
Names returns the names of repositories within concurrency level.
func (*Repositories) Path ¶
func (r *Repositories) Path() string
Path returns the repository cache path.
func (*Repositories) ShowRepos ¶
func (r *Repositories) ShowRepos()
ShowRepos prints information about all repositories.
type Result ¶
Result struct holds resource usage from a run.
func Average ¶
Average gets the average consumption from a set of results. If the number of results is greater than 2 the first one is discarded as warmup run.
func (*Result) Compare ¶
func (p *Result) Compare(q *Result) Comparison
Compare returns percentage difference between this and another run.
func (*Result) ComparePrint ¶
ComparePrint does a result comparison, prints the result in human readable form and returns a bool if change is within allowance.
func (*Result) SaveAllCSV ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server struct describes a daemon.
type Tool ¶
type Tool struct { // Name has the tool name. Name string // BinaryName has the executable name of the tool. BinaryName string // GitURL holds the git URL to download the project. GitURL string // ProjectPath is the directory structure inside GOPATH/src where it should // be located for building. ProjectPath string // BuildSteps has the commands needed to build the tool. BuildSteps []BuildStep // ExtraFiles is a list of files used from the repository. ExtraFiles []string }
Tool describes a project to build and test.