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

Unified Diff: milo/appengine/common/config_test.go

Issue 2801463002: Milo: Use custom config caching layer (Closed)
Patch Set: Review: Remove double logging Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « milo/appengine/common/config.go ('k') | milo/appengine/frontend/config.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/common/config_test.go
diff --git a/milo/appengine/common/config_test.go b/milo/appengine/common/config_test.go
index 835652c72bb8b61d8ad9600b2367f69049916e54..6d20bd173d9567220a6545400d96614776e462f8 100644
--- a/milo/appengine/common/config_test.go
+++ b/milo/appengine/common/config_test.go
@@ -5,6 +5,7 @@
package common
import (
+ "errors"
"strings"
"testing"
@@ -28,8 +29,9 @@ func TestConfig(t *testing.T) {
Convey("Tests about global configs", func() {
Convey("Read a config before anything is set", func() {
c = testconfig.WithCommonClient(c, memcfg.New(mockedConfigs))
- settings, err := GetSettings(c)
- So(err, ShouldBeNil)
+ err := UpdateServiceConfig(c)
+ So(err, ShouldResemble, errors.New("could not load settings.cfg from luci-config: no such config"))
+ settings := GetSettings(c)
So(settings.Buildbot.InternalReader, ShouldEqual, "")
})
Convey("Read a config", func() {
@@ -37,16 +39,19 @@ func TestConfig(t *testing.T) {
"settings.cfg": settingsCfg,
}
c = testconfig.WithCommonClient(c, memcfg.New(mockedConfigs))
- settings, err := GetSettings(c)
+ err := UpdateServiceConfig(c)
So(err, ShouldBeNil)
+ settings := GetSettings(c)
So(settings.Buildbot.InternalReader, ShouldEqual, "googlers")
})
})
Convey("Send update", func() {
c = testconfig.WithCommonClient(c, memcfg.New(mockedConfigs))
+ err := UpdateServiceConfig(c)
+ So(err, ShouldBeNil)
// Send update here
- err := UpdateProjectConfigs(c)
+ err = UpdateProjectConfigs(c)
So(err, ShouldBeNil)
Convey("Check Project config updated", func() {
@@ -67,9 +72,11 @@ func TestConfig(t *testing.T) {
Convey("Reject duplicate configs.", func() {
c = testconfig.WithCommonClient(c, memcfg.New(mockedConfigs))
+ err := UpdateServiceConfig(c)
+ So(err, ShouldBeNil)
mockedConfigs["projects/bar.git"] = memcfg.ConfigSet{"luci-milo.cfg": barCfg}
- err := UpdateProjectConfigs(c)
+ err = UpdateProjectConfigs(c)
So(strings.HasPrefix(err.Error(), "Duplicate project ID"), ShouldEqual, true)
})
})
« no previous file with comments | « milo/appengine/common/config.go ('k') | milo/appengine/frontend/config.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698