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

Unified Diff: common/tsmon/config_test.go

Issue 2225933003: tsmon: read hostname and region from config file (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: common/tsmon/config_test.go
diff --git a/common/tsmon/config_test.go b/common/tsmon/config_test.go
index 939d57eba4460ecb9c1f8ac3b4b0152c994f6695..841f40fb940c2aa5bb4d6d259a0e5f71a04aaa27 100644
--- a/common/tsmon/config_test.go
+++ b/common/tsmon/config_test.go
@@ -32,6 +32,8 @@ func TestLoadConfig(t *testing.T) {
So(c.Endpoint, ShouldEqual, "")
So(c.Credentials, ShouldEqual, "")
So(c.AutoGenHostname, ShouldEqual, false)
+ So(c.Hostname, ShouldEqual, "")
+ So(c.Region, ShouldEqual, "")
So(err, ShouldNotBeNil)
})
@@ -43,13 +45,22 @@ func TestLoadConfig(t *testing.T) {
defer tf.Close()
defer os.Remove(tf.Name())
- tf.WriteString(`{"endpoint": "foo", "credentials": "bar", "autogen_hostname": true}`)
+ tf.WriteString(`
+ {"endpoint": "foo",
dsansome 2016/08/09 03:28:22 Run gofmt
Sergey Berezin 2016/08/10 01:49:16 Actually, this is part of the `string`, so gofmt d
+ "credentials": "bar",
+ "autogen_hostname": true,
+ "hostname": "test_host",
+ "region": "test_region"
+ }
+ `)
tf.Sync()
c, err := loadConfig(tf.Name())
So(c.Endpoint, ShouldEqual, "foo")
So(c.Credentials, ShouldEqual, "bar")
So(c.AutoGenHostname, ShouldEqual, true)
+ So(c.Hostname, ShouldEqual, "test_host")
+ So(c.Region, ShouldEqual, "test_region")
So(err, ShouldBeNil)
})
}
« no previous file with comments | « common/tsmon/config.go ('k') | common/tsmon/iface.go » ('j') | common/tsmon/iface.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698