runs

package
v1.74.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package runs provides the types used by test_all

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GOPATH

func GOPATH() string

GOPATH returns the current GOPATH

Types

type Backend

type Backend struct {
	Backend     string   // name of the backend directory
	Remote      string   // name of the test remote
	FastList    bool     // set to test with -fast-list
	Short       bool     // set to test with -short
	OneOnly     bool     // set to run only one backend test at once
	MaxFile     string   // file size limit
	CleanUp     bool     // when running clean, run cleanup first
	Ignore      []string // test names to ignore the failure of
	Tests       []string // paths of tests to run, blank for all
	IgnoreTests []string // paths of tests not to run, blank for none
	ListRetries int      // -list-retries if > 0
	ExtraTime   float64  // factor to multiply the timeout by
	Env         []string // environment variables to set in form KEY=VALUE
}

Backend describes a backend test

FIXME make bucket-based remotes set sub-dir automatically???

func (*Backend) MakeRuns

func (b *Backend) MakeRuns(t *Test) (runs []*Run)

MakeRuns creates Run objects the Backend and Test

There can be several created, one for each combination of optional flags (e.g. FastList)

type Config

type Config struct {
	Tests    []Test
	Backends []Backend
}

Config describes the config for this program

func NewConfig

func NewConfig(configFile string) (*Config, error)

NewConfig reads the config file

func (*Config) FilterBackendsByBackends

func (c *Config) FilterBackendsByBackends(backendNames []string)

FilterBackendsByBackends filters the Backends with the backendNames passed in

func (*Config) FilterBackendsByRemotes

func (c *Config) FilterBackendsByRemotes(remotes []string)

FilterBackendsByRemotes filters the Backends with the remotes passed in.

If no backend is found with a remote is found then synthesize one

func (*Config) FilterTests

func (c *Config) FilterTests(paths []string)

FilterTests filters the incoming tests into the backends selected

func (*Config) MakeRuns

func (c *Config) MakeRuns() (runs Runs)

MakeRuns makes Run objects for each combination of Backend and Test in the config

type Report

type Report struct {
	LogDir    string        // output directory for logs and report
	StartTime time.Time     // time started
	DateTime  string        // directory name for output
	Duration  time.Duration // time the run took
	Failed    Runs          // failed runs
	Passed    Runs          // passed runs
	Runs      []ReportRun   // runs to report
	Version   string        // rclone version
	Previous  string        // previous test name if known
	IndexHTML string        // path to the index.html file
	URL       string        // online version
	Branch    string        // rclone branch
	Commit    string        // rclone commit
	GOOS      string        // Go OS
	GOARCH    string        // Go Arch
	GoVersion string        // Go Version
}

Report holds the info to make a report on a series of test runs

func NewReport

func NewReport(Opt RunOpt) *Report

NewReport initialises and returns a Report

func (*Report) AllPassed

func (r *Report) AllPassed() bool

AllPassed returns true if there were no failed tests

func (*Report) EmailHTML

func (r *Report) EmailHTML(Opt RunOpt)

EmailHTML sends the summary report to the email address supplied

func (*Report) End

func (r *Report) End()

End should be called when the tests are complete

func (*Report) LogHTML

func (r *Report) LogHTML()

LogHTML writes the summary to index.html in LogDir

func (*Report) LogJSON

func (r *Report) LogJSON()

LogJSON writes the summary to index.json in LogDir

func (*Report) LogSummary

func (r *Report) LogSummary()

LogSummary writes the summary to the log file

func (*Report) RecordResult

func (r *Report) RecordResult(t *Run)

RecordResult should be called with a Run when it has finished to be recorded into the Report

func (*Report) Title

func (r *Report) Title() string

Title returns a human-readable summary title for the Report

func (*Report) Upload

func (r *Report) Upload(Opt RunOpt)

Upload uploads a copy of the report online

type ReportRun

type ReportRun struct {
	Name string
	Runs Runs
}

ReportRun is used in the templates to report on a test run

type Run

