watchertest

package
v0.0.0-...-e653fdf Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockNotifyWatcher

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

func NewMockNotifyWatcher

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

func (*MockNotifyWatcher) Changes

func (*MockNotifyWatcher) Err

func (w *MockNotifyWatcher) Err() error

func (*MockNotifyWatcher) Kill

func (w *MockNotifyWatcher) Kill()

func (*MockNotifyWatcher) KillErr

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

func (w *MockNotifyWatcher) Stop() error

func (*MockNotifyWatcher) Wait

func (w *MockNotifyWatcher) Wait() error

type MockStringsWatcher

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

func NewMockStringsWatcher

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

func (*MockStringsWatcher) Changes

func (*MockStringsWatcher) Err

func (w *MockStringsWatcher) Err() error

func (*MockStringsWatcher) Kill

func (w *MockStringsWatcher) Kill()

func (*MockStringsWatcher) KillErr

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

func (w *MockStringsWatcher) Stop() error

func (*MockStringsWatcher) Wait

func (w *MockStringsWatcher) Wait() error

type NotifyWatcherC

type NotifyWatcherC struct {
	*gc.C
	Watcher watcher.NotifyWatcher
}

func NewNotifyWatcherC

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

func (NotifyWatcherC) AssertKilled

func (c NotifyWatcherC) AssertKilled()

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

func (NotifyWatcherC) AssertNoChange

func (c NotifyWatcherC) AssertNoChange()

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

func (NotifyWatcherC) AssertOneChange

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

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

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

func NewRelationUnitsWatcherC

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

NewRelationUnitsWatcherC returns a RelationUnitsWatcherC that checks for aggressive event coalescence.

func (RelationUnitsWatcherC) AssertChange

func (c RelationUnitsWatcherC) AssertChange(changed []string, appChanged []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

func (c RelationUnitsWatcherC) AssertNoChange()

func (RelationUnitsWatcherC) AssertStops

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

type StringsWatcherC struct {
	*gc.C
	Watcher watcher.StringsWatcher
}

func NewStringsWatcherC

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

func (StringsWatcherC) AssertChange

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

func (StringsWatcherC) AssertChangeInSingleEvent

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

func (StringsWatcherC) AssertChangeMaybeIncluding

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

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

func (c StringsWatcherC) AssertNoChange()

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

func (StringsWatcherC) AssertStops

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.

Jump to

Keyboard shortcuts

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