users.LookupStub = func(name string) (*user.User, error) { return etcPasswd[name], nil } rlimitsEncoder = new(fake_rlimits_env_encoder.FakeRlimitsEnvEncoder) preparer = &container_daemon.ProcessSpecPreparer{ 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", },
Describe("Run", func() { It("listens for connections", func() { Expect(daemon.Run(listener)).To(Succeed()) Expect(listener.ListenCallCount()).To(Equal(1)) }) Context("when a connection is made", func() { var handleFileHandles []container_daemon.StreamingFile var handlerError error var request *container_daemon.RequestMessage var response *container_daemon.ResponseMessage Context("and a process is being handled", func() { var spec garden.ProcessSpec var handlerPid int BeforeEach(func() { spec = garden.ProcessSpec{ Path: "fishfinger", Args: []string{ "foo", "bar", }, User: "******", Dir: "some-dir", Env: []string{"foo=bar", "baz=barry"}, } preparer.PrepareCmdReturns(exec.Command("foo"), nil)
func (container *gardenWorkerContainer) Run(spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error) { spec.User = container.user return container.Container.Run(spec, io) }