本文整理匯總了Golang中github.com/cloudfoundry/bosh-init/release/fakes.FakeRelease.ReleaseJobs方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeRelease.ReleaseJobs方法的具體用法?Golang FakeRelease.ReleaseJobs怎麽用?Golang FakeRelease.ReleaseJobs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/bosh-init/release/fakes.FakeRelease
的用法示例。
在下文中一共展示了FakeRelease.ReleaseJobs方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: rootDesc
//.........這裏部分代碼省略.........
fakeUUIDGenerator = &fakeuuid.FakeGenerator{}
var err error
manifestSHA1, err = sha1Calculator.Calculate(deploymentManifestPath)
Expect(err).ToNot(HaveOccurred())
cpiReleaseTarballPath = "/release/tarball/path"
stemcellTarballPath = "/stemcell/tarball/path"
extractedStemcell = bistemcell.NewExtractedStemcell(
bistemcell.Manifest{
ImagePath: "/stemcell/image/path",
Name: "fake-stemcell-name",
Version: "fake-stemcell-version",
SHA1: "fake-stemcell-sha1",
CloudProperties: biproperty.Map{},
OS: "ubuntu-trusty",
},
"fake-extracted-path",
fakeFs,
)
// create input files
fakeFs.WriteFileString(cpiReleaseTarballPath, "")
fakeFs.WriteFileString(stemcellTarballPath, "")
// deployment exists
fakeFs.WriteFileString(deploymentManifestPath, "")
// deployment is valid
fakeDeploymentValidator.SetValidateBehavior([]fakebideplval.ValidateOutput{
{Err: nil},
})
fakeDeploymentValidator.SetValidateReleaseJobsBehavior([]fakebideplval.ValidateReleaseJobsOutput{
{Err: nil},
})
// stemcell exists
fakeFs.WriteFile(stemcellTarballPath, []byte{})
releaseSetManifest = birelsetmanifest.Manifest{
Releases: []birelmanifest.ReleaseRef{
{
Name: "fake-cpi-release-name",
URL: "file://" + cpiReleaseTarballPath,
},
},
}
// parsed CPI deployment manifest
installationManifest = biinstallmanifest.Manifest{
Template: biinstallmanifest.ReleaseJobRef{
Name: "fake-cpi-release-job-name",
Release: "fake-cpi-release-name",
},
Mbus: mbusURL,
}
// parsed BOSH deployment manifest
boshDeploymentManifest = bideplmanifest.Manifest{
Name: "fake-deployment-name",
Jobs: []bideplmanifest.Job{
{
Name: "fake-job-name",
},
},
示例2:
"fake-prop-map-key": biproperty.Map{
"fake-prop-key": "fake-prop-value",
},
},
}
validReleaseSetManifest = birelsetmanifest.Manifest{
Releases: []birelmanifest.ReleaseRef{
{
Name: "fake-release-name",
},
},
}
fakeRelease = fakebirel.New("fake-release-name", "1.0")
fakeRelease.ReleaseJobs = []bireljob.Job{{Name: "fake-job-name"}}
releaseManager.Add(fakeRelease)
validator = NewValidator(logger)
})
Describe("Validate", func() {
It("does not error if deployment is valid", func() {
deploymentManifest := validManifest
err := validator.Validate(deploymentManifest, validReleaseSetManifest)
Expect(err).ToNot(HaveOccurred())
})
It("validates name is not empty", func() {
deploymentManifest := Manifest{
Name: "",
示例3:
fakeRelease = fake_release.New("fake-release-name", "fake-release-version")
fakeReleaseJob0 = bireljob.Job{
Name: "fake-release-job-name-0",
Fingerprint: "fake-release-job-fingerprint-0",
}
fakeReleaseJob1 = bireljob.Job{
Name: "fake-release-job-name-1",
Fingerprint: "fake-release-job-fingerprint-1",
}
})
JustBeforeEach(func() {
jobResolver = NewJobResolver(mockReleaseManager)
fakeRelease.ReleaseJobs = []bireljob.Job{fakeReleaseJob0, fakeReleaseJob1}
})
Describe("Resolve", func() {
It("Returns the matching release job", func() {
mockReleaseManager.EXPECT().Find("fake-release-name").Return(fakeRelease, true)
releaseJob, err := jobResolver.Resolve("fake-release-job-name-0", "fake-release-name")
Expect(err).ToNot(HaveOccurred())
Expect(releaseJob).To(Equal(fakeReleaseJob0))
})
It("Returns an error, when the job is not in the release", func() {
mockReleaseManager.EXPECT().Find("fake-release-name").Return(fakeRelease, true)
_, err := jobResolver.Resolve("fake-missing-release-job-name", "fake-release-name")