本文整理汇总了Golang中github.com/cloudfoundry-incubator/garden/warden.Container类的典型用法代码示例。如果您正苦于以下问题:Golang Container类的具体用法?Golang Container怎么用?Golang Container使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Container类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1:
package lifecycle_test
import (
"time"
"github.com/cloudfoundry-incubator/garden/warden"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("A container with a grace time", func() {
var container warden.Container
BeforeEach(func() {
err := runner.Stop()
Expect(err).ToNot(HaveOccurred())
err = runner.Start("--containerGraceTime", "5s")
Expect(err).ToNot(HaveOccurred())
container, err = client.Create(warden.ContainerSpec{})
Expect(err).ToNot(HaveOccurred())
})
AfterEach(func() {
err := runner.Stop()
Expect(err).ToNot(HaveOccurred())
err = runner.Start()
Expect(err).ToNot(HaveOccurred())
})
开发者ID:vito,项目名称:warden-linux,代码行数:31,代码来源:grace_time_test.go
示例2:
package lifecycle_test
import (
"github.com/cloudfoundry-incubator/garden/warden"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("A container with properties", func() {
var container warden.Container
BeforeEach(func() {
var err error
container, err = client.Create(warden.ContainerSpec{
Properties: warden.Properties{
"foo": "bar",
"a": "b",
},
})
Expect(err).ToNot(HaveOccurred())
})
AfterEach(func() {
err := client.Destroy(container.Handle())
Expect(err).ToNot(HaveOccurred())
})
Describe("when reporting the container's info", func() {
It("includes the properties", func() {
info, err := container.Info()
开发者ID:vito,项目名称:warden-linux,代码行数:31,代码来源:properties_test.go
示例3:
import (
"fmt"
"runtime"
"sync/atomic"
"time"
"github.com/cloudfoundry-incubator/garden/warden"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("The Warden server", func() {
runtime.GOMAXPROCS(runtime.NumCPU())
Describe("streaming output from a chatty job", func() {
var container warden.Container
BeforeEach(func() {
var err error
container, err = client.Create(warden.ContainerSpec{})
Expect(err).ToNot(HaveOccurred())
})
streamCounts := []int{0}
for i := 1; i <= 128; i *= 2 {
streamCounts = append(streamCounts, i)
}
for _, streams := range streamCounts {
开发者ID:vito,项目名称:warden-linux,代码行数:31,代码来源:stream_measure_test.go
示例4: reapContainer
func (s *WardenServer) reapContainer(container warden.Container) {
log.Printf("reaping %s (idle for %s)\n", container.Handle(), s.backend.GraceTime(container))
s.backend.Destroy(container.Handle())
}
开发者ID:vito,项目名称:warden-docker,代码行数:4,代码来源:server.go
示例5:
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"time"
"github.com/cloudfoundry-incubator/garden/warden"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
archiver "github.com/pivotal-golang/archiver/extractor/test_helper"
)
var _ = Describe("Creating a container", func() {
var container warden.Container
BeforeEach(func() {
var err error
container, err = client.Create(warden.ContainerSpec{})
Expect(err).ToNot(HaveOccurred())
})
AfterEach(func() {
err := client.Destroy(container.Handle())
Expect(err).ToNot(HaveOccurred())
})
It("sources /etc/seed", func() {
_, stream, err := container.Run(warden.ProcessSpec{
开发者ID:vito,项目名称:warden-linux,代码行数:31,代码来源:lifecycle_test.go
示例6:
_, err := linuxBackend.Create(warden.ContainerSpec{})
Expect(err).To(HaveOccurred())
containers, err := linuxBackend.Containers(nil)
Expect(err).ToNot(HaveOccurred())
Expect(containers).To(BeEmpty())
})
})
})
var _ = Describe("Destroy", func() {
var fakeContainerPool *fake_container_pool.FakeContainerPool
var linuxBackend *linux_backend.LinuxBackend
var container warden.Container
BeforeEach(func() {
fakeContainerPool = fake_container_pool.New()
fakeSystemInfo := fake_system_info.NewFakeProvider()
linuxBackend = linux_backend.New(fakeContainerPool, fakeSystemInfo, "")
newContainer, err := linuxBackend.Create(warden.ContainerSpec{})
Expect(err).ToNot(HaveOccurred())
container = newContainer
})
It("removes the given container from the pool", func() {
Expect(fakeContainerPool.DestroyedContainers).To(BeEmpty())
开发者ID:vito,项目名称:warden-docker,代码行数:30,代码来源:linux_backend_test.go
示例7:
"errors"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"io"
"io/ioutil"
"strings"
. "github.com/cloudfoundry-incubator/garden/client"
"github.com/cloudfoundry-incubator/garden/client/connection"
"github.com/cloudfoundry-incubator/garden/client/connection/fake_connection"
"github.com/cloudfoundry-incubator/garden/warden"
)
var _ = Describe("Container", func() {
var connectionProvider ConnectionProvider
var container warden.Container
var fakeConnection *fake_connection.FakeConnection
BeforeEach(func() {
fakeConnection = fake_connection.New()
connectionProvider = &FakeConnectionProvider{
Connection: fakeConnection,
}
})
JustBeforeEach(func() {
var err error
client := New(connectionProvider)
开发者ID:vito,项目名称:warden-linux,代码行数:31,代码来源:container_test.go
示例8:
"strings"
"github.com/cloudfoundry-incubator/garden/warden"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Placing limits on containers", func() {
Describe("denying access to network ranges", func() {
var (
blockedListener warden.Container
blockedListenerIP string
unblockedListener warden.Container
unblockedListenerIP string
allowedListener warden.Container
allowedListenerIP string
sender warden.Container
)
BeforeEach(func() {
var err error
// create a listener to which we deny network access
blockedListener, err = client.Create(warden.ContainerSpec{})
Expect(err).ToNot(HaveOccurred())
info, err := blockedListener.Info()
Expect(err).ToNot(HaveOccurred())
blockedListenerIP = info.ContainerIP
开发者ID:vito,项目名称:warden-linux,代码行数:32,代码来源:security_test.go
示例9:
stdout += string(payload.Data)
case warden.ProcessStreamSourceStderr:
stderr += string(payload.Data)
}
if payload.ExitStatus != nil {
exitStatus = *payload.ExitStatus
}
}
return stdout, stderr, exitStatus
}
var _ = Describe("Through a restart", func() {
var container warden.Container
BeforeEach(func() {
var err error
container, err = client.Create(warden.ContainerSpec{})
Expect(err).ToNot(HaveOccurred())
})
AfterEach(func() {
err := runner.Stop()
Expect(err).ToNot(HaveOccurred())
err = runner.DestroyContainers()
Expect(err).ToNot(HaveOccurred())
开发者ID:vito,项目名称:warden-linux,代码行数:30,代码来源:drain_test.go
注:本文中的github.com/cloudfoundry-incubator/garden/warden.Container类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论