moving ListAllJobs from team to client.go
Signed-off-by: gaelL <contact@gaell.info>
This commit is contained in:
parent
e78ae69b9c
commit
94e8eabe7c
|
@ -28,6 +28,7 @@ type Client interface {
|
|||
GetInfo() (atc.Info, error)
|
||||
GetCLIReader(arch, platform string) (io.ReadCloser, http.Header, error)
|
||||
ListPipelines() ([]atc.Pipeline, error)
|
||||
ListAllJobs() ([]atc.Job, error)
|
||||
ListTeams() ([]atc.Team, error)
|
||||
FindTeam(teamName string) (Team, error)
|
||||
Team(teamName string) Team
|
||||
|
|
|
@ -186,6 +186,18 @@ type FakeClient struct {
|
|||
result1 []atc.User
|
||||
result2 error
|
||||
}
|
||||
ListAllJobsStub func() ([]atc.Job, error)
|
||||
listAllJobsMutex sync.RWMutex
|
||||
listAllJobsArgsForCall []struct {
|
||||
}
|
||||
listAllJobsReturns struct {
|
||||
result1 []atc.Job
|
||||
result2 error
|
||||
}
|
||||
listAllJobsReturnsOnCall map[int]struct {
|
||||
result1 []atc.Job
|
||||
result2 error
|
||||
}
|
||||
ListBuildArtifactsStub func(string) ([]atc.WorkerArtifact, error)
|
||||
listBuildArtifactsMutex sync.RWMutex
|
||||
listBuildArtifactsArgsForCall []struct {
|
||||
|
@ -1110,6 +1122,61 @@ func (fake *FakeClient) ListActiveUsersSinceReturnsOnCall(i int, result1 []atc.U
|
|||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeClient) ListAllJobs() ([]atc.Job, error) {
|
||||
fake.listAllJobsMutex.Lock()
|
||||
ret, specificReturn := fake.listAllJobsReturnsOnCall[len(fake.listAllJobsArgsForCall)]
|
||||
fake.listAllJobsArgsForCall = append(fake.listAllJobsArgsForCall, struct {
|
||||
}{})
|
||||
fake.recordInvocation("ListAllJobs", []interface{}{})
|
||||
fake.listAllJobsMutex.Unlock()
|
||||
if fake.ListAllJobsStub != nil {
|
||||
return fake.ListAllJobsStub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.listAllJobsReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeClient) ListAllJobsCallCount() int {
|
||||
fake.listAllJobsMutex.RLock()
|
||||
defer fake.listAllJobsMutex.RUnlock()
|
||||
return len(fake.listAllJobsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeClient) ListAllJobsCalls(stub func() ([]atc.Job, error)) {
|
||||
fake.listAllJobsMutex.Lock()
|
||||
defer fake.listAllJobsMutex.Unlock()
|
||||
fake.ListAllJobsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeClient) ListAllJobsReturns(result1 []atc.Job, result2 error) {
|
||||
fake.listAllJobsMutex.Lock()
|
||||
defer fake.listAllJobsMutex.Unlock()
|
||||
fake.ListAllJobsStub = nil
|
||||
fake.listAllJobsReturns = struct {
|
||||
result1 []atc.Job
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeClient) ListAllJobsReturnsOnCall(i int, result1 []atc.Job, result2 error) {
|
||||
fake.listAllJobsMutex.Lock()
|
||||
defer fake.listAllJobsMutex.Unlock()
|
||||
fake.ListAllJobsStub = nil
|
||||
if fake.listAllJobsReturnsOnCall == nil {
|
||||
fake.listAllJobsReturnsOnCall = make(map[int]struct {
|
||||
result1 []atc.Job
|
||||
result2 error
|
||||
})
|
||||
}
|
||||
fake.listAllJobsReturnsOnCall[i] = struct {
|
||||
result1 []atc.Job
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeClient) ListBuildArtifacts(arg1 string) ([]atc.WorkerArtifact, error) {
|
||||
fake.listBuildArtifactsMutex.Lock()
|
||||
ret, specificReturn := fake.listBuildArtifactsReturnsOnCall[len(fake.listBuildArtifactsArgsForCall)]
|
||||
|
@ -1658,6 +1725,8 @@ func (fake *FakeClient) Invocations() map[string][][]interface{} {
|
|||
defer fake.landWorkerMutex.RUnlock()
|
||||
fake.listActiveUsersSinceMutex.RLock()
|
||||
defer fake.listActiveUsersSinceMutex.RUnlock()
|
||||
fake.listAllJobsMutex.RLock()
|
||||
defer fake.listAllJobsMutex.RUnlock()
|
||||
fake.listBuildArtifactsMutex.RLock()
|
||||
defer fake.listBuildArtifactsMutex.RUnlock()
|
||||
fake.listPipelinesMutex.RLock()
|
||||
|
|
|
@ -398,18 +398,6 @@ type FakeTeam struct {
|
|||
result3 bool
|
||||
result4 error
|
||||
}
|
||||
ListAllJobsStub func() ([]atc.Job, error)
|
||||
listAllJobsMutex sync.RWMutex
|
||||
listAllJobsArgsForCall []struct {
|
||||
}
|
||||
listAllJobsReturns struct {
|
||||
result1 []atc.Job
|
||||
result2 error
|
||||
}
|
||||
listAllJobsReturnsOnCall map[int]struct {
|
||||
result1 []atc.Job
|
||||
result2 error
|
||||
}
|
||||
ListContainersStub func(map[string]string) ([]atc.Container, error)
|
||||
listContainersMutex sync.RWMutex
|
||||
listContainersArgsForCall []struct {
|
||||
|
@ -2452,61 +2440,6 @@ func (fake *FakeTeam) JobBuildsReturnsOnCall(i int, result1 []atc.Build, result2
|
|||
}{result1, result2, result3, result4}
|
||||
}
|
||||
|
||||
func (fake *FakeTeam) ListAllJobs() ([]atc.Job, error) {
|
||||
fake.listAllJobsMutex.Lock()
|
||||
ret, specificReturn := fake.listAllJobsReturnsOnCall[len(fake.listAllJobsArgsForCall)]
|
||||
fake.listAllJobsArgsForCall = append(fake.listAllJobsArgsForCall, struct {
|
||||
}{})
|
||||
fake.recordInvocation("ListAllJobs", []interface{}{})
|
||||
fake.listAllJobsMutex.Unlock()
|
||||
if fake.ListAllJobsStub != nil {
|
||||
return fake.ListAllJobsStub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
fakeReturns := fake.listAllJobsReturns
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeTeam) ListAllJobsCallCount() int {
|
||||
fake.listAllJobsMutex.RLock()
|
||||
defer fake.listAllJobsMutex.RUnlock()
|
||||
return len(fake.listAllJobsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeTeam) ListAllJobsCalls(stub func() ([]atc.Job, error)) {
|
||||
fake.listAllJobsMutex.Lock()
|
||||
defer fake.listAllJobsMutex.Unlock()
|
||||
fake.ListAllJobsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeTeam) ListAllJobsReturns(result1 []atc.Job, result2 error) {
|
||||
fake.listAllJobsMutex.Lock()
|
||||
defer fake.listAllJobsMutex.Unlock()
|
||||
fake.ListAllJobsStub = nil
|
||||
fake.listAllJobsReturns = struct {
|
||||
result1 []atc.Job
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeTeam) ListAllJobsReturnsOnCall(i int, result1 []atc.Job, result2 error) {
|
||||
fake.listAllJobsMutex.Lock()
|
||||
defer fake.listAllJobsMutex.Unlock()
|
||||
fake.ListAllJobsStub = nil
|
||||
if fake.listAllJobsReturnsOnCall == nil {
|
||||
fake.listAllJobsReturnsOnCall = make(map[int]struct {
|
||||
result1 []atc.Job
|
||||
result2 error
|
||||
})
|
||||
}
|
||||
fake.listAllJobsReturnsOnCall[i] = struct {
|
||||
result1 []atc.Job
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeTeam) ListContainers(arg1 map[string]string) ([]atc.Container, error) {
|
||||
fake.listContainersMutex.Lock()
|
||||
ret, specificReturn := fake.listContainersReturnsOnCall[len(fake.listContainersArgsForCall)]
|
||||
|
@ -4093,8 +4026,6 @@ func (fake *FakeTeam) Invocations() map[string][][]interface{} {
|
|||
defer fake.jobBuildMutex.RUnlock()
|
||||
fake.jobBuildsMutex.RLock()
|
||||
defer fake.jobBuildsMutex.RUnlock()
|
||||
fake.listAllJobsMutex.RLock()
|
||||
defer fake.listAllJobsMutex.RUnlock()
|
||||
fake.listContainersMutex.RLock()
|
||||
defer fake.listContainersMutex.RUnlock()
|
||||
fake.listJobsMutex.RLock()
|
||||
|
|
|
@ -26,9 +26,9 @@ func (team *team) ListJobs(pipelineName string) ([]atc.Job, error) {
|
|||
return jobs, err
|
||||
}
|
||||
|
||||
func (team *team) ListAllJobs() ([]atc.Job, error) {
|
||||
func (client *client) ListAllJobs() ([]atc.Job, error) {
|
||||
var jobs []atc.Job
|
||||
err := team.connection.Send(internal.Request{
|
||||
err := client.connection.Send(internal.Request{
|
||||
RequestName: atc.ListAllJobs,
|
||||
}, &internal.Response{
|
||||
Result: &jobs,
|
||||
|
|
|
@ -45,7 +45,7 @@ var _ = Describe("ATC Handler Jobs", func() {
|
|||
})
|
||||
})
|
||||
|
||||
Describe("team.ListAllJobs", func() {
|
||||
Describe("client.ListAllJobs", func() {
|
||||
var expectedJobs []atc.Job
|
||||
|
||||
BeforeEach(func() {
|
||||
|
@ -71,7 +71,7 @@ var _ = Describe("ATC Handler Jobs", func() {
|
|||
})
|
||||
|
||||
It("returns all jobs that belong to the account", func() {
|
||||
jobs, err := team.ListAllJobs()
|
||||
jobs, err := client.ListAllJobs()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(jobs).To(Equal(expectedJobs))
|
||||
})
|
||||
|
|
|
@ -41,7 +41,6 @@ type Team interface {
|
|||
CreateJobBuild(pipelineName string, jobName string) (atc.Build, error)
|
||||
RerunJobBuild(pipelineName string, jobName string, buildName string) (atc.Build, error)
|
||||
ListJobs(pipelineName string) ([]atc.Job, error)
|
||||
ListAllJobs() ([]atc.Job, error)
|
||||
ScheduleJob(pipelineName string, jobName string) (bool, error)
|
||||
|
||||
PauseJob(pipelineName string, jobName string) (bool, error)
|
||||
|
|
Loading…
Reference in New Issue