gocop

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ResultsPattern provides the REGEX pattern to find all package output
	ResultsPattern = `((FAIL|ok|\?)\s+([\w\.\/\-]+)\s+([0-9s\.]+|\[build failed\]|\[no test files\])(\n|\s+coverage\:\s+([\d\.]+)\%\s+))`
)

Variables

This section is empty.

Functions

func ConnectDB

func ConnectDB(host, port, user, password, dbname, sslmode string) *sql.DB

ConnectDB connects to the database

func Flaky

func Flaky(runs ...[]byte) []string

Flaky reviews test output from multiple attempts and identifies potentially flaky packages

func FlakyFile

func FlakyFile(files ...string) []string

FlakyFile reviews test output from multiple files to identify flaky packages

func GetRun

func GetRun(db *sql.DB, buildID int64) *sql.Row

GetRun retrieves information about a run

func GetTests

func GetTests(db *sql.DB, created time.Time) (*sql.Rows, error)

GetTests retrieves test results for a build

func InsertRun

func InsertRun(db *sql.DB, run TestRun) (sql.Result, error)

InsertRun inserts a new entry to the run table in the database

func InsertTests

func InsertTests(db *sql.DB, created time.Time, testResults []TestResult) (sql.Result, error)

InsertTests adds test results to database

func Parse

func Parse(output []byte) [][]string

Parse iterates over test output for all packages

func ParseFailed

func ParseFailed(output []byte) []string

ParseFailed iterates over test output for failed packages

func ParseFile

func ParseFile(path string) [][]string

ParseFile reads a file to Parse() results

func ParseFileFailed

func ParseFileFailed(path string) []string

ParseFileFailed reads a file to Parse() failed packages

func ReplaceSQL

func ReplaceSQL(old, searchPattern string) string

ReplaceSQL replaces the instance occurrence of any string pattern with an increasing $n based sequence

Types

type TestResult

type TestResult struct {
	Created  time.Time
	Package  string
	Result   string
	Duration time.Duration
	Coverage float64
}

TestResult contains data about a test result

type TestRun

type TestRun struct {
	Created   time.Time
	Repo      string
	Branch    string
	Sha       string
	BuildID   int64
	Config    string
	Command   string
	Benchmark bool
	Short     bool
	Race      bool
	Tags      []string
	Duration  time.Duration
}

TestRun contains data about a test run

Jump to

Keyboard shortcuts

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