testflight: add set-pipeline test with other team
We are adding the "team" attribute to the "set-pipeline" step
Add a test that uses a normal team to set the main team's pipeline
unsuccessfully
@@ -58,6 +58,9 @@ jobs:
const pipelineContentWithTeam = pipelineContent + `
team: ` + teamName
+ const pipelineContentWithMainTeam = pipelineContent + `
+ team: main`
+
var (
fixture string
currentPipelineContent string
@@ -154,4 +157,38 @@ jobs:
})
})
})
+
+ Context("when setting the main team's pipeline from a normal team", func() {
+ BeforeEach(func() {
+ currentPipelineContent = pipelineContentWithMainTeam
+ currentFlyTarget = testflightFlyTarget
+ })
+
+ It("fails to set the other pipeline", func() {
+ By("second pipeline should initially not exist")
+ withFlyTarget(adminFlyTarget, func() {
+ execS := spawnFly("get-pipeline", "-p", secondPipelineName)
+ <-execS.Exited
+ Expect(execS).To(gexec.Exit(1))
+ Expect(execS.Err).To(gbytes.Say("pipeline not found"))
+ })
+
+ By("set-pipeline step should fail")
+ withFlyTarget(testflightFlyTarget, func() {
+ execS := spawnFly("trigger-job", "-w", "-j", pipelineName+"/sp")
+ <-execS.Exited
+ Expect(execS).To(gexec.Exit(2))
+ Expect(execS.Out).To(gbytes.Say("only main team can set another team's pipeline"))
+ Expect(execS.Out).To(gbytes.Say("errored"))
+ })
+
+ By("second pipeline should still not exist")
+ withFlyTarget(adminFlyTarget, func() {
+ execS := spawnFly("get-pipeline", "-p", secondPipelineName)
+ <-execS.Exited
+ Expect(execS).To(gexec.Exit(1))
+ Expect(execS.Err).To(gbytes.Say("pipeline not found"))
+ })
+ })
+ })
})
