Skip to content

Commit

Permalink
update tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Evan <chaol@vmware.com>
  • Loading branch information
evanchaoli committed Mar 7, 2022
1 parent d964106 commit 2d5f31f
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 492 deletions.
22 changes: 12 additions & 10 deletions atc/exec/check_step_test.go
Expand Up @@ -114,9 +114,9 @@ var _ = Describe("CheckStep", func() {

fakeResourceConfigScope = new(dbfakes.FakeResourceConfigScope)
fakeDelegate.FindOrCreateScopeReturns(fakeResourceConfigScope, nil)
fakeDelegate.UpdateScopeLastCheckStartTimeStub = func(scope db.ResourceConfigScope, nestedCheck bool) (bool, int, error) {
fakeDelegate.UpdateScopeLastCheckStartTimeStub = func(scope db.ResourceConfigScope) (bool, error) {
found, err := scope.UpdateLastCheckStartTime(int(time.Now().Unix()), nil)
return found, 678, err
return found, err
}
fakeDelegate.UpdateScopeLastCheckEndTimeStub = func(scope db.ResourceConfigScope, succeeded bool) (bool, error) {
return scope.UpdateLastCheckEndTime(succeeded)
Expand Down Expand Up @@ -288,10 +288,6 @@ var _ = Describe("CheckStep", func() {
})
})

It("emits a BeforeSelectWorker event", func() {
Expect(fakeDelegate.BeforeSelectWorkerCallCount()).To(Equal(1))
})

It("emits a SelectedWorker event", func() {
Expect(fakeDelegate.SelectedWorkerCallCount()).To(Equal(1))
_, workerName := fakeDelegate.SelectedWorkerArgsForCall(0)
Expand Down Expand Up @@ -451,11 +447,14 @@ var _ = Describe("CheckStep", func() {
Expect(chosenContainer.RunningProcesses()).To(HaveLen(1))
})

It("call OnCheckBuildStart", func(){
Expect(fakeDelegate.OnCheckBuildStartCallCount()).To(Equal(1))
})

It("update scope's check start time", func() {
Expect(fakeDelegate.UpdateScopeLastCheckStartTimeCallCount()).To(Equal(1))
scope, nestedStep := fakeDelegate.UpdateScopeLastCheckStartTimeArgsForCall(0)
scope := fakeDelegate.UpdateScopeLastCheckStartTimeArgsForCall(0)
Expect(scope).To(Equal(fakeResourceConfigScope))
Expect(nestedStep).To(BeFalse())
})
})

Expand Down Expand Up @@ -495,11 +494,14 @@ var _ = Describe("CheckStep", func() {
Expect(chosenContainer.RunningProcesses()).To(HaveLen(1))
})

It("not call OnCheckBuildStart", func(){
Expect(fakeDelegate.OnCheckBuildStartCallCount()).To(Equal(0))
})

It("update scope's check start time", func() {
Expect(fakeDelegate.UpdateScopeLastCheckStartTimeCallCount()).To(Equal(1))
scope, nestedStep := fakeDelegate.UpdateScopeLastCheckStartTimeArgsForCall(0)
scope := fakeDelegate.UpdateScopeLastCheckStartTimeArgsForCall(0)
Expect(scope).To(Equal(fakeResourceConfigScope))
Expect(nestedStep).To(BeTrue())
})
})

Expand Down
74 changes: 0 additions & 74 deletions atc/exec/execfakes/fake_build_step_delegate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2d5f31f

Please sign in to comment.