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

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

Issue 2760873003: Milo: Use luci-config for storing buildbot acls (Closed)
Patch Set: Fix tests Created 3 years, 9 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 b2b6fbf7d4535f0a31ae5157849e5009e89395f3..835652c72bb8b61d8ad9600b2367f69049916e54 100644
--- a/milo/appengine/common/config_test.go
+++ b/milo/appengine/common/config_test.go
@@ -24,11 +24,29 @@ func TestConfig(t *testing.T) {
Convey("Test Environment", t, func() {
c := memory.UseWithAppID(context.Background(), "dev~luci-milo")
c = gologger.StdConfig.Use(c)
- c = testconfig.WithCommonClient(c, memcfg.New(mockedConfigs))
+
+ 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)
+ So(settings.Buildbot.InternalReader, ShouldEqual, "")
+ })
+ Convey("Read a config", func() {
+ mockedConfigs["services/luci-milo"] = memcfg.ConfigSet{
+ "settings.cfg": settingsCfg,
+ }
+ c = testconfig.WithCommonClient(c, memcfg.New(mockedConfigs))
+ settings, err := GetSettings(c)
+ So(err, ShouldBeNil)
+ So(settings.Buildbot.InternalReader, ShouldEqual, "googlers")
+ })
+ })
Convey("Send update", func() {
+ c = testconfig.WithCommonClient(c, memcfg.New(mockedConfigs))
// Send update here
- err := Update(c)
+ err := UpdateProjectConfigs(c)
So(err, ShouldBeNil)
Convey("Check Project config updated", func() {
@@ -48,9 +66,10 @@ func TestConfig(t *testing.T) {
})
Convey("Reject duplicate configs.", func() {
+ c = testconfig.WithCommonClient(c, memcfg.New(mockedConfigs))
mockedConfigs["projects/bar.git"] = memcfg.ConfigSet{"luci-milo.cfg": barCfg}
- err := Update(c)
+ err := UpdateProjectConfigs(c)
So(strings.HasPrefix(err.Error(), "Duplicate project ID"), ShouldEqual, true)
})
})
@@ -83,6 +102,12 @@ var barCfg = `
ID: "foo"
`
+var settingsCfg = `
+buildbot: {
+ internal_reader: "googlers"
+}
+`
+
var mockedConfigs = map[string]memcfg.ConfigSet{
"projects/foo.git": {
"luci-milo.cfg": fooCfg,
« 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