github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/creds/set_pipeline_plan_test.go (about)

     1  package creds_test
     2  
     3  import (
     4  	"github.com/pf-qiu/concourse/v6/atc"
     5  	"github.com/pf-qiu/concourse/v6/atc/creds"
     6  	"github.com/pf-qiu/concourse/v6/vars"
     7  
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  )
    11  
    12  var _ = Describe("Evaluate", func() {
    13  	var plan creds.SetPipelinePlan
    14  
    15  	BeforeEach(func() {
    16  		variables := vars.StaticVariables{
    17  			"pipeline-name": "pn-is",
    18  			"filename":      "fn-is",
    19  			"varfile":       "vf-is",
    20  			"age":           "18",
    21  		}
    22  		plan = creds.NewSetPipelinePlan(variables, atc.SetPipelinePlan{
    23  			Name:     "some-((pipeline-name))-ok",
    24  			File:     "some-((filename))-ok",
    25  			VarFiles: []string{"some-((varfile))-ok"},
    26  			Vars:     map[string]interface{}{"age": "((age))"},
    27  		})
    28  	})
    29  
    30  	Describe("Evaluate", func() {
    31  		It("parses variables", func() {
    32  			result, err := plan.Evaluate()
    33  			Expect(err).NotTo(HaveOccurred())
    34  
    35  			Expect(result).To(Equal(atc.SetPipelinePlan{
    36  				Name:     "some-((pipeline-name))-ok", // Name should not be interpolated.
    37  				File:     "some-fn-is-ok",
    38  				VarFiles: []string{"some-vf-is-ok"},
    39  				Vars:     map[string]interface{}{"age": "18"},
    40  			}))
    41  		})
    42  	})
    43  })