コード例 #1
0
ファイル: bundle_test.go プロジェクト: cloudfoundry/guardian
			})
		})

		Context("when the namespace is already in the spec", func() {
			It("overrides the namespace", func() {
				initialBundle = initialBundle.WithNamespace(specs.LinuxNamespace{Type: "potato", Path: "should-be-overridden"})
				ns := specs.LinuxNamespace{Type: "potato", Path: "pan"}
				returnedBundle = initialBundle.WithNamespace(ns)
				Expect(returnedBundle.Namespaces()).To(ConsistOf(ns))
			})
		})
	})

	Describe("WithNamespaces", func() {
		BeforeEach(func() {
			returnedBundle = initialBundle.WithNamespaces(specs.LinuxNamespace{Type: specs.NetworkNamespace})
		})

		It("returns a bundle with the namespaces added to the runtime spec", func() {
			Expect(returnedBundle.Namespaces()).To(ConsistOf(specs.LinuxNamespace{Type: specs.NetworkNamespace}))
		})

		Context("when the spec already contains namespaces", func() {
			It("replaces them", func() {
				overridenBundle := returnedBundle.WithNamespaces(specs.LinuxNamespace{Type: "mynamespace"})
				Expect(overridenBundle.Namespaces()).To(ConsistOf(specs.LinuxNamespace{Type: "mynamespace"}))
			})
		})
	})

	Describe("WithUIDMappings", func() {