CPU: nil, }, )) }) }) }) Describe("Restoring", func() { It("sets the container's state and events", func() { err := container.Restore(linux_backend.ContainerSnapshot{ State: "active", Events: []string{"out of memory", "foo"}, }) Expect(err).ToNot(HaveOccurred()) Expect(container.State()).To(Equal(linux_backend.State("active"))) Expect(container.Events()).To(Equal([]string{ "out of memory", "foo", })) }) It("restores job state", func() { fakeRunner.WhenRunning( fake_command_runner.CommandSpec{ Path: "/depot/some-id/bin/iomux-link", Args: []string{ "-w", "/depot/some-id/jobs/0/cursors", "/depot/some-id/jobs/0", }, },
}, ) Expect(err).ToNot(HaveOccurred()) }) It("constructs a container from the snapshot", func() { container, err := pool.Restore(snapshot) Expect(err).ToNot(HaveOccurred()) Expect(container.ID()).To(Equal("some-restored-id")) Expect(container.Handle()).To(Equal("some-restored-handle")) Expect(container.GraceTime()).To(Equal(1 * time.Second)) linuxContainer := container.(*linux_backend.LinuxContainer) Expect(linuxContainer.State()).To(Equal(linux_backend.State("some-restored-state"))) Expect(linuxContainer.Events()).To(Equal([]string{ "some-restored-event", "some-other-restored-event", })) }) It("removes its UID from the pool", func() { _, err := pool.Restore(snapshot) Expect(err).ToNot(HaveOccurred()) Expect(fakeUIDPool.Removed).To(ContainElement(uint32(10000))) }) It("removes its network from the pool", func() { _, err := pool.Restore(snapshot)