Documentation ¶
Index ¶
- Constants
- Variables
- func AssumeFalse(msg string, ok bool) error
- func AssumeTrue(msg string, ok bool) error
- func AtLeast(i int) int
- func MBitsToBytes(mBits int) int
- func NewCloseableFile(file string, failureMarker *TestRuleMarkFailure) func() error
- func NextInt(r *rand.Rand, start, end int) int
- func Random() *rand.Rand
- func RandomUnicodeString(r *rand.Rand) string
- func Rarely(random *rand.Rand) bool
- func TempDir(desc string) string
- func Usually(r *rand.Rand) bool
- type TestRuleMarkFailure
- type ThrottledIndexOutput
- func (out *ThrottledIndexOutput) Close() error
- func (out *ThrottledIndexOutput) CopyBytes(input util.DataInput, numBytes int64) error
- func (out *ThrottledIndexOutput) FilePointer() int64
- func (out *ThrottledIndexOutput) NewFromDelegate(output store.IndexOutput) *ThrottledIndexOutput
- func (out *ThrottledIndexOutput) WriteByte(b byte) error
- func (out *ThrottledIndexOutput) WriteBytes(buf []byte) error
Constants ¶
const DEFAULT_MIN_WRITTEN_BYTES = 024
const (
SYSPROP_NIGHTLY = "tests_nightly"
)
-------------------------------------------------------------------- Test groups, system properties and other annotations modifying tests --------------------------------------------------------------------
Variables ¶
var ( // Gets the codc to run tests with. TEST_CODEC = or(os.Getenv("tests_codec"), "Lucene49") // TODO prefer random // Gets the postingsFormat to run tests with. TEST_POSTINGSFORMAT = or(os.Getenv("tests_postingsformat"), "random") // Gets the docValuesFormat to run tests with TEST_DOCVALUESFORMAT = or(os.Getenv("tests_docvaluesformat"), "random") // Gets the directory to run tests with TEST_DIRECTORY = or(os.Getenv("tests_directory"), "random") )
var INFOSTREAM = ("true" == or(os.Getenv("tests_infostream"), strconv.FormatBool(VERBOSE)))
var OLD_FORMAT_IMPERSONATION_IS_ACTIVE = false
When true, Codecs fo rold Lucene version will support writing indexes in that format. Defaults to false, can be disabled by specific tests on demand.
var PREFLEX_IMPERSONATION_IS_ACTIVE bool
var RANDOM_MULTIPLIER = func() int { n, err := strconv.Atoi(or(os.Getenv("tests_multiplier"), "1")) if err != nil { panic(err) } return n }()
A random multiplier which you should use when writing random tests: multiply it by the number of iterations to scale your tests (for nightly builds).
var SuiteFailureMarker = &TestRuleMarkFailure{}
Suite failure marker (any error in the test or suite scope)
var TEST_NIGHTLY = ("true" == or(os.Getenv(SYSPROP_NIGHTLY), "false"))
Whether or not Nightly tests should run
var VERBOSE = ("true" == or(os.Getenv("tests_verbose"), "false"))
True if and only if tests are run in verbose mode. If this flag is false tests are not expected toprint and messages.
Functions ¶
func AssumeFalse ¶
func AssumeTrue ¶
Assumption is different from Assert that Assumption returns error, while Assert panics.
func MBitsToBytes ¶
func NewCloseableFile ¶
func NewCloseableFile(file string, failureMarker *TestRuleMarkFailure) func() error
A Closeable that attempts to remove a given file/folder
func Random ¶
Note it's different from Lucene's Randomized Test Runner.
There is an overhead connected with getting the Random for a particular context and thread. It is better to cache this Random locally if tight loops with multiple invocations are present or create a derivative local Random for millions of calls like this:
r := rand.New(rand.NewSource(99)) // tight loop with many invocations.
func RandomUnicodeString ¶
L314 Returns random string, including full unicode range.
func Rarely ¶
Returns true if something should happen rarely,
The actual number returned will be influenced by whether TEST_NIGHTLY is active and RANDOM_MULTIPLIER
Types ¶
type TestRuleMarkFailure ¶
type TestRuleMarkFailure struct {
// contains filtered or unexported fields
}
func (*TestRuleMarkFailure) WasSuccessful ¶
func (tr *TestRuleMarkFailure) WasSuccessful() bool
Check if this object was sucessful
type ThrottledIndexOutput ¶
type ThrottledIndexOutput struct { *store.IndexOutputImpl // contains filtered or unexported fields }
Intentionally slow IndexOutput for testing.
func NewThrottledIndexOutput ¶
func NewThrottledIndexOutput(bytesPerSecond int, delayInMillis int64, delegate store.IndexOutput) *ThrottledIndexOutput
func (*ThrottledIndexOutput) Close ¶
func (out *ThrottledIndexOutput) Close() error
func (*ThrottledIndexOutput) CopyBytes ¶
func (out *ThrottledIndexOutput) CopyBytes(input util.DataInput, numBytes int64) error
func (*ThrottledIndexOutput) FilePointer ¶
func (out *ThrottledIndexOutput) FilePointer() int64
func (*ThrottledIndexOutput) NewFromDelegate ¶
func (out *ThrottledIndexOutput) NewFromDelegate(output store.IndexOutput) *ThrottledIndexOutput
func (*ThrottledIndexOutput) WriteByte ¶
func (out *ThrottledIndexOutput) WriteByte(b byte) error
func (*ThrottledIndexOutput) WriteBytes ¶
func (out *ThrottledIndexOutput) WriteBytes(buf []byte) error