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

Side by Side Diff: milo/buildsource/buildbucket/builder_test.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/buildsource/buildbucket/builder.go ('k') | milo/buildsource/buildbucket/html.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. 1 // Copyright 2016 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with 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 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 _, err := common.UpdateServiceConfig(c) 51 _, err := common.UpdateServiceConfig(c)
52 So(err, ShouldBeNil) 52 So(err, ShouldBeNil)
53 53
54 for _, tc := range testCases { 54 for _, tc := range testCases {
55 tc := tc 55 tc := tc
56 Convey(fmt.Sprintf("%s:%s", tc.bucket, tc.builder), func () { 56 Convey(fmt.Sprintf("%s:%s", tc.bucket, tc.builder), func () {
57 expectationFilePath := filepath.Join("expectatio ns", tc.bucket, tc.builder+".json") 57 expectationFilePath := filepath.Join("expectatio ns", tc.bucket, tc.builder+".json")
58 err := os.MkdirAll(filepath.Dir(expectationFileP ath), 0777) 58 err := os.MkdirAll(filepath.Dir(expectationFileP ath), 0777)
59 So(err, ShouldBeNil) 59 So(err, ShouldBeNil)
60 60
61 » » » » actual, err := builderImpl(c, 61 » » » » actual, err := GetBuilder(c, tc.bucket, tc.build er, 0)
62 » » » » » builderQuery{
63 » » » » » » Bucket: tc.bucket,
64 » » » » » » Builder: tc.builder,
65 » » » » » » Limit: 0,
66 » » » » » })
67 So(err, ShouldBeNil) 62 So(err, ShouldBeNil)
68 actualJSON, err := json.MarshalIndent(actual, "" , " ") 63 actualJSON, err := json.MarshalIndent(actual, "" , " ")
69 So(err, ShouldBeNil) 64 So(err, ShouldBeNil)
70 65
71 if *generate { 66 if *generate {
72 err := ioutil.WriteFile(expectationFileP ath, actualJSON, 0777) 67 err := ioutil.WriteFile(expectationFileP ath, actualJSON, 0777)
73 So(err, ShouldBeNil) 68 So(err, ShouldBeNil)
74 } else { 69 } else {
75 expectedJSON, err := ioutil.ReadFile(exp ectationFilePath) 70 expectedJSON, err := ioutil.ReadFile(exp ectationFilePath)
76 So(err, ShouldBeNil) 71 So(err, ShouldBeNil)
77 So(string(actualJSON), ShouldEqual, stri ng(expectedJSON)) 72 So(string(actualJSON), ShouldEqual, stri ng(expectedJSON))
78 } 73 }
79 }) 74 })
80 } 75 }
81 }) 76 })
82 } 77 }
83 78
84 var bktConfig = ` 79 var bktConfig = `
85 buildbucket: { 80 buildbucket: {
86 host: "debug" 81 host: "debug"
87 project: "debug" 82 project: "debug"
88 } 83 }
89 ` 84 `
90 85
91 var bktConfigFull = map[string]memcfg.ConfigSet{ 86 var bktConfigFull = map[string]memcfg.ConfigSet{
92 "services/luci-milo-dev": { 87 "services/luci-milo-dev": {
93 "settings.cfg": bktConfig, 88 "settings.cfg": bktConfig,
94 }, 89 },
95 } 90 }
OLDNEW
« no previous file with comments | « milo/buildsource/buildbucket/builder.go ('k') | milo/buildsource/buildbucket/html.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698