本文整理匯總了Golang中github.com/cloudfoundry-incubator/guardian/gqt/runner.RunningGarden類的典型用法代碼示例。如果您正苦於以下問題:Golang RunningGarden類的具體用法?Golang RunningGarden怎麽用?Golang RunningGarden使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了RunningGarden類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
package gqt_test
import (
"github.com/cloudfoundry-incubator/garden"
"github.com/cloudfoundry-incubator/guardian/gqt/runner"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Properties", func() {
var (
client *runner.RunningGarden
container garden.Container
props garden.Properties
)
BeforeEach(func() {
var err error
client = startGarden()
props = garden.Properties{"somename": "somevalue"}
container, err = client.Create(garden.ContainerSpec{
Properties: props,
})
Expect(err).NotTo(HaveOccurred())
})
AfterEach(func() {
Expect(client.DestroyAndStop()).To(Succeed())
})
It("can get properties", func() {
示例2:
"os/exec"
"path/filepath"
"time"
"github.com/cloudfoundry-incubator/garden"
"github.com/cloudfoundry-incubator/guardian/gqt/runner"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/gexec"
)
var _ = Describe("Destroying a Container", func() {
var (
client *runner.RunningGarden
container garden.Container
)
BeforeEach(func() {
client = startGarden()
})
AfterEach(func() {
Expect(client.DestroyAndStop()).To(Succeed())
})
JustBeforeEach(func() {
Expect(client.Destroy(container.Handle())).To(Succeed())
})
Context("when running a process", func() {
示例3:
"regexp"
"strings"
"time"
"github.com/cloudfoundry-incubator/garden"
"github.com/cloudfoundry-incubator/guardian/gqt/runner"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
)
var _ = Describe("Net", func() {
var (
client *runner.RunningGarden
container garden.Container
subnet string
args []string
)
BeforeEach(func() {
args = []string{}
subnet = fmt.Sprintf("192.168.%d.0/24", 12+GinkgoParallelNode())
})
JustBeforeEach(func() {
var err error
client = startGarden(args...)
container, err = client.Create(garden.ContainerSpec{
示例4:
import (
"io"
"github.com/cloudfoundry-incubator/garden"
"github.com/cloudfoundry-incubator/guardian/gqt/runner"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/gexec"
"github.com/onsi/gomega/types"
)
var _ = Describe("Run", func() {
var client *runner.RunningGarden
AfterEach(func() {
Expect(client.DestroyAndStop()).To(Succeed())
})
DescribeTable("running a process",
func(spec garden.ProcessSpec, matchers ...func(actual interface{})) {
client = startGarden()
container, err := client.Create(garden.ContainerSpec{})
Expect(err).NotTo(HaveOccurred())
out := gbytes.NewBuffer()
proc, err := container.Run(
spec,
garden.ProcessIO{
示例5:
"io/ioutil"
"os"
"path/filepath"
"github.com/cloudfoundry-incubator/garden"
"github.com/cloudfoundry-incubator/guardian/gqt/runner"
. "github.com/cloudfoundry-incubator/guardian/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
archiver "github.com/pivotal-golang/archiver/extractor/test_helper"
)
var _ = Describe("Streaming", func() {
var (
client *runner.RunningGarden
container garden.Container
)
BeforeEach(func() {
var err error
client = startGarden()
container, err = client.Create(garden.ContainerSpec{})
Expect(err).NotTo(HaveOccurred())
})
AfterEach(func() {
Expect(client.DestroyAndStop()).To(Succeed())
})
示例6:
"os"
"os/exec"
"path/filepath"
"strings"
"time"
"github.com/cloudfoundry-incubator/garden"
"github.com/cloudfoundry-incubator/guardian/gqt/runner"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
var _ = Describe("Creating a Container", func() {
var client *runner.RunningGarden
var container garden.Container
Context("after creating a container", func() {
BeforeEach(func() {
client = startGarden()
var err error
container, err = client.Create(garden.ContainerSpec{})
Expect(err).NotTo(HaveOccurred())
})
It("should create a depot subdirectory based on the container handle", func() {
Expect(container.Handle()).NotTo(BeEmpty())
Expect(filepath.Join(client.DepotDir, container.Handle())).To(BeADirectory())
Expect(filepath.Join(client.DepotDir, container.Handle(), "config.json")).To(BeARegularFile())
示例7:
"strings"
"github.com/cloudfoundry-incubator/garden"
"github.com/cloudfoundry-incubator/guardian/gqt/runner"
. "github.com/cloudfoundry-incubator/guardian/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/gexec"
)
var _ = Describe("Creating a Container", func() {
var (
client *runner.RunningGarden
container garden.Container
)
BeforeEach(func() {
client = startGarden()
})
AfterEach(func() {
Expect(client.DestroyAndStop()).To(Succeed())
})
Context("after creating a container without a specified handle", func() {
var initProcPid int
BeforeEach(func() {
var err error
示例8:
package gqt_test
import (
"github.com/cloudfoundry-incubator/guardian/gqt/runner"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Garden API", func() {
var (
args []string
client *runner.RunningGarden
)
BeforeEach(func() {
args = []string{}
})
JustBeforeEach(func() {
client = startGarden(args...)
})
AfterEach(func() {
Expect(client.DestroyAndStop()).To(Succeed())
})
Describe("Capacity", func() {
It("returns json representing capacity", func() {
result, err := client.Capacity()
Expect(err).NotTo(HaveOccurred())