コード例 #1
0
func (s *stemcellComparator) Compare(previousInputs []bftinput.Input, currentInput bftinput.Input) []bftexpectation.Expectation {
	mostRecentInput := previousInputs[len(previousInputs)-1]
	expectations := []bftexpectation.Expectation{}
	for _, job := range currentInput.Jobs {
		if s.jobStemcellChanged(job, currentInput, mostRecentInput) {
			expectations = append(expectations, bftexpectation.NewExistingInstanceDebugLog("stemcell_changed?", job.Name))
		}
	}

	return expectations
}
						Alias:   "fake-stemcell",
						Version: "2",
					},
				},
				Jobs: []bftinput.Job{
					{
						Name:     "foo-job",
						Stemcell: "fake-stemcell",
					},
				},
			}
		})

		It("returns debug log expectation", func() {
			expectations := stemcellComparator.Compare(previousInputs, currentInput)
			expectedDebugLogExpectation := bftexpectation.NewExistingInstanceDebugLog("stemcell_changed?", "foo-job")
			Expect(expectations).To(ContainElement(expectedDebugLogExpectation))
		})
	})

	Context("when there are same jobs that have different stemcell versions using resource pools", func() {
		BeforeEach(func() {
			previousInputs = []bftinput.Input{
				{
					CloudConfig: bftinput.CloudConfig{
						ResourcePools: []bftinput.ResourcePoolConfig{
							{
								Name: "fake-resource-pool",
								Stemcell: bftinput.StemcellConfig{
									Name:    "fake-stemcell",
									Version: "1",