gitbase

package module
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: Apache-2.0 Imports: 13 Imported by: 1

README

regression-gitbase

regression-gitbase is a tool than runs different versions of gitbase and compares its resource consumption.

Usage:
  regression [OPTIONS]

gitbase regression tester.

This tool executes several versions of gitbase and compares query times and
resource usage. There should be at least two versions specified as arguments in
the following way:

* v0.12.1 - release name from github (https://github.com/src-d/gitbase/releases).
The binary will be downloaded.
* latest - latest release from github. The binary will be downloaded.
* remote:master - any tag or branch from gitbase repository. The binary will be
built automatically.
* local:fix/some-bug - tag or branch from the repository in the current directory.
The binary will be built.
* local:HEAD - current state of the repository. Binary is built.
* pull:266 - code from pull request #266 from gitbase repo. Binary is built.
* /path/to/gitbase - a gitbase binary built locally.

The repositories and downloaded/built gitbase binaries are cached by default in
"repos" and "binaries" repositories from the current directory.


Application Options:
      --binaries=     Directory to store binaries (default: binaries) [$REG_BINARIES]
      --repos=        Directory to store repositories (default: repos) [$REG_REPOS]
      --url=          URL to the tool repo [$REG_GITURL]
      --gitport=      Port for local git server (default: 9418) [$REG_GITPORT]
      --repos-file=   YAML file with the list of repos [$REG_REPOS_FILE]
  -c, --complexity=   Complexity of the repositories to test (default: 1) [$REG_COMPLEXITY]
  -n, --repeat=       Number of times a test is run (default: 3) [$REG_REPEAT]
      --show-repos    List available repositories to test
  -t, --token=        Token used to connect to the API [$REG_TOKEN]
      --csv           save csv files with last result
      --prom          store latest results to prometheus
      --prom-address= prometheus pushgateway address [$PROM_ADDRESS]
      --prom-job=     prometheus job [$PROM_JOB]
      --ci-branch=    branch env [$GIT_BRANCH]
      --ci-commit=    commit env [$GIT_COMMIT]

Help Options:
  -h, --help        Show this help message

License

Licensed under the terms of the Apache License Version 2.0. See the LICENSE file for the full license text.

Documentation

Index

Constants

View Source
const (
	WSeconds  = "regression_gitbase_w_avg_seconds"
	SSeconds  = "regression_gitbase_s_avg_seconds"
	USeconds  = "regression_gitbase_u_avg_seconds"
	MemoryMiB = "regression_gitbase_mem_avg_mib"
)

Variables

This section is empty.

Functions

func NewGitbase

func NewGitbase(
	config regression.Config,
	version string,
	releases *regression.Releases,
) *regression.Binary

NewGitbase returns a Binary struct for gitbase Tool.

func NewToolGitbase

func NewToolGitbase() regression.Tool

NewToolGitbase creates a Tool with gitbase parameters filled.

Types

type Comparison

type Comparison struct {
	regression.Comparison

	Rows float64
}

Comparison struct holds the percentage difference between two results.

type PromClient added in v0.3.0

type PromClient struct {
	// contains filtered or unexported fields
}

PromClient is the wrapper around pusher that also keeps metrics

func NewPromClient added in v0.3.0

func NewPromClient(p regression.PromConfig) *PromClient

NewPromClient inits new pusher, creates metrics and adds them to the collector

func (*PromClient) Dump added in v0.3.0

func (p *PromClient) Dump(res *regression.Result, version, name, branch, commit string) error

Dump does observations and adds metrics to the pusher

type Query

type Query struct {
	ID         string   `yaml:"ID"`
	Name       string   `yaml:"Name,omitempty"`
	Statements []string `yaml:"Statements"`
}

Query struct has information about on query. It can consist on more than one statement.

type Result

type Result struct {
	*regression.Result
	Query
	Rows int64
}

Result holds the resources and number of rows from a version test.

func NewResult added in v0.1.0

func NewResult() *Result

func (*Result) ComparePrint

func (r *Result) ComparePrint(q *Result, allowance float64) bool

ComparePrint shows the difference between two results and returns if it is within margin.

type SQLTest

type SQLTest struct {
	Query Query
	URL   string
	// contains filtered or unexported fields
}

SQLTest holds are the queries that belong to a test and connection functionality.

func NewSQLTest

func NewSQLTest(url string, query Query) *SQLTest

NewSQLTest creates a new SQLTest.

func (*SQLTest) Connect

func (q *SQLTest) Connect() error

Connect creates the mysql connection to gitbase.

func (*SQLTest) Disconnect

func (q *SQLTest) Disconnect() error

Disconnect closes the mysql connection.

func (*SQLTest) Execute

func (q *SQLTest) Execute() (int64, error)

Execute runs sql query on the gitbase server.

func (*SQLTest) ExecuteCtx added in v0.3.2

func (q *SQLTest) ExecuteCtx(ctx context.Context) (int64, error)

type Server

type Server struct {
	*regression.Server
	// contains filtered or unexported fields
}

Server wraps a gitbase server instance.

func NewServer

func NewServer(binary, repos string) *Server

NewServer creates a new gitbase server struct.

func (*Server) Start

func (s *Server) Start(envs map[string]string) error

Start spawns a new gitbase server.

func (*Server) Stop

func (s *Server) Stop() (err error)

Stops stops the gitbase server and deletes the index directory.

func (*Server) URL

func (s *Server) URL() string

URL returns the mysql URL to connect to gitbase server.

type Test

type Test struct {
	// contains filtered or unexported fields
}

Test holds the information about a gitbase test.

func NewTest

func NewTest(config regression.Config, serverConfig regression.GitServerConfig) (*Test, error)

NewTest creates a new Test struct.

func (*Test) GetResults

func (t *Test) GetResults() bool

GetResults prints test results and returns if the tests passed.

func (*Test) Prepare

func (t *Test) Prepare() error

Prepare downloads repos and binaries needed for the test.

func (*Test) PrintTabbedResults added in v0.1.0

func (t *Test) PrintTabbedResults()

func (*Test) RunLoad added in v0.3.2

func (t *Test) RunLoad() error

RunLoad executes the tests.

func (*Test) RunQueryCtx added in v0.3.2

func (t *Test) RunQueryCtx(ctx context.Context, gitbaseEnvs map[string]string, query Query) error

func (*Test) SaveLatestCSV added in v0.1.0

func (t *Test) SaveLatestCSV()

func (*Test) StoreLatestToPrometheus added in v0.3.0

func (t *Test) StoreLatestToPrometheus(promConfig regression.PromConfig, ciConfig regression.CIConfig) error

StoreLatestToPrometheus stores latest version results to prometheus pushgateway

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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