本文整理汇总了Golang中github.com/cloudfoundry/bosh-init/release/pkg.Package.Dependencies方法的典型用法代码示例。如果您正苦于以下问题:Golang Package.Dependencies方法的具体用法?Golang Package.Dependencies怎么用?Golang Package.Dependencies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/bosh-init/release/pkg.Package
的用法示例。
在下文中一共展示了Package.Dependencies方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: describeBuilder
//.........这里部分代码省略.........
"fake-job-property": "fake-job-property-value",
},
},
},
Networks: []bideplmanifest.Network{
{
Name: "fake-network-name",
Type: "fake-network-type",
CloudProperties: biproperty.Map{
"fake-network-cloud-property": "fake-network-cloud-property-value",
},
},
},
Properties: biproperty.Map{
"fake-job-property": "fake-global-property-value", //overridden by job property value
},
}
fakeStage = fakebiui.NewFakeStage()
stateBuilder = NewBuilder(
mockReleaseJobResolver,
mockDependencyCompiler,
mockJobListRenderer,
mockCompressor,
mockBlobstore,
logger,
)
releasePackageLibyaml = &birelpkg.Package{
Name: "libyaml",
Fingerprint: "fake-package-source-fingerprint-libyaml",
SHA1: "fake-package-source-sha1-libyaml",
Dependencies: []*birelpkg.Package{},
ArchivePath: "fake-package-archive-path-libyaml", // only required by compiler...
}
releasePackageRuby = &birelpkg.Package{
Name: "ruby",
Fingerprint: "fake-package-source-fingerprint-ruby",
SHA1: "fake-package-source-sha1-ruby",
Dependencies: []*birelpkg.Package{releasePackageLibyaml},
ArchivePath: "fake-package-archive-path-ruby", // only required by compiler...
}
releasePackageCPI = &birelpkg.Package{
Name: "cpi",
Fingerprint: "fake-package-source-fingerprint-cpi",
SHA1: "fake-package-source-sha1-cpi",
Dependencies: []*birelpkg.Package{releasePackageRuby},
ArchivePath: "fake-package-archive-path-cpi", // only required by compiler...
}
})
JustBeforeEach(func() {
releaseJob := bireljob.Job{
Name: "fake-release-job-name",
Fingerprint: "fake-release-job-source-fingerprint",
Packages: []*birelpkg.Package{releasePackageCPI, releasePackageRuby},
}
mockReleaseJobResolver.EXPECT().Resolve("fake-release-job-name", "fake-release-name").Return(releaseJob, nil)
releaseJobs := []bireljob.Job{releaseJob}
compiledPackageRefs := []bistatejob.CompiledPackageRef{
{
Name: "libyaml",
Version: "fake-package-source-fingerprint-libyaml",
BlobstoreID: "fake-package-compiled-archive-blob-id-libyaml",
示例2:
package pkg_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-init/state/pkg"
birelpkg "github.com/cloudfoundry/bosh-init/release/pkg"
)
var _ = Describe("DependencyResolver", func() {
It("supports a single dependency", func() {
a := birelpkg.Package{Name: "a"}
b := birelpkg.Package{Name: "b"}
a.Dependencies = []*birelpkg.Package{&b}
deps := ResolveDependencies(&a)
Expect(deps).To(Equal([]*birelpkg.Package{&b}))
})
It("supports a transitive dependency", func() {
a := birelpkg.Package{Name: "a"}
b := birelpkg.Package{Name: "b"}
a.Dependencies = []*birelpkg.Package{&b}
c := birelpkg.Package{Name: "c"}
b.Dependencies = []*birelpkg.Package{&c}
deps := ResolveDependencies(&a)
Expect(deps).To(Equal([]*birelpkg.Package{&c, &b}))
})
示例3:
_, found, err = compiledPackageRepo.Find(pkg)
Expect(err).ToNot(HaveOccurred())
Expect(found).To(BeFalse())
})
It("returns true if dependency order changed", func() {
dependency1 := birelpkg.Package{
Name: "fake-package-1",
Fingerprint: "fake-dependency-fingerprint-1",
}
dependency2 := birelpkg.Package{
Name: "fake-package-2",
Fingerprint: "fake-dependency-fingerprint-2",
}
pkg.Dependencies = []*birelpkg.Package{&dependency1, &dependency2}
err := compiledPackageRepo.Save(pkg, record)
Expect(err).ToNot(HaveOccurred())
pkg.Dependencies = []*birelpkg.Package{&dependency2, &dependency1}
result, found, err := compiledPackageRepo.Find(pkg)
Expect(err).ToNot(HaveOccurred())
Expect(found).To(BeTrue())
Expect(result).To(Equal(record))
})
It("returns false if a transitive dependency has changed after saving", func() {
transitive := birelpkg.Package{
Name: "fake-transitive-package",
示例4:
package pkg_test
import (
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
birelpkg "github.com/cloudfoundry/bosh-init/release/pkg"
. "github.com/cloudfoundry/bosh-init/state/pkg"
)
var _ = Describe("DependencyResolver", func() {
It("supports a single dependency", func() {
a := birelpkg.Package{Name: "a"}
b := birelpkg.Package{Name: "b"}
a.Dependencies = []*birelpkg.Package{&b}
deps := ResolveDependencies(&a)
Expect(deps).To(Equal([]*birelpkg.Package{&b}))
})
It("supports a transitive dependency", func() {
a := birelpkg.Package{Name: "a"}
b := birelpkg.Package{Name: "b"}
a.Dependencies = []*birelpkg.Package{&b}
c := birelpkg.Package{Name: "c"}
b.Dependencies = []*birelpkg.Package{&c}
deps := ResolveDependencies(&a)
Expect(deps).To(ContainElement(&b))
Expect(deps).To(ContainElement(&c))
Expect(len(deps)).To(Equal(2))
示例5:
)
BeforeEach(func() {
package1 = &birelpkg.Package{
Name: "fake-package-name-1",
Dependencies: []*birelpkg.Package{},
}
package2 = &birelpkg.Package{
Name: "fake-package-name-2",
Dependencies: []*birelpkg.Package{package1},
}
package3 = &birelpkg.Package{
Name: "fake-package-name-3",
Dependencies: []*birelpkg.Package{package2},
}
package1.Dependencies = append(package1.Dependencies, package3)
releaseJob = bireljob.Job{
Name: "cpi",
Fingerprint: "fake-release-job-fingerprint",
SHA1: "fake-release-job-sha1",
ExtractedPath: "/extracted-release-path/extracted_jobs/cpi",
Templates: map[string]string{
"cpi.erb": "bin/cpi",
"cpi.yml.erb": "config/cpi.yml",
},
PackageNames: []string{releasePackage2.Name},
Packages: []*birelpkg.Package{package1, package2, package3},
Properties: map[string]bireljob.PropertyDefinition{},
}