juju: github.com/juju/juju/core/watcher/watchertest Index | Files

package watchertest

import "github.com/juju/juju/core/watcher/watchertest"

Index

Package Files

notify.go relationunits.go strings.go

type MockNotifyWatcher Uses

type MockNotifyWatcher struct {
    // contains filtered or unexported fields
}

func NewMockNotifyWatcher Uses

func NewMockNotifyWatcher(ch <-chan struct{}) *MockNotifyWatcher

func (*MockNotifyWatcher) Changes Uses

func (w *MockNotifyWatcher) Changes() watcher.NotifyChannel

func (*MockNotifyWatcher) Err Uses

func (w *MockNotifyWatcher) Err() error

func (*MockNotifyWatcher) Kill Uses

func (w *MockNotifyWatcher) Kill()

func (*MockNotifyWatcher) KillErr Uses

func (w *MockNotifyWatcher) KillErr(err error)

KillErr can be used to kill the worker with an error, to simulate a failing watcher.

func (*MockNotifyWatcher) Stop Uses

func (w *MockNotifyWatcher) Stop() error

func (*MockNotifyWatcher) Wait Uses

func (w *MockNotifyWatcher) Wait() error

type MockStringsWatcher Uses

type MockStringsWatcher struct {
    // contains filtered or unexported fields
}

func NewMockStringsWatcher Uses

func NewMockStringsWatcher(ch <-chan []string) *MockStringsWatcher

func (*MockStringsWatcher) Changes Uses

func (w *MockStringsWatcher) Changes() watcher.StringsChannel

func (*MockStringsWatcher) Err Uses

func (w *MockStringsWatcher) Err() error

func (*MockStringsWatcher) Kill Uses

func (w *MockStringsWatcher) Kill()

func (*MockStringsWatcher) KillErr Uses

func (w *MockStringsWatcher) KillErr(err error)

KillErr can be used to kill the worker with an error, to simulate a failing watcher.

func (*MockStringsWatcher) Stop Uses

func (w *MockStringsWatcher) Stop() error

func (*MockStringsWatcher) Wait Uses

func (w *MockStringsWatcher) Wait() error

type NotifyWatcherC Uses

type NotifyWatcherC struct {
    *gc.C
    Watcher   watcher.NotifyWatcher
    PreAssert func()
}

func NewNotifyWatcherC Uses

func NewNotifyWatcherC(c *gc.C, watcher watcher.NotifyWatcher, preAssert func()) NotifyWatcherC

func (NotifyWatcherC) AssertKilled Uses

func (c NotifyWatcherC) AssertKilled()

AssertKilled Kills the watcher and asserts that Wait completes without error before a long time has passed.

func (NotifyWatcherC) AssertNoChange Uses

func (c NotifyWatcherC) AssertNoChange()

AssertNoChange fails if it manages to read a value from Changes before a short time has passed.

func (NotifyWatcherC) AssertOneChange Uses

func (c NotifyWatcherC) AssertOneChange()

AssertOneChange fails if no change is sent before a long time has passed; or if, subsequent to that, any further change is sent before a short time has passed.

func (NotifyWatcherC) AssertStops Uses

func (c NotifyWatcherC) AssertStops()

AssertStops Kills the watcher and asserts (1) that Wait completes without error before a long time has passed; and (2) that Changes remains open but no values are being sent.

type RelationUnitsWatcherC Uses

type RelationUnitsWatcherC struct {
    *gc.C
    Watcher   watcher.RelationUnitsWatcher
    PreAssert func()
    // contains filtered or unexported fields
}

func NewRelationUnitsWatcherC Uses

func NewRelationUnitsWatcherC(c *gc.C, w watcher.RelationUnitsWatcher, preAssert func()) RelationUnitsWatcherC

NewRelationUnitsWatcherC returns a RelationUnitsWatcherC that checks for aggressive event coalescence.

func (RelationUnitsWatcherC) AssertChange Uses

func (c RelationUnitsWatcherC) AssertChange(changed []string, departed []string)

AssertChange asserts the given changes was reported by the watcher, but does not assume there are no following changes.

func (RelationUnitsWatcherC) AssertNoChange Uses

func (c RelationUnitsWatcherC) AssertNoChange()

func (RelationUnitsWatcherC) AssertStops Uses

func (c RelationUnitsWatcherC) AssertStops()

AssertStops Kills the watcher and asserts (1) that Wait completes without error before a long time has passed; and (2) that Changes remains open but no values are being sent.

type StringsWatcherC Uses

type StringsWatcherC struct {
    *gc.C
    Watcher   watcher.StringsWatcher
    PreAssert func()
}

func NewStringsWatcherC Uses

func NewStringsWatcherC(c *gc.C, watcher watcher.StringsWatcher, preAssert func()) StringsWatcherC

func (StringsWatcherC) AssertChange Uses

func (c StringsWatcherC) AssertChange(expect ...string)

func (StringsWatcherC) AssertChangeInSingleEvent Uses

func (c StringsWatcherC) AssertChangeInSingleEvent(expect ...string)

func (StringsWatcherC) AssertChangeMaybeIncluding Uses

func (c StringsWatcherC) AssertChangeMaybeIncluding(expect ...string)

AssertChangeMaybeIncluding verifies that there is a change that may contain zero to all of the passed in strings, and no other changes.

func (StringsWatcherC) AssertChanges Uses

func (c StringsWatcherC) AssertChanges()

AssertChanges fails if it cannot read a value from Changes despite waiting a long time. It logs, but does not check, the received changes; but will fail if the Changes chan is closed.

func (StringsWatcherC) AssertNoChange Uses

func (c StringsWatcherC) AssertNoChange()

AssertNoChange fails if it manages to read a value from Changes before a short time has passed.

func (StringsWatcherC) AssertStops Uses

func (c StringsWatcherC) AssertStops()

AssertStops Kills the watcher and asserts (1) that Wait completes without error before a long time has passed; and (2) that Changes remains open but no values are being sent.

Package watchertest imports 7 packages (graph) and is imported by 3 packages. Updated 2019-10-18. Refresh now. Tools for package owners.