コード例 #1
0
ファイル: bundle_test.go プロジェクト: cloudfoundry/guardian
	Describe("WithGIDMappings", func() {
		It("returns a bundle with the provided gid mappings added to the runtime spec", func() {
			gidMappings := []specs.LinuxIDMapping{
				{
					HostID:      40000,
					ContainerID: 0,
					Size:        1,
				},
				{
					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() {