tests

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SlowTest  = 10 * time.Second
	SlowFlush = 5 * time.Second
)
View Source
var WriterCloser = &testLoggerWriterCloser{}

Functions

func InitTest

func InitTest(requireGitea bool)

func NewTestLogger

func NewTestLogger() log.LoggerProvider

NewTestLogger creates a TestLogger as a log.LoggerProvider

func PrepareTestEnv

func PrepareTestEnv(t testing.TB, skip ...int) func()

func PrintCurrentTest

func PrintCurrentTest(t testing.TB, skip ...int) func()

PrintCurrentTest prints the current test to os.Stdout

func Printf

func Printf(format string, args ...interface{})

Printf takes a format and args and prints the string to os.Stdout

func ResetFixtures

func ResetFixtures(t *testing.T)

resetFixtures flushes queues, reloads fixtures and resets test repositories within a single test. Most tests should call defer tests.PrepareTestEnv(t)() (or have onGiteaRun do that for them) but sometimes within a single test this is required

Types

type TestLogger

type TestLogger struct {
	log.WriterLogger
}

TestLogger is a logger which will write to the testing log

func (*TestLogger) Content

func (log *TestLogger) Content() (string, error)

Content returns the content accumulated in the content provider

func (*TestLogger) Flush

func (log *TestLogger) Flush()

Flush when log should be flushed

func (*TestLogger) GetName

func (log *TestLogger) GetName() string

GetName returns the default name for this implementation

func (*TestLogger) Init

func (log *TestLogger) Init(config string) error

Init inits connection writer with json config. json config only need key "level".

func (*TestLogger) ReleaseReopen

func (log *TestLogger) ReleaseReopen() error

ReleaseReopen does nothing

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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