DiskMB: defaultDiskMB, }), } execResources, err := depotClient.RemainingResourcesFrom(containers) Expect(err).NotTo(HaveOccurred()) Expect(resources.Subtract(&containers[0].Resource)).To(BeTrue()) Expect(execResources).To(Equal(resources)) }) }) Describe("TotalResources", func() { Context("when asked for total resources", func() { It("should return the resources it was configured with", func() { Expect(depotClient.TotalResources()).To(Equal(resources)) }) }) }) }) func convertSliceToMap(containers []executor.Container) map[string]executor.Container { containersMap := map[string]executor.Container{} for _, container := range containers { containersMap[container.Guid] = container } return containersMap } func newAllocationRequest(guid string, memoryMB, diskMB int, tagses ...executor.Tags) executor.AllocationRequest { resource := executor.NewResource(memoryMB, diskMB, "linux")
gardenProcess = ginkgomon.Invoke(componentMaker.GardenLinux()) }) It("should return an error", func() { Expect(pingErr).To(HaveOccurred()) Expect(pingErr.Error()).To(ContainSubstring("connection refused")) }) }) }) Describe("getting the total resources", func() { var resources executor.ExecutorResources var resourceErr error JustBeforeEach(func() { resources, resourceErr = executorClient.TotalResources() }) It("not return an error", func() { Expect(resourceErr).NotTo(HaveOccurred()) }) It("returns the preset capacity", func() { expectedResources := executor.ExecutorResources{ MemoryMB: int(gardenCapacity.MemoryInBytes / 1024 / 1024), DiskMB: int(gardenCapacity.DiskInBytes / 1024 / 1024), Containers: int(gardenCapacity.MaxContainers), } Expect(resources).To(Equal(expectedResources)) }) })