Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions jobsupervisor/monit_job_supervisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,18 +378,15 @@ var _ = Describe("monitJobSupervisor", func() {
errchan <- monit.StopAndWait()
}()

Eventually(timeService.WatcherCount).Should(Equal(2)) // we hit the pending sleep
advanceTime(timeService, 3*time.Minute, 2) // wait for pending sleep, then advance

client.StatusStatus = fakemonit.FakeMonitStatus{
Services: []boshmonit.Service{
{Monitored: true, Name: "foo", Status: "unknown", Pending: false},
},
}
timeService.Increment(3 * time.Minute)

Eventually(timeService.WatcherCount).Should(Equal(2)) // we hit the stop sleep

timeService.Increment(3 * time.Minute)
advanceTime(timeService, 3*time.Minute, 2) // wait for stop sleep, then advance

Eventually(errchan).Should(Receive(Equal(errors.New("Timed out waiting for services 'foo' to stop after 5 minutes"))))
})
Expand Down
10 changes: 6 additions & 4 deletions jobsupervisor/windows_job_supervisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ var (
)

var _ = AfterSuite(func() {
err := os.RemoveAll(TempDir)
Expect(err).NotTo(HaveOccurred())
Eventually(func() error { return os.RemoveAll(TempDir) }, 2*time.Minute, time.Second).Should(Succeed())
gexec.CleanupBuildArtifacts()

match := func(s string) bool {
Expand Down Expand Up @@ -486,8 +485,11 @@ var _ = Describe("WindowsJobSupervisor", func() {
AfterEach(func() {
Expect(jobSupervisor.Stop()).To(Succeed())
Expect(jobSupervisor.RemoveAllJobs()).To(Succeed())
Eventually(func() error { return fs.RemoveAll(jobDir) }, 60*time.Second).Should(Succeed())
Expect(fs.RemoveAll(logDir)).To(Succeed())
// Windows releases file handles on the service wrapper exe and log
// files asynchronously after the SCM reports services as deleted.
// Use a long timeout with a slow poll to avoid spinning on busy CI.
Eventually(func() error { return fs.RemoveAll(jobDir) }, 2*time.Minute, time.Second).Should(Succeed())
Eventually(func() error { return fs.RemoveAll(logDir) }, 2*time.Minute, time.Second).Should(Succeed())
})

Describe("AddJob", func() {
Expand Down