1
// Copyright 2015 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
7
"github.com/juju/testing"
8
"gopkg.in/juju/charm.v6-unstable"
10
"github.com/juju/juju/worker/fortress"
11
"github.com/juju/juju/worker/uniter/hook"
12
"github.com/juju/juju/worker/uniter/operation"
13
"github.com/juju/juju/worker/uniter/remotestate"
16
type mockRemoteStateWatcher struct {
17
remotestate.RemoteStateWatcher
19
snapshot remotestate.Snapshot
22
func (w *mockRemoteStateWatcher) RemoteStateChanged() <-chan struct{} {
26
func (w *mockRemoteStateWatcher) Snapshot() remotestate.Snapshot {
30
type mockOpFactory struct {
36
func (f *mockOpFactory) NewUpgrade(charmURL *charm.URL) (operation.Operation, error) {
37
f.MethodCall(f, "NewUpgrade", charmURL)
38
return f.op, f.NextErr()
41
func (f *mockOpFactory) NewRevertUpgrade(charmURL *charm.URL) (operation.Operation, error) {
42
f.MethodCall(f, "NewRevertUpgrade", charmURL)
43
return f.op, f.NextErr()
46
func (f *mockOpFactory) NewResolvedUpgrade(charmURL *charm.URL) (operation.Operation, error) {
47
f.MethodCall(f, "NewResolvedUpgrade", charmURL)
48
return f.op, f.NextErr()
51
func (f *mockOpFactory) NewRunHook(info hook.Info) (operation.Operation, error) {
52
f.MethodCall(f, "NewRunHook", info)
53
return f.op, f.NextErr()
56
func (f *mockOpFactory) NewSkipHook(info hook.Info) (operation.Operation, error) {
57
f.MethodCall(f, "NewSkipHook", info)
58
return f.op, f.NextErr()
61
func (f *mockOpFactory) NewAction(id string) (operation.Operation, error) {
62
f.MethodCall(f, "NewAction", id)
63
return f.op, f.NextErr()
66
type mockOpExecutor struct {
72
func (e *mockOpExecutor) State() operation.State {
73
e.MethodCall(e, "State")
77
func (e *mockOpExecutor) Run(op operation.Operation) error {
78
e.MethodCall(e, "Run", op)
84
commit func(operation.State) (*operation.State, error)
87
func (op mockOp) Commit(st operation.State) (*operation.State, error) {
94
type mockCharmDirGuard struct {
97
commit func(operation.State) (*operation.State, error)
100
func (l *mockCharmDirGuard) Unlock() error {
101
l.MethodCall(l, "Unlock")
105
func (l *mockCharmDirGuard) Lockdown(abort fortress.Abort) error {
106
l.MethodCall(l, "Lockdown", abort)