test that we submit remaining vars uninterpolated
concourse/concourse#291
@@ -486,7 +486,61 @@ this is super secure
})
Context("when a var is not specified", func() {
- It("fails", func() {
+ BeforeEach(func() {
+ config = atc.Config{
+ Resources: atc.ResourceConfigs{
+ {
+ Name: "some-resource",
+ Type: "some-type",
+ Tags: atc.Tags{"val-1", "val-2"},
+ Source: atc.Source{
+ "private_key": `-----BEGIN SOME KEY-----
+this is super secure
+-----END SOME KEY-----
+`,
+ "config-a": "some-param-a",
+ "config-b": "((param-b))",
+ "bool": true,
+ },
+ },
+ },
+
+ Jobs: atc.JobConfigs{
+ {
+ Name: "some-job",
+ Plan: atc.PlanSequence{
+ {
+ Get: "some-resource",
+ },
+ },
+ },
+ },
+ }
+
+ path, err := atc.Routes.CreatePathForRoute(atc.SaveConfig, rata.Params{"pipeline_name": "awesome-pipeline", "team_name": "main"})
+ Expect(err).NotTo(HaveOccurred())
+
+ atcServer.RouteToHandler("PUT", path,
+ ghttp.CombineHandlers(
+ ghttp.VerifyHeaderKV(atc.ConfigVersionHeader, "42"),
+ func(w http.ResponseWriter, r *http.Request) {
+ bodyConfig := getConfig(r)
+
+ receivedConfig := atc.Config{}
+ err = yaml.Unmarshal(bodyConfig, &receivedConfig)
+ Expect(err).NotTo(HaveOccurred())
+
+ Expect(receivedConfig).To(Equal(config))
+
+ w.WriteHeader(http.StatusOK)
+ w.Write([]byte(`{}`))
+ },
+ ),
+ )
+ })
+
+ It("succeeds, sending the remaining vars uninterpolated", func() {
+ Expect(func() {
flyCmd := exec.Command(
flyPath, "-t", targetName,
"set-pipeline",
@@ -500,8 +554,10 @@ this is super secure
sess, err := gexec.Start(flyCmd, GinkgoWriter, GinkgoWriter)
Expect(err).NotTo(HaveOccurred())
<-sess.Exited
- Expect(sess.ExitCode()).To(Equal(1))
- Expect(sess.Err).To(gbytes.Say("param-b"))
+ Expect(sess.ExitCode()).To(Equal(0))
+ }).To(Change(func() int {
+ return len(atcServer.ReceivedRequests())
+ }).By(3))
})
})
})
