本文整理匯總了Golang中github.com/cloudfoundry-incubator/runtime-schema/models.ActualLRP類的典型用法代碼示例。如果您正苦於以下問題:Golang ActualLRP類的具體用法?Golang ActualLRP怎麽用?Golang ActualLRP使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ActualLRP類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: itValidatesPresenceOfPlacementError
func itValidatesPresenceOfPlacementError(lrp *models.ActualLRP) {
Context("when placement error is set", func() {
BeforeEach(func() {
lrp.PlacementError = "insufficient capacity"
})
It("validate does not return an error", func() {
Expect(lrp.Validate()).NotTo(HaveOccurred())
})
})
Context("when placement error is not set", func() {
BeforeEach(func() {
lrp.PlacementError = ""
})
It("validate does not return an error", func() {
Expect(lrp.Validate()).NotTo(HaveOccurred())
})
})
}
示例2: itValidatesAbsenceOfPlacementError
func itValidatesAbsenceOfPlacementError(lrp *models.ActualLRP) {
Context("when placement error is set", func() {
BeforeEach(func() {
lrp.PlacementError = "insufficient capacity"
})
It("validate returns an error", func() {
err := lrp.Validate()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("placement error"))
})
})
Context("when placement error is not set", func() {
BeforeEach(func() {
lrp.PlacementError = ""
})
It("validate does not return an error", func() {
Expect(lrp.Validate()).NotTo(HaveOccurred())
})
})
}
示例3: itValidatesAbsenceOfNetInfo
func itValidatesAbsenceOfNetInfo(lrp *models.ActualLRP) {
Context("when net info is set", func() {
BeforeEach(func() {
lrp.ActualLRPNetInfo = models.NewActualLRPNetInfo("1.2.3.4", []models.PortMapping{})
})
It("validate returns an error", func() {
err := lrp.Validate()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("net info"))
})
})
Context("when net info is not set", func() {
BeforeEach(func() {
lrp.ActualLRPNetInfo = models.ActualLRPNetInfo{}
})
It("validate does not return an error", func() {
Expect(lrp.Validate()).NotTo(HaveOccurred())
})
})
}
示例4: itValidatesAbsenceOfTheInstanceKey
func itValidatesAbsenceOfTheInstanceKey(lrp *models.ActualLRP) {
Context("when the instance key is set", func() {
BeforeEach(func() {
lrp.ActualLRPInstanceKey = models.NewActualLRPInstanceKey("some-instance", "some-cell")
})
It("validate returns an error", func() {
err := lrp.Validate()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("instance key"))
})
})
Context("when the instance key is not set", func() {
BeforeEach(func() {
lrp.ActualLRPInstanceKey = models.ActualLRPInstanceKey{}
})
It("validate does not return an error", func() {
Expect(lrp.Validate()).NotTo(HaveOccurred())
})
})
}
示例5: itValidatesPresenceOfTheLRPKey
func itValidatesPresenceOfTheLRPKey(lrp *models.ActualLRP) {
Context("when the lrp key is set", func() {
BeforeEach(func() {
lrp.ActualLRPKey = models.NewActualLRPKey("some-guid", 1, "domain")
})
It("validate does not return an error", func() {
Expect(lrp.Validate()).NotTo(HaveOccurred())
})
})
Context("when the lrp key is not set", func() {
BeforeEach(func() {
lrp.ActualLRPKey = models.ActualLRPKey{}
})
It("validate returns an error", func() {
err := lrp.Validate()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("process_guid"))
})
})
}
示例6:
oldmodels "github.com/cloudfoundry-incubator/runtime-schema/models"
"github.com/gogo/protobuf/proto"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pivotal-golang/lager"
)
var _ = Describe("Actual LRP Handlers", func() {
var (
logger lager.Logger
fakeLegacyBBS *fake_legacy_bbs.FakeReceptorBBS
fakeBBS *fake_bbs.FakeClient
responseRecorder *httptest.ResponseRecorder
handler *handlers.ActualLRPHandler
oldActualLRP1 oldmodels.ActualLRP
oldActualLRP2 oldmodels.ActualLRP
oldEvacuatingLRP2 oldmodels.ActualLRP
actualLRP1 models.ActualLRP
actualLRP2 models.ActualLRP
evacuatingLRP2 models.ActualLRP
)
BeforeEach(func() {
fakeLegacyBBS = new(fake_legacy_bbs.FakeReceptorBBS)
fakeBBS = new(fake_bbs.FakeClient)
logger = lager.NewLogger("test")
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))
responseRecorder = httptest.NewRecorder()
handler = handlers.NewActualLRPHandler(fakeBBS, fakeLegacyBBS, logger)
示例7:
Expect(netInfo.Address).To(BeEmpty())
Expect(netInfo.Ports).NotTo(BeNil())
Expect(netInfo.Ports).To(HaveLen(0))
})
})
})
})
Describe("ActualLRPGroup", func() {
Describe("Resolve", func() {
var (
instanceLRP *models.ActualLRP
evacuatingLRP *models.ActualLRP
group models.ActualLRPGroup
resolvedLRP *models.ActualLRP
evacuating bool
resolveErr error
)
BeforeEach(func() {
lrpKey := models.NewActualLRPKey("process-guid", 1, "domain")
instanceLRP = &models.ActualLRP{
ActualLRPKey: lrpKey,
Since: 1138,
}
evacuatingLRP = &models.ActualLRP{
ActualLRPKey: lrpKey,
Since: 3417,
}
示例8:
"github.com/cloudfoundry-incubator/receptor/handlers"
"github.com/cloudfoundry-incubator/receptor/serialization"
"github.com/cloudfoundry-incubator/runtime-schema/bbs/bbserrors"
"github.com/cloudfoundry-incubator/runtime-schema/bbs/fake_bbs"
"github.com/cloudfoundry-incubator/runtime-schema/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pivotal-golang/lager"
)
var _ = Describe("Actual LRP Handlers", func() {
var (
logger lager.Logger
fakeBBS *fake_bbs.FakeReceptorBBS
responseRecorder *httptest.ResponseRecorder
handler *handlers.ActualLRPHandler
actualLRP1 models.ActualLRP
actualLRP2 models.ActualLRP
evacuatingLRP2 models.ActualLRP
)
BeforeEach(func() {
fakeBBS = new(fake_bbs.FakeReceptorBBS)
logger = lager.NewLogger("test")
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))
responseRecorder = httptest.NewRecorder()
handler = handlers.NewActualLRPHandler(fakeBBS, logger)
actualLRP1 = models.ActualLRP{
ActualLRPKey: models.NewActualLRPKey(
"process-guid-0",
示例9:
package serialization_test
import (
"github.com/cloudfoundry-incubator/receptor"
"github.com/cloudfoundry-incubator/receptor/serialization"
"github.com/cloudfoundry-incubator/runtime-schema/diego_errors"
"github.com/cloudfoundry-incubator/runtime-schema/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("ActualLRP Serialization", func() {
Describe("ActualLRPToResponse", func() {
var actualLRP models.ActualLRP
BeforeEach(func() {
actualLRP = models.ActualLRP{
ActualLRPKey: models.NewActualLRPKey(
"process-guid-0",
3,
"some-domain",
),
ActualLRPInstanceKey: models.NewActualLRPInstanceKey(
"instance-guid-0",
"cell-id-0",
),
ActualLRPNetInfo: models.NewActualLRPNetInfo(
"address-0",
[]models.PortMapping{
{
ContainerPort: 2345,