err := container.LimitMemory(limits) Expect(err).ToNot(HaveOccurred()) err = container.LimitMemory(limits) Expect(err).ToNot(HaveOccurred()) Expect(started).To(Equal(1)) }) }) Context("when the oom notifier exits 0", func() { BeforeEach(func() { fakeRunner.WhenWaitingFor(fake_command_runner.CommandSpec{ Path: "/depot/some-id/bin/oom", }, func(cmd *exec.Cmd) error { return nil }) }) It("stops the container", func() { limits := backend.MemoryLimits{ LimitInBytes: 102400, } err := container.LimitMemory(limits) Expect(err).ToNot(HaveOccurred()) Eventually(fakeRunner).Should(HaveExecutedSerially( fake_command_runner.CommandSpec{ Path: "/depot/some-id/stop.sh",
Expect(fakeRunner).ToNot(HaveExecutedSerially( fake_command_runner.CommandSpec{ Path: "setquota", }, )) }) }) }) Describe("getting quotas limits", func() { It("executes repquota in the root path", func(done Done) { fakeRunner.WhenWaitingFor( fake_command_runner.CommandSpec{ Path: "/root/path/bin/repquota", }, func(cmd *exec.Cmd) error { close(done) return nil }, ) fakeRunner.WhenRunning( fake_command_runner.CommandSpec{ Path: "/root/path/bin/repquota", Args: []string{"/some/mount/point", "1234"}, }, func(cmd *exec.Cmd) error { cmd.Stdout.Write([]byte("1234 111 222 333 444 555 666 777 888\n")) return nil }, )