Expect(*newRlimits.Nproc).To(Equal(valNproc))
			Expect(*newRlimits.Rss).To(Equal(valRss))
			Expect(*newRlimits.Rtprio).To(Equal(valRtprio))
			Expect(*newRlimits.Sigpending).To(Equal(valSigpending))
			Expect(*newRlimits.Stack).To(Equal(valStack))
		})
	})

	Describe("Apply", func() {
		Context("When an error occurs", func() {
			var (
				noFileValue uint64 = 1048999 // this will cause an error for number of files
			)

			JustBeforeEach(func() {
				rlimits.Nofile = &noFileValue
			})

			It("returns an error", func() {
				Expect(mgr.Apply(rlimits)).To(MatchError("container_daemon: setting rlimit: operation not permitted"))
			})
		})

		Context("Setting an RLimit", func() {
			var rLimitValue uint64

			BeforeEach(func() {
				rLimitValue = 9000
				rlimits.Core = &rLimitValue

				prevRlimit = new(syscall.Rlimit)
Exemple #2
0
			Users:                  users,
			Rlimits:                rlimitsEncoder,
			ProcStarterPath:        "/path/to/proc/starter",
			AlwaysDropCapabilities: true,
		}
	})

	Describe("Process preparation", func() {
		var spec garden.ProcessSpec

		BeforeEach(func() {
			var (
				nofile uint64 = 12
				rss    uint64 = 128
			)
			limits.Nofile = &nofile
			limits.Rss = &rss

			spec = garden.ProcessSpec{
				User: "******",
				Path: "fishfinger",
				Args: []string{
					"foo", "bar",
				},
				Env: []string{
					"foo=bar",
					"baz=barry",
				},
				Limits: limits,
			}
		})