})

				_, err := container.CurrentMemoryLimits()
				Expect(err.Error()).To(HaveSuffix("invalid syntax"))
			})
		})

	})

	Describe("Limiting CPU", func() {
		It("sets cpu.shares", func() {
			limits := garden.CPULimits{
				LimitInShares: 512,
			}

			err := container.LimitCPU(limits)
			Expect(err).ToNot(HaveOccurred())

			Expect(fakeCgroups.SetValues()).To(Equal(
				[]fake_cgroups_manager.SetValue{
					{
						Subsystem: "cpu",
						Name:      "cpu.shares",
						Value:     "512",
					},
				},
			))

		})

		Context("when setting cpu.shares fails", func() {
					return nil
				}

				err := container.LimitMemory(memoryLimits)
				Expect(err).ToNot(HaveOccurred())

				Eventually(container.Events).Should(ContainElement("out of memory"))
				Eventually(container.State).Should(Equal(linux_backend.StateStopped))

				err = container.LimitDisk(diskLimits)
				Expect(err).ToNot(HaveOccurred())

				err = container.LimitBandwidth(bandwidthLimits)
				Expect(err).ToNot(HaveOccurred())

				err = container.LimitCPU(cpuLimits)
				Expect(err).ToNot(HaveOccurred())
			})

			It("saves them", func() {
				out := new(bytes.Buffer)

				err := container.Snapshot(out)
				Expect(err).ToNot(HaveOccurred())

				var snapshot linux_backend.LinuxContainerSpec

				err = json.NewDecoder(out).Decode(&snapshot)
				Expect(err).ToNot(HaveOccurred())

				Expect(snapshot.State).To(Equal(linux_backend.StateStopped))