本文整理汇总了Golang中github.com/cloudfoundry-incubator/runtime-schema/cc_messages.DesireAppRequestFromCC类的典型用法代码示例。如果您正苦于以下问题:Golang DesireAppRequestFromCC类的具体用法?Golang DesireAppRequestFromCC怎么用?Golang DesireAppRequestFromCC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DesireAppRequestFromCC类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
"github.com/cloudfoundry-incubator/diego-ssh/keys/fake_keys"
"github.com/cloudfoundry-incubator/diego-ssh/routes"
"github.com/cloudfoundry-incubator/nsync/recipebuilder"
"github.com/cloudfoundry-incubator/routing-info/cfroutes"
"github.com/cloudfoundry-incubator/runtime-schema/cc_messages"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pivotal-golang/lager/lagertest"
)
var _ = Describe("Buildpack Recipe Builder", func() {
var (
builder *recipebuilder.BuildpackRecipeBuilder
err error
desiredAppReq cc_messages.DesireAppRequestFromCC
lifecycles map[string]string
egressRules []*models.SecurityGroupRule
fakeKeyFactory *fake_keys.FakeSSHKeyFactory
logger *lagertest.TestLogger
)
defaultNofile := recipebuilder.DefaultFileDescriptorLimit
BeforeEach(func() {
logger = lagertest.NewTestLogger("test")
lifecycles = map[string]string{
"buildpack/some-stack": "some-lifecycle.tgz",
"docker": "the/docker/lifecycle/path.tgz",
}
示例2:
"github.com/cloudfoundry/dropsonde/metric_sender/fake"
"github.com/cloudfoundry/dropsonde/metrics"
"github.com/pivotal-golang/lager/lagertest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
)
var _ = Describe("DesireAppHandler", func() {
var (
logger *lagertest.TestLogger
fakeBBS *fake_bbs.FakeClient
buildpackBuilder *fakes.FakeRecipeBuilder
dockerBuilder *fakes.FakeRecipeBuilder
desireAppRequest cc_messages.DesireAppRequestFromCC
metricSender *fake.FakeMetricSender
request *http.Request
responseRecorder *httptest.ResponseRecorder
)
BeforeEach(func() {
var err error
logger = lagertest.NewTestLogger("test")
fakeBBS = new(fake_bbs.FakeClient)
buildpackBuilder = new(fakes.FakeRecipeBuilder)
dockerBuilder = new(fakes.FakeRecipeBuilder)
routingInfo, err := cc_messages.CCHTTPRoutes{
示例3:
egressRules = []*models.SecurityGroupRule{
{
Protocol: "TCP",
Destinations: []string{"0.0.0.0/0"},
PortRange: &models.PortRange{Start: 80, End: 443},
},
}
fakeKeyFactory = &fake_keys.FakeSSHKeyFactory{}
config := recipebuilder.Config{lifecycles, "http://file-server.com", fakeKeyFactory}
builder = recipebuilder.NewDockerRecipeBuilder(logger, config)
})
Context("Build", func() {
var (
err error
desiredAppReq cc_messages.DesireAppRequestFromCC
desiredLRP *models.DesiredLRP
)
BeforeEach(func() {
routingInfo, err := cc_messages.CCHTTPRoutes{
{Hostname: "route1"},
{Hostname: "route2"},
}.CCRouteInfo()
Expect(err).NotTo(HaveOccurred())
desiredAppReq = cc_messages.DesireAppRequestFromCC{
ProcessGuid: "the-app-guid-the-app-version",
Stack: "some-stack",
StartCommand: "the-start-command with-arguments",
DockerImageUrl: "user/repo:tag",
示例4:
cancel <-chan struct{},
httpClient *http.Client,
fingerprints <-chan []cc_messages.CCDesiredAppFingerprint,
) (<-chan []cc_messages.DesireAppRequestFromCC, <-chan error) {
batch := <-fingerprints
results := []cc_messages.DesireAppRequestFromCC{}
for _, fingerprint := range batch {
routeInfo, err := cc_messages.CCHTTPRoutes{
{Hostname: "host-" + fingerprint.ProcessGuid},
}.CCRouteInfo()
Expect(err).NotTo(HaveOccurred())
lrp := cc_messages.DesireAppRequestFromCC{
ProcessGuid: fingerprint.ProcessGuid,
ETag: fingerprint.ETag,
RoutingInfo: routeInfo,
}
if strings.HasPrefix(fingerprint.ProcessGuid, "docker") {
lrp.DockerImageUrl = "some-image"
}
results = append(results, lrp)
}
desired := make(chan []cc_messages.DesireAppRequestFromCC, 1)
desired <- results
close(desired)
errors := make(chan error, 1)
close(errors)