本文整理匯總了Golang中github.com/cloudfoundry/bosh-init/deployment/manifest.Manifest.Networks方法的典型用法代碼示例。如果您正苦於以下問題:Golang Manifest.Networks方法的具體用法?Golang Manifest.Networks怎麽用?Golang Manifest.Networks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/bosh-init/deployment/manifest.Manifest
的用法示例。
在下文中一共展示了Manifest.Networks方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: describeBuilder
func describeBuilder() {
var mockCtrl *gomock.Controller
BeforeEach(func() {
mockCtrl = gomock.NewController(GinkgoT())
})
AfterEach(func() {
mockCtrl.Finish()
})
var (
logger boshlog.Logger
mockReleaseJobResolver *mock_deployment_release.MockJobResolver
mockDependencyCompiler *mock_state_job.MockDependencyCompiler
mockJobListRenderer *mock_template.MockJobListRenderer
mockCompressor *mock_template.MockRenderedJobListCompressor
mockBlobstore *mock_blobstore.MockBlobstore
stateBuilder Builder
)
BeforeEach(func() {
logger = boshlog.NewLogger(boshlog.LevelNone)
mockReleaseJobResolver = mock_deployment_release.NewMockJobResolver(mockCtrl)
mockDependencyCompiler = mock_state_job.NewMockDependencyCompiler(mockCtrl)
mockJobListRenderer = mock_template.NewMockJobListRenderer(mockCtrl)
mockCompressor = mock_template.NewMockRenderedJobListCompressor(mockCtrl)
mockBlobstore = mock_blobstore.NewMockBlobstore(mockCtrl)
})
Describe("BuildInitialState", func() {
var (
jobName string
instanceID int
deploymentManifest bideplmanifest.Manifest
)
BeforeEach(func() {
jobName = "fake-deployment-job-name"
instanceID = 0
deploymentManifest = bideplmanifest.Manifest{
Name: "fake-deployment-name",
Jobs: []bideplmanifest.Job{
{
Name: "fake-deployment-job-name",
Networks: []bideplmanifest.JobNetwork{
{
Name: "fake-network-name",
StaticIPs: []string{"1.2.3.4"},
},
},
Templates: []bideplmanifest.ReleaseJobRef{
{
Name: "fake-release-job-name",
Release: "fake-release-name",
Properties: &biproperty.Map{
"fake-template-property": "fake-template-property-value",
},
},
},
Properties: biproperty.Map{
"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
},
}
stateBuilder = NewBuilder(
mockReleaseJobResolver,
mockDependencyCompiler,
mockJobListRenderer,
mockCompressor,
mockBlobstore,
logger,
)
})
It("generates an initial apply spec", func() {
state, err := stateBuilder.BuildInitialState(jobName, instanceID, deploymentManifest)
Expect(err).ToNot(HaveOccurred())
Expect(state.ToApplySpec()).To(Equal(bias.ApplySpec{
Deployment: "fake-deployment-name",
Index: 0,
//.........這裏部分代碼省略.........