Ejemplo n.º 1
0
					receptor.ActualLRPResponse{CellID: "Cell-1", State: receptor.ActualLRPStateRunning},
					receptor.ActualLRPResponse{CellID: "Cell-2", State: receptor.ActualLRPStateClaimed},
					receptor.ActualLRPResponse{CellID: "Cell-2", State: receptor.ActualLRPStateRunning},
				}
				fakeReceptorClient.ActualLRPsReturns(actualLrps, nil)

				cells := []receptor.CellResponse{
					receptor.CellResponse{CellID: "Cell-1", Zone: "z1", Capacity: receptor.CellCapacity{MemoryMB: 12394, DiskMB: 2349083, Containers: 512}},
					receptor.CellResponse{CellID: "Cell-2", Zone: "z1", Capacity: receptor.CellCapacity{MemoryMB: 12394, DiskMB: 2349083, Containers: 512}},
					receptor.CellResponse{CellID: "Cell-3", Zone: "z2", Capacity: receptor.CellCapacity{MemoryMB: 12394, DiskMB: 2349083, Containers: 512}},
				}
				fakeReceptorClient.CellsReturns(cells, nil)
			})

			It("returns a list of alphabetically sorted examined cells", func() {
				cellList, err := appExaminer.ListCells()
				Expect(err).NotTo(HaveOccurred())
				Expect(cellList).To(HaveLen(3))

				cell1 := cellList[0]
				Expect(cell1.CellID).To(Equal("Cell-1"))
				Expect(cell1.RunningInstances).To(Equal(2))
				Expect(cell1.ClaimedInstances).To(Equal(0))
				Expect(cell1.Zone).To(Equal("z1"))
				Expect(cell1.MemoryMB).To(Equal(12394))
				Expect(cell1.DiskMB).To(Equal(2349083))
				Expect(cell1.Containers).To(Equal(512))

				cell2 := cellList[1]
				Expect(cell2.CellID).To(Equal("Cell-2"))
				Expect(cell2.RunningInstances).To(Equal(1))