) BeforeEach(func() { container1 = registerTestContainer(newTestContainer(linux_backend.LinuxContainerSpec{ ContainerSpec: garden.ContainerSpec{Handle: "container-1"}, })) containerRepo.Add(container1) container2 = registerTestContainer(newTestContainer(linux_backend.LinuxContainerSpec{ ContainerSpec: garden.ContainerSpec{Handle: "container-2"}, })) containerRepo.Add(container2) }) Context("when no snapshot directory is passed", func() { It("stops succesfully without saving snapshots", func() { Expect(func() { linuxBackend.Stop() }).ToNot(Panic()) Expect(container1.SnapshotCallCount()).To(Equal(0)) Expect(container2.SnapshotCallCount()).To(Equal(0)) }) }) Context("when the snapshot directory is passed", func() { BeforeEach(func() { tmpdir, err := ioutil.TempDir(os.TempDir(), "garden-server-test") Expect(err).ToNot(HaveOccurred()) snapshotsPath = path.Join(tmpdir, "snapshots") }) JustBeforeEach(func() {