Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BenchDB ¶
type BenchDB interface { // Run executes go test bench for benchmarks matching a regex defined in // BenchDBConfigthe current directory. By default it does not run unit tests // by way of setting test.run to XXX in the call to go test. It also parses the // benchSet and calls WriteSet to write the benchmark data to a database. It // returns any error encountered. Run() error // WriteSet is responsible for opening a postgres database connection and writing // a parsed benchSet to a db table. It closes the connection, returns the number of // benchmark tests written, and any error encountered. WriteSet(parse.Set) (int, error) }
A BenchDB manges the execution of benchmark tests using go test and writing a parse.Set to a database.
Implementations of BenchDB for different databases are allowed by way of the WriteSet method.
type BenchDBConfig ¶
type BenchDBConfig struct { Regex string // regex to run tests ShaLen int // number of latest git sha characters }
BenchDBConfig represents configuration data for BenchDB.
type BenchPSQL ¶
type BenchPSQL struct { Config *BenchDBConfig // configuration for go test Driver string // database driver name ConnStr string // sql connection string TableName string // database table name // contains filtered or unexported fields }
BenchPSQL represents a BenchDB that writes benchmarks to a postgres database.
func (*BenchPSQL) Run ¶
Run runs go test benchmarks matching regex in the current directory and writes benchmark data to a PSQL database by calling WriteSet. It returns any error encountered.
func (*BenchPSQL) WriteSet ¶
WriteSet is responsible for opening a postgres database connection and writing a parsed benchSet to a db table. It closes the connection, returns the number of benchmark tests written, and any error encountered.
A new sql transaction is created and committed per Benchmark in benchSet. This way if a db failure occurs all data from the benchSet is not lost.