tests

package module
v0.0.0-...-f3775cb Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2015 License: Apache-2.0 Imports: 4 Imported by: 24

README

Build Status GoDoc

Heketi Test Functions

Generic Go test funcitions

Licensing

Heketi is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Documentation

Overview

Unit test functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(t Tester, b bool, message ...interface{})

Simple assert call for unit and functional tests

func CreateFile

func CreateFile(filename string, size int64) error

We could use Fallocate, but some test CI systems do not support it, like Travis-ci.org.

func Tempfile

func Tempfile() string

Return a filename string in the form of /tmp/gounittest.<Process Id>-<Counter>

Types

type Restorer

type Restorer func()

Restorer holds a function that can be used to restore some previous state.

func Patch

func Patch(dest, value interface{}) Restorer

Patch sets the value pointed to by the given destination to the given value, and returns a function to restore it to its original value. The value must be assignable to the element type of the destination.

For an exaple, see: https://github.com/heketi/heketi/blob/master/utils/log_test.go

func (Restorer) Restore

func (r Restorer) Restore()

Restore restores some previous state.

type Tester

type Tester interface {
	Errorf(format string, args ...interface{})
	FailNow()
}

Jump to

Keyboard shortcuts

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