当前位置: 首页>>代码示例>>Golang>>正文


Golang LinuxContainer.Start方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry-incubator/garden-linux/linux_container.LinuxContainer.Start方法的典型用法代码示例。如果您正苦于以下问题:Golang LinuxContainer.Start方法的具体用法?Golang LinuxContainer.Start怎么用?Golang LinuxContainer.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry-incubator/garden-linux/linux_container.LinuxContainer的用法示例。


在下文中一共展示了LinuxContainer.Start方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

	It("sets the container handle", func() {
		Expect(container.Handle()).To(Equal("some-handle"))
	})

	It("sets the container subvolume path", func() {
		Expect(container.RootFSPath()).To(Equal("some-volume-path"))
	})

	It("sets the container grace time", func() {
		Expect(container.GraceTime()).To(Equal(1 * time.Second))
	})

	Describe("Starting", func() {
		It("should setup IPTables", func() {
			err := container.Start()
			Expect(err).ToNot(HaveOccurred())

			Expect(fakeIPTablesManager.ContainerSetupCallCount()).To(Equal(1))
			id, bridgeIface, ip, network := fakeIPTablesManager.ContainerSetupArgsForCall(0)
			Expect(id).To(Equal("some-id"))
			Expect(bridgeIface).To(Equal("some-bridge"))
			Expect(err).ToNot(HaveOccurred())
			Expect(ip).To(Equal(containerResources.Network.IP))
			Expect(network).To(Equal(containerResources.Network.Subnet))
		})

		Context("when IPTables setup fails", func() {
			JustBeforeEach(func() {
				fakeIPTablesManager.ContainerSetupReturns(errors.New("oh yes!"))
			})
开发者ID:nagyistoce,项目名称:garden-linux,代码行数:30,代码来源:linux_container_test.go

示例2:

	It("sets the container handle", func() {
		Expect(container.Handle()).To(Equal("some-handle"))
	})

	It("sets the container subvolume path", func() {
		Expect(container.RootFSPath()).To(Equal("some-volume-path"))
	})

	It("sets the container grace time", func() {
		Expect(container.GraceTime()).To(Equal(1 * time.Second))
	})

	Describe("Starting", func() {
		It("executes the container's start.sh with the correct environment", func() {
			err := container.Start()
			Expect(err).ToNot(HaveOccurred())

			Expect(fakeRunner).To(HaveExecutedSerially(
				fake_command_runner.CommandSpec{
					Path: containerDir + "/start.sh",
					Env: []string{
						"id=some-id",
						"PATH=" + os.Getenv("PATH"),
					},
				},
			))
		})

		It("changes the container's state to active", func() {
			Expect(container.State()).To(Equal(linux_backend.StateBorn))
开发者ID:guanglinlv,项目名称:garden-linux,代码行数:30,代码来源:linux_container_test.go

示例3:

			ByteHard: 24,
		}

		bandwidthLimits := garden.BandwidthLimits{
			RateInBytesPerSecond:      1,
			BurstRateInBytesPerSecond: 2,
		}

		cpuLimits := garden.CPULimits{
			LimitInShares: 1,
		}

		JustBeforeEach(func() {
			var err error

			err = container.Start()
			Expect(err).ToNot(HaveOccurred())

			_, _, err = container.NetIn(1, 2)
			Expect(err).ToNot(HaveOccurred())

			_, _, err = container.NetIn(3, 4)
			Expect(err).ToNot(HaveOccurred())

			container.NetOut(netOutRule1)
			container.NetOut(netOutRule2)

			p1 := new(wfakes.FakeProcess)
			p1.IDReturns("1")

			p2 := new(wfakes.FakeProcess)
开发者ID:nagyistoce,项目名称:garden-linux,代码行数:31,代码来源:snapshotting_test.go


注:本文中的github.com/cloudfoundry-incubator/garden-linux/linux_container.LinuxContainer.Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。