diff --git a/cmd/receptor/cell_test.go b/cmd/receptor/cell_test.go index 71454cc..c5741e9 100644 --- a/cmd/receptor/cell_test.go +++ b/cmd/receptor/cell_test.go @@ -20,7 +20,8 @@ var _ = Describe("Cell API", func() { BeforeEach(func() { heartbeatInterval = 100 * time.Millisecond - cellPresence = models.NewCellPresence("cell-0", "stack-0", "1.2.3.4", "the-zone") + capacity := models.NewCellCapacity(128, 1024, 6) + cellPresence = models.NewCellPresence("cell-0", "stack-0", "1.2.3.4", "the-zone", capacity) heartbeatRunner := bbs.NewCellHeartbeat(cellPresence, heartbeatInterval) heartbeatProcess = ginkgomon.Invoke(heartbeatRunner) receptorProcess = ginkgomon.Invoke(receptorRunner) diff --git a/handlers/cell_handlers_test.go b/handlers/cell_handlers_test.go index 4b47711..c4a3a56 100644 --- a/handlers/cell_handlers_test.go +++ b/handlers/cell_handlers_test.go @@ -36,9 +36,10 @@ var _ = Describe("Cell Handlers", func() { var cellPresences []models.CellPresence BeforeEach(func() { + capacity := models.NewCellCapacity(128, 1024, 6) cellPresences = []models.CellPresence{ - models.NewCellPresence("cell-id-0", "stack-0", "1.2.3.4", "the-zone"), - models.NewCellPresence("cell-id-1", "stack-1", "4.5.6.7", "the-zone"), + models.NewCellPresence("cell-id-0", "stack-0", "1.2.3.4", "the-zone", capacity), + models.NewCellPresence("cell-id-1", "stack-1", "4.5.6.7", "the-zone", capacity), } }) diff --git a/resources.go b/resources.go index fed9898..662fc32 100644 --- a/resources.go +++ b/resources.go @@ -414,8 +414,16 @@ type ActualLRPResponse struct { } type CellResponse struct { - CellID string `json:"cell_id"` - Stack string `json:"stack"` + CellID string `json:"cell_id"` + Stack string `json:"stack"` + Zone string `json:"zone"` + Capacity CellCapacity +} + +type CellCapacity struct { + MemoryMB int `json:"memory_mb"` + DiskMB int `json:"disk_mb"` + Containers int `json:"containers"` } type Event interface { diff --git a/serialization/cells.go b/serialization/cells.go index 2dc2cb2..aebca9e 100644 --- a/serialization/cells.go +++ b/serialization/cells.go @@ -9,5 +9,11 @@ func CellPresenceToCellResponse(cellPresence models.CellPresence) receptor.CellR return receptor.CellResponse{ CellID: cellPresence.CellID, Stack: cellPresence.Stack, + Zone: cellPresence.Zone, + Capacity: receptor.CellCapacity{ + MemoryMB: cellPresence.Capacity.MemoryMB, + DiskMB: cellPresence.Capacity.DiskMB, + Containers: cellPresence.Capacity.Containers, + }, } } diff --git a/serialization/cells_test.go b/serialization/cells_test.go index beb9cc3..cf3b3b8 100644 --- a/serialization/cells_test.go +++ b/serialization/cells_test.go @@ -14,13 +14,20 @@ var _ = Describe("CellPresence Serialization", func() { var cellPresence models.CellPresence BeforeEach(func() { - cellPresence = models.NewCellPresence("cell-id-0", "stack-0", "1.2.3.4", "the-zone") + capacity := models.NewCellCapacity(128, 1024, 6) + cellPresence = models.NewCellPresence("cell-id-0", "stack-0", "1.2.3.4", "the-zone", capacity) }) It("serializes all the fields", func() { expectedResponse := receptor.CellResponse{ CellID: "cell-id-0", Stack: "stack-0", + Zone: "the-zone", + Capacity: receptor.CellCapacity{ + MemoryMB: 128, + DiskMB: 1024, + Containers: 6, + }, } actualResponse := serialization.CellPresenceToCellResponse(cellPresence)