Documentation ¶
Index ¶
- func WaitForAction(ctx context.Context, w ProgressWatcher, a *hcloud.Action) error
- func WaitForActions(ctx context.Context, w ProgressWatcher, a []*hcloud.Action) error
- type MockProgressWatcher
- func (m *MockProgressWatcher) MockWatchOverallProgress(ctx context.Context, a []*hcloud.Action, err error) <-chan struct{}
- func (m *MockProgressWatcher) MockWatchProgress(ctx context.Context, a *hcloud.Action, err error) <-chan struct{}
- func (m *MockProgressWatcher) WatchOverallProgress(ctx context.Context, a []*hcloud.Action) (<-chan int, <-chan error)
- func (m *MockProgressWatcher) WatchProgress(ctx context.Context, a *hcloud.Action) (<-chan int, <-chan error)
- type ProgressWatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WaitForAction ¶
WaitForAction uses ProgressWatcher to wait for the completion of a.
func WaitForActions ¶ added in v1.25.0
WaitForActions uses ProgressWatcher to wait for the completion of all actions.
Types ¶
type MockProgressWatcher ¶
MockProgressWatcher provides a mock implementation of the ProgressWatcher interface.
func NewMockProgressWatcher ¶
func NewMockProgressWatcher(t *testing.T) *MockProgressWatcher
NewMockProgressWatcher creates a new mock progress watcher.
func (*MockProgressWatcher) MockWatchOverallProgress ¶ added in v1.25.0
func (m *MockProgressWatcher) MockWatchOverallProgress(ctx context.Context, a []*hcloud.Action, err error) <-chan struct{}
MockWatchProgress mocks WatchProgress to return a progress and an error channel. A Go routine is started, which closes the channels and sends err into the error channel if not nil.
func (*MockProgressWatcher) MockWatchProgress ¶
func (m *MockProgressWatcher) MockWatchProgress(ctx context.Context, a *hcloud.Action, err error) <-chan struct{}
MockWatchProgress mocks WatchProgress to return a progress and an error channel. A Go routine is started, which closes the channels and sends err into the error channel if not nil.
func (*MockProgressWatcher) WatchOverallProgress ¶ added in v1.25.0
func (m *MockProgressWatcher) WatchOverallProgress(ctx context.Context, a []*hcloud.Action) (<-chan int, <-chan error)
WatchProgress is a mock implementation of the ProgressWatcher.WatchProgress method.
func (*MockProgressWatcher) WatchProgress ¶
func (m *MockProgressWatcher) WatchProgress(ctx context.Context, a *hcloud.Action) (<-chan int, <-chan error)
WatchProgress is a mock implementation of the ProgressWatcher.WatchProgress method.
type ProgressWatcher ¶
type ProgressWatcher interface { WatchProgress(context.Context, *hcloud.Action) (<-chan int, <-chan error) WatchOverallProgress(ctx context.Context, actions []*hcloud.Action) (<-chan int, <-chan error) }
ProgressWatcher encapsulates the Hetzner Cloud Action Client's WatchProgress method for easier testing.