Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: milo/frontend/buildbot_data.go

Issue 2977863002: [milo] Refactor all html knowledge out of backends. (Closed)
Patch Set: now with case insensitivity Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « milo/common/utils.go ('k') | milo/frontend/config.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The LUCI Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package frontend
16
17 import (
18 "fmt"
19
20 "github.com/luci/gae/impl/memory"
21 "github.com/luci/luci-go/common/clock/testclock"
22 "github.com/luci/luci-go/milo/api/resp"
23 "github.com/luci/luci-go/milo/buildsource/buildbot"
24 "github.com/luci/luci-go/milo/common"
25 "github.com/luci/luci-go/server/templates"
26 "golang.org/x/net/context"
27 )
28
29 // buildbotBuildTestData returns sample test data for build pages.
30 func buildbotBuildTestData() []common.TestBundle {
31 c := memory.Use(context.Background())
32 c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
33 bundles := []common.TestBundle{}
34 for _, tc := range buildbot.TestCases {
35 build, err := buildbot.DebugBuild(c, "../buildsource/buildbot", tc.Builder, tc.Build)
36 if err != nil {
37 panic(fmt.Errorf(
38 "Encountered error while building debug/%s/%s.\n %s",
39 tc.Builder, tc.Build, err))
40 }
41 bundles = append(bundles, common.TestBundle{
42 Description: fmt.Sprintf("Debug page: %s/%d", tc.Builder , tc.Build),
43 Data: templates.Args{
44 "Build": build,
45 },
46 })
47 }
48 return bundles
49 }
50
51 // buildbotBuilderTestData returns sample test data for builder pages.
52 func buildbotBuilderTestData() []common.TestBundle {
53 l := resp.NewLink("Some current build", "https://some.url/path")
54 return []common.TestBundle{
55 {
56 Description: "Basic Test no builds",
57 Data: templates.Args{
58 "Builder": &resp.Builder{
59 Name: "Sample Builder",
60 },
61 },
62 },
63 {
64 Description: "Basic Test with builds",
65 Data: templates.Args{
66 "Builder": &resp.Builder{
67 Name: "Sample Builder",
68 MachinePool: &resp.MachinePool{
69 Total: 15,
70 Disconnected: 13,
71 Idle: 5,
72 Busy: 8,
73 },
74 CurrentBuilds: []*resp.BuildSummary{
75 {Link: l, Revision: "deadbeef"},
76 },
77 PendingBuilds: []*resp.BuildSummary{
78 {Link: l, Revision: "deadbeef"},
79 },
80 FinishedBuilds: []*resp.BuildSummary{
81 {Link: l, Revision: "deadbeef"},
82 },
83 },
84 },
85 },
86 }
87 }
OLDNEW
« no previous file with comments | « milo/common/utils.go ('k') | milo/frontend/config.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698