func (s *Server) PausePipeline(pipelineDB db.PipelineDB) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { err := pipelineDB.Pause() if err != nil { w.WriteHeader(http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) }) }
func (s *Server) PausePipeline(pipelineDB db.PipelineDB) http.Handler { logger := s.logger.Session("pause-pipeline") return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { err := pipelineDB.Pause() if err != nil { logger.Error("failed-to-pause-pipeline", err) w.WriteHeader(http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) }) }
Expect(page.Navigate(homepage())).To(Succeed()) Eventually(page.Find(".job.paused")).Should(BeFound()) // job-detail unpausing Expect(page.Navigate(withPath("/jobs/job-name"))).To(Succeed()) Eventually(page.Find("#job-state.btn-pause")).Should(BeFound()) Expect(page.Find("#job-state.btn-pause").Click()).To(Succeed()) Eventually(page.Find("#job-state.btn-pause.disabled")).Should(BeFound()) Eventually(page.Find("#job-state.btn-pause.enabled")).ShouldNot(BeFound()) }) Describe("paused pipeline", func() { BeforeEach(func() { pipelineDB, err := pipelineDBFactory.BuildWithTeamNameAndName(atc.DefaultTeamName, atc.DefaultPipelineName) Expect(err).NotTo(HaveOccurred()) err = pipelineDB.Pause() Expect(err).NotTo(HaveOccurred()) }) It("displays a blue header", func() { // homepage -> job detail w/build info Expect(page.Navigate(homepage())).To(Succeed()) // we will need to authenticate later to prove it is working for our page Authenticate(page, "admin", "password") Expect(page.Navigate(withPath("jobs/job-name"))).To(Succeed()) // top bar should show the pipeline is paused Eventually(page.Find(".js-groups.paused")).Should(BeFound()) }) })