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

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: More places Created 4 years, 4 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
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"
18 . "github.com/smartystreets/goconvey/convey" 19 . "github.com/smartystreets/goconvey/convey"
19 "golang.org/x/net/context" 20 "golang.org/x/net/context"
20 ) 21 )
21 22
22 var generate = flag.Bool("test.generate", false, "Generate expectations instead of running tests.") 23 var generate = flag.Bool("test.generate", false, "Generate expectations instead of running tests.")
23 24
24 func load(name string) ([]byte, error) { 25 func load(name string) ([]byte, error) {
25 filename := strings.Join([]string{"expectations", name}, "/") 26 filename := strings.Join([]string{"expectations", name}, "/")
26 return ioutil.ReadFile(filename) 27 return ioutil.ReadFile(filename)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 Convey(`A test Environment`, t, func() { 65 Convey(`A test Environment`, t, func() {
65 66
66 for _, tc := range testCases { 67 for _, tc := range testCases {
67 Convey(fmt.Sprintf("Test Case: %s/%s", tc.builder, tc.bu ild), func() { 68 Convey(fmt.Sprintf("Test Case: %s/%s", tc.builder, tc.bu ild), func() {
68 build, err := build(c, "debug", tc.builder, tc.b uild) 69 build, err := build(c, "debug", tc.builder, tc.b uild)
69 So(err, ShouldBeNil) 70 So(err, ShouldBeNil)
70 fname := fmt.Sprintf("%s.%s.build.json", tc.buil der, tc.build) 71 fname := fmt.Sprintf("%s.%s.build.json", tc.buil der, tc.build)
71 So(build, shouldMatchExpectationsFor, fname) 72 So(build, shouldMatchExpectationsFor, fname)
72 }) 73 })
73 } 74 }
75
76 Convey(`Disallow anonomyous users from accessing internal builds `, func() {
77 ds := datastore.Get(c)
78 ds.Put(&buildbotBuild{
79 Master: "fake",
80 Buildername: "fake",
81 Number: 1,
82 Internal: true,
83 })
84 b, err := getBuild(c, "fake", "fake", "1")
85 So(b, ShouldBeNil)
86 So(err, ShouldResemble, errBuildNotFound)
87 })
74 }) 88 })
75 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698