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

Side by Side Diff: milo/appengine/buildbot/pubsub_test.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
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 "bytes" 8 "bytes"
9 "compress/zlib" 9 "compress/zlib"
10 "encoding/base64" 10 "encoding/base64"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 c = auth.WithState(c, &authtest.FakeState{ 90 c = auth.WithState(c, &authtest.FakeState{
91 Identity: identity.AnonymousIdentity, 91 Identity: identity.AnonymousIdentity,
92 IdentityGroups: []string{"all"}, 92 IdentityGroups: []string{"all"},
93 }) 93 })
94 // Update the service config so that the settings are loaded. 94 // Update the service config so that the settings are loaded.
95 err := common.UpdateServiceConfig(c) 95 err := common.UpdateServiceConfig(c)
96 So(err, ShouldBeNil) 96 So(err, ShouldBeNil)
97 97
98 rand.Seed(5) 98 rand.Seed(5)
99 99
100 Convey("Remove source changes", func() {
101 m := &buildbotMaster{
102 Name: "fake",
103 Builders: map[string]*buildbotBuilder{
104 "fake builder": {
105 PendingBuildStates: []*buildbotP ending{
106 {
107 Source: buildbot SourceStamp{
108 Changes: []buildbotChange{{Comments: "foo"}},
109 },
110 },
111 },
112 },
113 },
114 }
115 So(putDSMasterJSON(c, m, false), ShouldBeNil)
116 lm, _, err := getMasterJSON(c, "fake")
117 So(err, ShouldBeNil)
118 So(lm.Builders["fake builder"].PendingBuildStates[0].Sou rce.Changes[0].Comments, ShouldResemble, "")
119 })
120
100 Convey("Save build entry", func() { 121 Convey("Save build entry", func() {
101 build := &buildbotBuild{ 122 build := &buildbotBuild{
102 Master: "Fake Master", 123 Master: "Fake Master",
103 Buildername: "Fake buildername", 124 Buildername: "Fake buildername",
104 Number: 1234, 125 Number: 1234,
105 Currentstep: "this is a string", 126 Currentstep: "this is a string",
106 Finished: true, 127 Finished: true,
107 } 128 }
108 err := ds.Put(c, build) 129 err := ds.Put(c, build)
109 ds.GetTestable(c).CatchupIndexes() 130 ds.GetTestable(c).CatchupIndexes()
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 So(m.Project.Title, ShouldEqual, "some title") 485 So(m.Project.Title, ShouldEqual, "some title")
465 So(m.Slaves["testslave"].Name, ShouldEqual, "tes tslave") 486 So(m.Slaves["testslave"].Name, ShouldEqual, "tes tslave")
466 So(len(m.Slaves["testslave"].Runningbuilds), Sho uldEqual, 0) 487 So(len(m.Slaves["testslave"].Runningbuilds), Sho uldEqual, 0)
467 So(len(m.Slaves["testslave"].RunningbuildsMap), ShouldEqual, 1) 488 So(len(m.Slaves["testslave"].RunningbuildsMap), ShouldEqual, 1)
468 So(m.Slaves["testslave"].RunningbuildsMap["Fake buildername"][0], 489 So(m.Slaves["testslave"].RunningbuildsMap["Fake buildername"][0],
469 ShouldEqual, 2222) 490 ShouldEqual, 2222)
470 }) 491 })
471 }) 492 })
472 }) 493 })
473 } 494 }
OLDNEW
« no previous file with comments | « milo/appengine/buildbot/master_test.go ('k') | milo/appengine/buildbot/testdata/chromium_presubmit.426944.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698