コード例 #1
0
ファイル: bundle_test.go プロジェクト: cloudfoundry/guardian
				},
				{
					HostID:      1,
					ContainerID: 1,
					Size:        39999,
				},
			}
			returnedBundle := initialBundle.WithGIDMappings(gidMappings...)

			Expect(returnedBundle.GIDMappings()).To(Equal(gidMappings))
		})
	})

	Describe("WithDevices", func() {
		BeforeEach(func() {
			returnedBundle = initialBundle.WithDevices(specs.LinuxDevice{Path: "test/path"})
		})

		It("returns a bundle with the namespaces added to the runtime spec", func() {
			Expect(returnedBundle.Spec.Linux.Devices).To(ConsistOf(specs.LinuxDevice{Path: "test/path"}))
		})

		Context("when the spec already contains namespaces", func() {
			It("replaces them", func() {
				overridenBundle := returnedBundle.WithDevices(specs.LinuxDevice{Path: "new-device"})
				Expect(overridenBundle.Devices()).To(ConsistOf(specs.LinuxDevice{Path: "new-device"}))
			})
		})
	})

	Describe("NamespaceSlice", func() {