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

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

Issue 2271453002: Milo: Internal buildbot masters support (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: nit fix Created 4 years, 3 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/build.go ('k') | milo/appengine/buildbot/builder.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. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package buildbot 5 package buildbot
6 6
7 import ( 7 import (
8 "encoding/json" 8 "encoding/json"
9 "flag" 9 "flag"
10 "fmt" 10 "fmt"
11 "io/ioutil" 11 "io/ioutil"
12 "path" 12 "path"
13 "strings" 13 "strings"
14 "testing" 14 "testing"
15 15
16 "github.com/luci/gae/impl/memory" 16 "github.com/luci/gae/impl/memory"
17 "github.com/luci/gae/service/datastore"
17 "github.com/luci/luci-go/common/clock/testclock" 18 "github.com/luci/luci-go/common/clock/testclock"
19 "github.com/luci/luci-go/milo/common/miloerror"
18 . "github.com/smartystreets/goconvey/convey" 20 . "github.com/smartystreets/goconvey/convey"
19 "golang.org/x/net/context" 21 "golang.org/x/net/context"
20 ) 22 )
21 23
22 var generate = flag.Bool("test.generate", false, "Generate expectations instead of running tests.") 24 var generate = flag.Bool("test.generate", false, "Generate expectations instead of running tests.")
23 25
24 func load(name string) ([]byte, error) { 26 func load(name string) ([]byte, error) {
25 filename := strings.Join([]string{"expectations", name}, "/") 27 filename := strings.Join([]string{"expectations", name}, "/")
26 return ioutil.ReadFile(filename) 28 return ioutil.ReadFile(filename)
27 } 29 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 Convey(`A test Environment`, t, func() { 66 Convey(`A test Environment`, t, func() {
65 67
66 for _, tc := range testCases { 68 for _, tc := range testCases {
67 Convey(fmt.Sprintf("Test Case: %s/%s", tc.builder, tc.bu ild), func() { 69 Convey(fmt.Sprintf("Test Case: %s/%s", tc.builder, tc.bu ild), func() {
68 build, err := build(c, "debug", tc.builder, tc.b uild) 70 build, err := build(c, "debug", tc.builder, tc.b uild)
69 So(err, ShouldBeNil) 71 So(err, ShouldBeNil)
70 fname := fmt.Sprintf("%s.%s.build.json", tc.buil der, tc.build) 72 fname := fmt.Sprintf("%s.%s.build.json", tc.buil der, tc.build)
71 So(build, shouldMatchExpectationsFor, fname) 73 So(build, shouldMatchExpectationsFor, fname)
72 }) 74 })
73 } 75 }
76
77 Convey(`Disallow anonomyous users from accessing internal builds `, func() {
78 ds := datastore.Get(c)
79 ds.Put(&buildbotBuild{
80 Master: "fake",
81 Buildername: "fake",
82 Number: 1,
83 Internal: true,
84 })
85 b, err := getBuild(c, "fake", "fake", "1")
86 So(b, ShouldBeNil)
87 So(err, ShouldResemble, miloerror.Error{
88 Message: "Cannot fetch project buildbot-internal :\ndatastore: no such entity",
89 Code: 500,
90 })
91 })
74 }) 92 })
75 } 93 }
OLDNEW
« no previous file with comments | « milo/appengine/buildbot/build.go ('k') | milo/appengine/buildbot/builder.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698