tsdb: github.com/prometheus/tsdb/testutil Index | Files

package testutil

import "github.com/prometheus/tsdb/testutil"

Index

Package Files

directory.go logging.go testutil.go

Constants

const (

    // NilCloser is a no-op Closer.
    NilCloser = nilCloser(true)
)

func Assert Uses

func Assert(tb testing.TB, condition bool, msg string, v ...interface{})

Assert fails the test if the condition is false.

func DirHash Uses

func DirHash(t *testing.T, path string) []byte

DirHash returns a hash of all files attribites and their content within a directory.

func DirSize Uses

func DirSize(t *testing.T, path string) int64

DirSize returns the size in bytes of all files in a directory.

func Equals Uses

func Equals(tb testing.TB, exp, act interface{}, msgAndArgs ...interface{})

Equals fails the test if exp is not equal to act.

func NewLogger Uses

func NewLogger(t *testing.T) log.Logger

NewLogger returns a gokit compatible Logger which calls t.Log.

func NotEquals Uses

func NotEquals(tb testing.TB, exp, act interface{})

NotEquals fails the test if exp is equal to act.

func NotOk Uses

func NotOk(tb testing.TB, err error)

NotOk fails the test if an err is nil.

func Ok Uses

func Ok(tb testing.TB, err error)

Ok fails the test if an err is not nil.

type Closer Uses

type Closer interface {
    // Close reaps the underlying directory and its children. The directory
    // could be deleted by its users already.
    Close()
}

Closer is the interface that wraps the Close method.

func NewCallbackCloser Uses

func NewCallbackCloser(fn func()) Closer

NewCallbackCloser returns a Closer that calls the provided function upon closing.

type T Uses

type T interface {
    Fatal(args ...interface{})
    Fatalf(format string, args ...interface{})
}

T implements the needed methods of testing.TB so that we do not need to actually import testing (which has the side effect of adding all the test flags, which we do not want in non-test binaries even if they make use of these utilities for some reason).

type TemporaryDirectory Uses

type TemporaryDirectory interface {
    Closer

    // Path returns the underlying path for access.
    Path() string
}

TemporaryDirectory models a closeable path for transient POSIX disk activities.

func NewTemporaryDirectory Uses

func NewTemporaryDirectory(name string, t T) (handler TemporaryDirectory)

NewTemporaryDirectory creates a new temporary directory for transient POSIX activities.

Package testutil imports 11 packages (graph). Updated 2019-08-16. Refresh now. Tools for package owners.