forked from cloudfoundry/bosh-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_job_applier.go
47 lines (37 loc) · 1017 Bytes
/
fake_job_applier.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package fakes
import (
models "github.com/cloudfoundry/bosh-agent/agent/applier/models"
)
type FakeApplier struct {
PreparedJobs []models.Job
PrepareError error
AppliedJobs []models.Job
ApplyError error
ConfiguredJobs []models.Job
ConfiguredJobIndices []int
ConfigureError error
KeepOnlyJobs []models.Job
KeepOnlyErr error
}
func NewFakeApplier() *FakeApplier {
return &FakeApplier{
AppliedJobs: []models.Job{},
}
}
func (s *FakeApplier) Prepare(job models.Job) error {
s.PreparedJobs = append(s.PreparedJobs, job)
return s.PrepareError
}
func (s *FakeApplier) Apply(job models.Job) error {
s.AppliedJobs = append(s.AppliedJobs, job)
return s.ApplyError
}
func (s *FakeApplier) Configure(job models.Job, jobIndex int) error {
s.ConfiguredJobs = append(s.ConfiguredJobs, job)
s.ConfiguredJobIndices = append(s.ConfiguredJobIndices, jobIndex)
return s.ConfigureError
}
func (s *FakeApplier) KeepOnly(jobs []models.Job) error {
s.KeepOnlyJobs = jobs
return s.KeepOnlyErr
}