We no-longer need Exit() on APIServer or Etcd

This commit is contained in:
Hannes Hörl 2018-01-08 12:11:37 +00:00 committed by Gareth Smith
parent 4e6d80ef73
commit a6eb5bc2f5
4 changed files with 0 additions and 20 deletions

View File

@ -181,11 +181,6 @@ func (s *APIServer) Stop() error {
return s.CertDir.Cleanup()
}
// ExitCode returns the exit code of the process, if it has exited. If it hasn't exited yet, ExitCode returns -1.
func (s *APIServer) ExitCode() int {
return s.session.ExitCode()
}
// Buffer implements the gbytes.BufferProvider interface and returns the stdout of the process
func (s *APIServer) Buffer() *gbytes.Buffer {
return s.session.Buffer()

View File

@ -88,18 +88,13 @@ var _ = Describe("Apiserver", func() {
Expect(fakeEtcdProcess.URLCallCount()).To(Equal(1))
Eventually(apiServer).Should(gbytes.Say("Everything is fine"))
Expect(fakeSession.ExitCodeCallCount()).To(Equal(0))
Expect(apiServer).NotTo(gexec.Exit())
Expect(fakeSession.ExitCodeCallCount()).To(Equal(1))
By("Stopping the API Server")
Expect(apiServer.Stop()).To(Succeed())
Expect(cleanupCallCount).To(Equal(1))
Expect(fakeEtcdProcess.StopCallCount()).To(Equal(1))
Expect(apiServer).To(gexec.Exit(143))
Expect(fakeSession.TerminateCallCount()).To(Equal(1))
Expect(fakeSession.ExitCodeCallCount()).To(Equal(2))
})
})

View File

@ -149,11 +149,6 @@ func (e *Etcd) Stop() error {
return e.DataDir.Cleanup()
}
// ExitCode returns the exit code of the process, if it has exited. If it hasn't exited yet, ExitCode returns -1.
func (e *Etcd) ExitCode() int {
return e.session.ExitCode()
}
// Buffer implements the gbytes.BufferProvider interface and returns the stdout of the process
func (e *Etcd) Buffer() *gbytes.Buffer {
return e.session.Buffer()

View File

@ -73,17 +73,12 @@ var _ = Describe("Etcd", func() {
Expect(err).NotTo(HaveOccurred())
Eventually(etcd).Should(gbytes.Say("Everything is dandy"))
Expect(fakeSession.ExitCodeCallCount()).To(Equal(0))
Expect(etcd).NotTo(gexec.Exit())
Expect(fakeSession.ExitCodeCallCount()).To(Equal(1))
By("Stopping the Etcd Server")
Expect(etcd.Stop()).To(Succeed())
Expect(dataDirCleanupCount).To(Equal(1))
Expect(etcd).To(gexec.Exit(143))
Expect(fakeSession.TerminateCallCount()).To(Equal(1))
Expect(fakeSession.ExitCodeCallCount()).To(Equal(2))
})
})