Documentation ¶
Index ¶
- Variables
- func Create(verifyOrder bool, names ...string) flow.Runnable
- type TestingT
- type Watcher
- func (w *Watcher) Add(data ...interface{})
- func (w *Watcher) Assert(t TestingT, timeout time.Duration) bool
- func (w *Watcher) AssertNotDelivered(t TestingT, timeout time.Duration) bool
- func (w *Watcher) Expect(data ...interface{})
- func (w *Watcher) ExpectBytes(data ...byte)
- func (w *Watcher) ExpectI16s(data ...int16)
- func (w *Watcher) ExpectI32s(data ...int32)
- func (w *Watcher) ExpectI64s(data ...int64)
- func (w *Watcher) ExpectI8s(data ...int8)
- func (w *Watcher) ExpectInts(data ...int)
- func (w *Watcher) ExpectRunes(data ...rune)
- func (w *Watcher) ExpectStrings(data ...string)
- func (w *Watcher) ExpectU16s(data ...uint16)
- func (w *Watcher) ExpectU32s(data ...uint32)
- func (w *Watcher) ExpectU64s(data ...uint64)
- func (w *Watcher) ExpectUInts(data ...uint)
- func (w *Watcher) FailIfNotExpected(t TestingT, data ...interface{})
- func (w *Watcher) Observe(data ...interface{})
- func (w *Watcher) ObserveJSON(data ...interface{})
- func (w *Watcher) Partial(t TestingT, timeout time.Duration) (TestingT, interface{}, interface{})
- func (w *Watcher) Prepare(data ...interface{})
- func (w *Watcher) Remove(data ...interface{})
- func (w *Watcher) Require(t TestingT, timeout time.Duration)
- func (w *Watcher) Reset()
- func (w *Watcher) Result(t TestingT, timeout time.Duration) (TestingT, interface{}, interface{})
- func (w *Watcher) WaitForResult(timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
var ErrTimeout = errors.New("timeout")
ErrTimeout denotes that the Watcher timed out waiting for remaining data to be observed.
Functions ¶
Types ¶
type TestingT ¶
type TestingT interface { Error(args ...interface{}) Errorf(format string, args ...interface{}) Fail() FailNow() }
TestingT is an interface wrapper around *testing.T
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
func NewOrdered ¶
func NewOrdered() *Watcher
NewOrdered creates a Watcher that expects observed data to match the ordering of the expected data.
func NewUnordered ¶
func NewUnordered() *Watcher
func (*Watcher) Add ¶
func (w *Watcher) Add(data ...interface{})
Add is called after the network operation completes successfully and adds `data` to the `expected` slice so that it can be compared to the `observed` data at the end of the test scenario. Use Prepare and Add together when created expected data while a separate goroutine that calls Observer is running.
func (*Watcher) Assert ¶
Assert waits for up to `timeout` for all expected data to be observed and asserts the expected and observed data are either equal (in order) or have matching elemenets (out of order is acceptable).
func (*Watcher) AssertNotDelivered ¶
func (*Watcher) Expect ¶
func (w *Watcher) Expect(data ...interface{})
Expect adds data to both the `remaining` map add the expected slice in a single call. Use this only when a test scenario can prepare the expected data prior to an Observe calls.
func (*Watcher) ExpectBytes ¶
ExpectBytes provides a simple function to add expected bytes.
func (*Watcher) ExpectI16s ¶
ExpectI16s provides a simple function to add expected int16s.
func (*Watcher) ExpectI32s ¶
ExpectI32s provides a simple function to add expected int32s.
func (*Watcher) ExpectI64s ¶
ExpectI64s provides a simple function to add expected int64s.
func (*Watcher) ExpectInts ¶
ExpectInts provides a simple function to add expected integers.
func (*Watcher) ExpectRunes ¶
ExpectRunes provides a simple function to add expected runes.
func (*Watcher) ExpectStrings ¶
ExpectStrings provides a simple function to add expected strings.
func (*Watcher) ExpectU16s ¶
ExpectU16s provides a simple function to add expected uint16s.
func (*Watcher) ExpectU32s ¶
ExpectU32s provides a simple function to add expected uint32s.
func (*Watcher) ExpectU64s ¶
ExpectU64s provides a simple function to add expected uint64s.
func (*Watcher) ExpectUInts ¶
ExpectUInts provides a simple function to add expected unsigned integers.
func (*Watcher) FailIfNotExpected ¶
func (*Watcher) Observe ¶
func (w *Watcher) Observe(data ...interface{})
Observe adds any data that is in `remaining` to the `observed` slice. If the the watcher is closable (all expected data captured) and there is no more remaining data to observe, then the finish channel is closed.
func (*Watcher) ObserveJSON ¶
func (w *Watcher) ObserveJSON(data ...interface{})
ObserveJSON adds any json data that is in `remaining` to the `observed` slice. If the the watcher is closable (all expected data captured) and there is no more remaining data to observe, then the finish channel is closed.
func (*Watcher) Partial ¶
Partial waits for up to `timeout` for any expected data to be observed and returns the expected and observed slices even if not complete.
func (*Watcher) Prepare ¶
func (w *Watcher) Prepare(data ...interface{})
Prepare is called before a network operation is called to add expected `data` to the `remaining` map. This is so that Observe can verify the data is expected and add it to the `observed` slice. Use Prepare and Add together when created expected data while a separate goroutine that calls Observer is running.
func (*Watcher) Remove ¶
func (w *Watcher) Remove(data ...interface{})
Remove is called if the network operation fails and removes `data` from the `remaining` map added during `Prepare`. This is so that if the `Publish` ' operation fails, `data` added for tracking could be removed afterwards.
func (*Watcher) Require ¶
Assert waits for up to `timeout` for all expected data to be observed and requires the expected and observed data are either equal (in order) or have matching elemenets (out of order is acceptable).
func (*Watcher) Reset ¶
func (w *Watcher) Reset()
Reset clears all the underlying state and returns the watcher to a initial state.