本文整理汇总了Golang中github.com/cloudfoundry-incubator/lattice/ltc/task_examiner/fake_task_examiner.FakeTaskExaminer.ListTasksReturns方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeTaskExaminer.ListTasksReturns方法的具体用法?Golang FakeTaskExaminer.ListTasksReturns怎么用?Golang FakeTaskExaminer.ListTasksReturns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/lattice/ltc/task_examiner/fake_task_examiner.FakeTaskExaminer
的用法示例。
在下文中一共展示了FakeTaskExaminer.ListTasksReturns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
CellID: "cell-02",
Failed: true,
FailureReason: "No compatible container",
Result: "Finished",
State: "COMPLETED",
},
task_examiner.TaskInfo{
TaskGuid: "task-guid-3",
CellID: "",
Failed: true,
FailureReason: "",
Result: "",
State: "COMPLETED",
},
}
fakeTaskExaminer.ListTasksReturns(listTasks, nil)
test_helpers.ExecuteCommandWithArgs(listAppsCommand, []string{})
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("App Name")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("Instances")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("DiskMB")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("MemoryMB")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("Route")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("process1")))
Expect(outputBuffer).To(test_helpers.Say(colors.Red("0/21")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("100")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("50")))
Expect(outputBuffer).To(test_helpers.Say("alldaylong.com => 54321"))
示例2:
It("displays all the existing apps & tasks, making sure output spacing is correct", func() {
listApps := []app_examiner.AppInfo{
app_examiner.AppInfo{ProcessGuid: "process1", DesiredInstances: 21, ActualRunningInstances: 0, DiskMB: 100, MemoryMB: 50, Ports: []uint16{54321}, Routes: route_helpers.AppRoutes{route_helpers.AppRoute{Hostnames: []string{"alldaylong.com"}, Port: 54321}}},
app_examiner.AppInfo{ProcessGuid: "process2", DesiredInstances: 8, ActualRunningInstances: 9, DiskMB: 400, MemoryMB: 30, Ports: []uint16{1234}, Routes: route_helpers.AppRoutes{route_helpers.AppRoute{Hostnames: []string{"never.io"}, Port: 1234}}},
app_examiner.AppInfo{ProcessGuid: "process3", DesiredInstances: 5, ActualRunningInstances: 5, DiskMB: 600, MemoryMB: 90, Ports: []uint16{1234}, Routes: route_helpers.AppRoutes{route_helpers.AppRoute{Hostnames: []string{"allthetime.com", "herewego.org"}, Port: 1234}}},
app_examiner.AppInfo{ProcessGuid: "process4", DesiredInstances: 0, ActualRunningInstances: 0, DiskMB: 10, MemoryMB: 10, Routes: route_helpers.AppRoutes{}},
}
listTasks := []task_examiner.TaskInfo{
task_examiner.TaskInfo{TaskGuid: "task-guid-1", CellID: "cell-01", Failed: false, FailureReason: "", Result: "Finished", State: "COMPLETED"},
task_examiner.TaskInfo{TaskGuid: "task-guid-2", CellID: "cell-02", Failed: true, FailureReason: "No compatible container", Result: "Finished", State: "COMPLETED"},
task_examiner.TaskInfo{TaskGuid: "task-guid-3", CellID: "", Failed: true, FailureReason: "", Result: "", State: "COMPLETED"},
}
fakeAppExaminer.ListAppsReturns(listApps, nil)
fakeTaskExaminer.ListTasksReturns(listTasks, nil)
test_helpers.ExecuteCommandWithArgs(listAppsCommand, []string{})
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("App Name")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("Instances")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("DiskMB")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("MemoryMB")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("Route")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("process1")))
Expect(outputBuffer).To(test_helpers.Say(colors.Red("0/21")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("100")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("50")))
Expect(outputBuffer).To(test_helpers.Say("alldaylong.com => 54321"))