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

Side by Side Diff: milo/appengine/buildbot/html_data.go

Issue 2856273004: Milo: Increase test coverage for appengine/buildbot (Closed)
Patch Set: review Created 3 years, 6 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/appengine/buildbot/html.go ('k') | milo/appengine/buildbot/html_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package buildbot 1 package buildbot
6 2
7 import (
8 "fmt"
9
10 "github.com/luci/gae/impl/memory"
11 "github.com/luci/luci-go/common/clock/testclock"
12 "github.com/luci/luci-go/milo/api/resp"
13 "github.com/luci/luci-go/milo/appengine/common"
14 "github.com/luci/luci-go/server/templates"
15 "golang.org/x/net/context"
16 )
17
18 // We put this here because _test.go files are sometimes not built. 3 // We put this here because _test.go files are sometimes not built.
19 var testCases = []struct { 4 var TestCases = []struct {
20 » builder string 5 » Builder string
21 » build int 6 » Build int
22 }{ 7 }{
23 {"CrWinGoma", 30608}, 8 {"CrWinGoma", 30608},
9 {"chromium_presubmit", 426944},
10 {"newline", 1234},
24 {"win_chromium_rel_ng", 246309}, 11 {"win_chromium_rel_ng", 246309},
25 {"newline", 1234},
26 } 12 }
27
28 // BuildTestData returns sample test data for build pages.
29 func BuildTestData() []common.TestBundle {
30 c := memory.Use(context.Background())
31 c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
32 bundles := []common.TestBundle{}
33 for _, tc := range testCases {
34 build, err := build(c, "debug", tc.builder, tc.build)
35 if err != nil {
36 panic(fmt.Errorf(
37 "Encountered error while building debug/%s/%s.\n %s",
38 tc.builder, tc.build, err))
39 }
40 bundles = append(bundles, common.TestBundle{
41 Description: fmt.Sprintf("Debug page: %s/%d", tc.builder , tc.build),
42 Data: templates.Args{
43 "Build": build,
44 },
45 })
46 }
47 return bundles
48 }
49
50 // BiulderTestData returns sample test data for builder pages.
51 func BuilderTestData() []common.TestBundle {
52 return []common.TestBundle{
53 {
54 Description: "Basic Test no builds",
55 Data: templates.Args{
56 "Builder": &resp.Builder{
57 Name: "Sample Builder",
58 },
59 },
60 },
61 {
62 Description: "Basic Test with builds",
63 Data: templates.Args{
64 "Builder": &resp.Builder{
65 Name: "Sample Builder",
66 CurrentBuilds: []*resp.BuildSummary{
67 {
68 Link: &resp.Link{
69 URL: "https:// some.url/path",
70 Label: "Some cur rent build",
71 },
72 Revision: "deadbeef",
73 },
74 },
75 PendingBuilds: []*resp.BuildSummary{
76 {
77 Link: &resp.Link{
78 URL: "https:// some.url/path",
79 Label: "Some cur rent build",
80 },
81 Revision: "deadbeef",
82 },
83 },
84 FinishedBuilds: []*resp.BuildSummary{
85 {
86 Link: &resp.Link{
87 URL: "https:// some.url/path",
88 Label: "Some cur rent build",
89 },
90 Revision: "deadbeef",
91 },
92 },
93 },
94 },
95 },
96 }
97 }
OLDNEW
« no previous file with comments | « milo/appengine/buildbot/html.go ('k') | milo/appengine/buildbot/html_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698