Beispiel #1
0
			returnedBundle = initialBundle.WithPidLimit(specs.LinuxPids{Limit: pidLimit})
		})

		It("returns a bundle with the pid limit added to the runtime spec", func() {
			Expect(returnedBundle.Resources().Pids).To(Equal(&specs.LinuxPids{Limit: pidLimit}))
		})
	})

	Describe("WithNamespace", func() {
		It("does not change any namespaces other than the one with the given type", func() {
			colin := specs.LinuxNamespace{Type: "colin", Path: ""}
			potato := specs.LinuxNamespace{Type: "potato", Path: "pan"}

			initialBundle = initialBundle.WithNamespace(colin)
			returnedBundle = initialBundle.WithNamespace(potato)
			Expect(returnedBundle.Namespaces()).To(ConsistOf(colin, potato))
		})

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

		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)