Skip to content

Commit

Permalink
atc: behaviour: add flag to enable archive pipeline
Browse files Browse the repository at this point in the history
#5315 - as per
#5346 (comment),
the ability to archive pipelines is now behind an api flag
`enable-archive-pipeline`.

Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
Co-authored-by: James Thomson <jthomson@pivotal.io>
  • Loading branch information
2 people authored and taylorsilva committed Apr 17, 2020
1 parent 9fd3d48 commit 64b7a9c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions atc/api/pipelineserver/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,25 @@ var _ = Describe("Archive Handler", func() {
Expect(body).To(Equal([]byte("endpoint is not enabled\n")))
})
})

Context("when the endpoint is not enabled", func() {
BeforeEach(func() {
server = pipelineserver.NewServer(
fakeLogger,
new(dbfakes.FakeTeamFactory),
new(dbfakes.FakePipelineFactory),
"",
false, /* enableArchivePipeline */
)
handler = server.ArchivePipeline(dbPipeline)
})

It("responds with status Forbidden", func() {
handler.ServeHTTP(recorder, request)

Expect(recorder.Code).To(Equal(http.StatusForbidden))
body, _ := ioutil.ReadAll(recorder.Body)
Expect(body).To(Equal([]byte("endpoint is not enabled\n")))
})
})
})
1 change: 1 addition & 0 deletions atc/integration/archiving_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func whenIUnpauseIt(client concourse.Client, pipelineName string) {
func whenIArchiveIt(client concourse.Client, pipelineName string) {
_, err := client.Team("main").ArchivePipeline(pipelineName)
Expect(err).ToNot(HaveOccurred())
return response
}

func getPipeline(client concourse.Client, pipelineName string) atc.Pipeline {
Expand Down

0 comments on commit 64b7a9c

Please sign in to comment.