testing

package
v1.13.0-rc.7 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeNTB

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

FakeNTB implements NTB with standard print out and exit. It is used in `e2e/testcases/main_test.go` when `--share-test-env` is turned on.

func (*FakeNTB) Cleanup

func (t *FakeNTB) Cleanup(func())

Cleanup is a no-op function.

func (*FakeNTB) Error

func (t *FakeNTB) Error(args ...interface{})

Error is equivalent to Log followed by Fail.

func (*FakeNTB) Errorf

func (t *FakeNTB) Errorf(format string, args ...interface{})

Errorf is equivalent to Logf followed by Fail.

func (*FakeNTB) Fail

func (t *FakeNTB) Fail()

Fail marks the function as having failed but continues execution.

func (*FakeNTB) FailNow

func (t *FakeNTB) FailNow()

FailNow marks the function as having failed and stops its execution by calling runtime.Goexit (which then runs all deferred calls in the current goroutine).

func (*FakeNTB) Failed

func (t *FakeNTB) Failed() bool

Failed reports whether the function has failed.

func (*FakeNTB) Fatal

func (t *FakeNTB) Fatal(args ...interface{})

Fatal is equivalent to Log followed by FailNow.

func (*FakeNTB) Fatalf

func (t *FakeNTB) Fatalf(format string, args ...interface{})

Fatalf is equivalent to Logf followed by FailNow.

func (*FakeNTB) Helper

func (t *FakeNTB) Helper()

Helper is a no-op function.

func (*FakeNTB) Log

func (t *FakeNTB) Log(args ...interface{})

Log generates the output. It's always at the same stack depth.

func (*FakeNTB) Logf

func (t *FakeNTB) Logf(format string, args ...interface{})

Logf formats its arguments according to the format, analogous to Printf, and records the text in the error log.

func (*FakeNTB) Name

func (t *FakeNTB) Name() string

Name returns an empty string.

func (*FakeNTB) Skip

func (t *FakeNTB) Skip(...interface{})

Skip is a no-op function.

func (*FakeNTB) SkipNow

func (t *FakeNTB) SkipNow()

SkipNow is a no-op function.

func (*FakeNTB) Skipf

func (t *FakeNTB) Skipf(string, ...interface{})

Skipf is a no-op function.

func (*FakeNTB) Skipped

func (t *FakeNTB) Skipped() bool

Skipped is a no-op function.

type NTB

type NTB interface {
	Cleanup(func())
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fail()
	FailNow()
	Failed() bool
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Helper()
	Log(args ...interface{})
	Logf(format string, args ...interface{})
	Name() string
	Skip(args ...interface{})
	SkipNow()
	Skipf(format string, args ...interface{})
	Skipped() bool
}

NTB partially implements testing.TB It is used by the shared setup steps to invoke the per-test functions.

type Wrapper

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

Wrapper implements NTB.

func New

func New(t NTB) *Wrapper

New creates a new instance of the Testing Wrapper that provides additional functionality beyond the standard testing package.

func (*Wrapper) Cleanup

func (w *Wrapper) Cleanup(f func())

Cleanup registers a function to be called when the test and all its subtests complete. Cleanup functions will be called in last added, first called order.

func (*Wrapper) Error

func (w *Wrapper) Error(args ...interface{})

Error is equivalent to Log followed by Fail.

func (*Wrapper) Errorf

func (w *Wrapper) Errorf(format string, args ...interface{})

Errorf is equivalent to Logf followed by Fail.

func (*Wrapper) Fail

func (w *Wrapper) Fail()

Fail marks the function as having failed but continues execution.

func (*Wrapper) FailNow

func (w *Wrapper) FailNow()

FailNow marks the function as having failed and stops its execution by calling runtime.Goexit (which then runs all deferred calls in the current goroutine).

func (*Wrapper) Failed

func (w *Wrapper) Failed() bool

Failed reports whether the function has failed.

func (*Wrapper) Fatal

func (w *Wrapper) Fatal(args ...interface{})

Fatal is equivalent to Log followed by FailNow.

func (*Wrapper) Fatalf

func (w *Wrapper) Fatalf(format string, args ...interface{})

Fatalf is equivalent to Logf followed by FailNow.

func (*Wrapper) Helper

func (w *Wrapper) Helper()

Helper marks the calling function as a test helper function. When printing file and line information, that function will be skipped. Helper may be called simultaneously from multiple goroutines.

func (*Wrapper) Log

func (w *Wrapper) Log(args ...interface{})

Log generates the output. It's always at the same stack depth.

func (*Wrapper) Logf

func (w *Wrapper) Logf(format string, args ...interface{})

Logf formats its arguments according to the format, analogous to Printf, and records the text in the error log.

func (*Wrapper) Name

func (w *Wrapper) Name() string

Name returns the name of the running test or benchmark.

func (*Wrapper) Skip

func (w *Wrapper) Skip(args ...interface{})

Skip is equivalent to Log followed by SkipNow.

func (*Wrapper) SkipNow

func (w *Wrapper) SkipNow()

SkipNow marks the test as having been skipped and stops its execution by calling runtime.Goexit.

func (*Wrapper) Skipf

func (w *Wrapper) Skipf(format string, args ...interface{})

Skipf is equivalent to Logf followed by SkipNow.

func (*Wrapper) Skipped

func (w *Wrapper) Skipped() bool

Skipped reports whether the test was skipped.

Jump to

Keyboard shortcuts

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