Documentation ¶
Overview ¶
Package mrtest is a test package tightly tied to the mr package, separated out to avoid import cycles when other tests want to use it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MRCheck ¶
MRCheck is a check function that runs a mapreduce using the specified number of mappers and reducers.
Creates a bunch of documents, filled with numeric strings (words are all numbers, makes things easy). We start with a known histogram, then we assemble documents by randomly drawing without replacement until the distribution is empty. That way we know our outputs from the beginning, and we get a random starting point.
When using with quick.Check, the first two arguments should usually be fixed, but the remainder can be "checked". Thus, it often makes sense to use it in a closure, thus:
config := &quick.Config{ MaxCount: 5, Values: func(values []reflect.Value, rand *rand.Rand) { values[0] = reflect.ValueOf(rand.Intn(2000) + 1000) values[1] = reflect.ValueOf(rand.Intn(100) + 1) values[2] = reflect.ValueOf(rand.Intn(20) + 1) }, } check := func(nm, nr int) bool { return MRCheck(ctx, client, nm, nr) } if err := quick.Check(check, config); err != nil { t.Fatal(err) }
Types ¶
This section is empty.