type Run struct {
	// Config
	Remote      string // name of the test remote
	Backend     string // name of the backend
	Path        string // path to the source directory
	FastList    bool   // add -fast-list to tests
	Short       bool   // add -short
	NoRetries   bool   // don't retry if set
	OneOnly     bool   // only run test for this backend at once
	NoBinary    bool   // set to not build a binary
	SizeLimit   int64  // maximum test file size
	Ignore      map[string]struct{}
	ListRetries int      // -list-retries if > 0
	ExtraTime   float64  // multiply the timeout by this
	Env         []string // environment variables in form KEY=VALUE
	// Internals
	CmdLine   []string
	CmdString string
	Try       int

	FailedTests []string
	RunFlag     string
	LogDir      string   // directory to place the logs
	TrialName   string   // name/log file name of current trial
	TrialNames  []string // list of all the trials
	// contains filtered or unexported fields
}

Run holds info about a running test

A run just runs one command line, but it can be run multiple times if retries are needed.

func (*Run) BinaryName

func (r *Run) BinaryName() string

BinaryName turns a package name into a binary name

func (*Run) BinaryPath

func (r *Run) BinaryPath() string

BinaryPath turns a package name into a binary path

func (*Run) FailedTestsCSV

func (r *Run) FailedTestsCSV() string

FailedTestsCSV returns the failed tests as a comma separated string, limiting the number

func (*Run) Init

func (r *Run) Init(Opt RunOpt)

Init the Run

func (*Run) Logs

func (r *Run) Logs() []string

Logs returns all the log names

func (*Run) MakeTestBinary

func (r *Run) MakeTestBinary(Opt RunOpt)

MakeTestBinary makes the binary we will run

func (*Run) Name

func (r *Run) Name() string

Name returns the run name as a file name friendly string

func (*Run) PackagePath

func (r *Run) PackagePath() string

PackagePath returns the path to the package

func (*Run) RemoveTestBinary

func (r *Run) RemoveTestBinary(Opt RunOpt)

RemoveTestBinary removes the binary made in makeTestBinary

func (*Run) Run

func (r *Run) Run(Opt RunOpt, LogDir string, result chan<- *Run)

Run runs all the trials for this test

type RunOpt

type RunOpt struct {
	MaxTries     int           // Number of times to try each test
	MaxN         int           // Maximum number of tests to run at once
	TestRemotes  string        // Comma separated list of remotes to test, e.g. 'TestSwift:,TestS3'
	TestBackends string        // Comma separated list of backends to test, e.g. 's3,googlecloudstorage
	TestTests    string        // Comma separated list of tests to test, e.g. 'fs/sync,fs/operations'
	Clean        bool          // Instead of testing, clean all left over test directories
	RunOnly      string        // Run only those tests matching the regexp supplied
	Timeout      time.Duration // Maximum time to run each test for before giving up
	Race         bool          // If set run the tests under the race detector
	ConfigFile   string        // Path to config file
	OutputDir    string        // Place to store results
	EmailReport  string        // Set to email the report to the address supplied
	DryRun       bool          // Print commands which would be executed only
	URLBase      string        // Base for the online version
	UploadPath   string        // Set this to an rclone path to upload the results here
	Verbose      bool          // Set to enable verbose logging in the tests
	ListRetries  int           // Number or times to retry listing - set to override the default
}

RunOpt holds the options for the Run

type Runs

type Runs []*Run

Runs records multiple Run objects

func (Runs) Len

func (rs Runs) Len() int

Sort interface

func (Runs) Less

func (rs Runs) Less(i, j int) bool

func (Runs) Swap

func (rs Runs) Swap(i, j int)

type Test

type Test struct {
	Path       string // path to the source directory
	FastList   bool   // if it is possible to add -fast-list to tests
	Short      bool   // if it is possible to run the test with -short
	AddBackend bool   // set if Path needs the current backend appending
	NoRetries  bool   // set if no retries should be performed
	NoBinary   bool   // set to not build a binary in advance
	LocalOnly  bool   // if set only run with the local backend
}

Test describes an integration test to run with `go test`

Jump to

Keyboard shortcuts

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