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

Unified Diff: luci_config/appengine/gaeconfig/settings_test.go

Issue 2643803003: config: Update remote URL handling. (Closed)
Patch Set: Fix "nost" Created 3 years, 11 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 | « luci_config/appengine/gaeconfig/settings.go ('k') | luci_config/server/cfgclient/backend/client/client.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: luci_config/appengine/gaeconfig/settings_test.go
diff --git a/luci_config/appengine/gaeconfig/settings_test.go b/luci_config/appengine/gaeconfig/settings_test.go
new file mode 100644
index 0000000000000000000000000000000000000000..654479c5cbc9c8cb900ffd8b94723ba5519e00f2
--- /dev/null
+++ b/luci_config/appengine/gaeconfig/settings_test.go
@@ -0,0 +1,56 @@
+// Copyright 2017 The LUCI Authors. All rights reserved.
+// Use of this source code is governed under the Apache License, Version 2.0
+// that can be found in the LICENSE file.
+
+package gaeconfig
+
+import (
+ "testing"
+
+ "github.com/luci/luci-go/server/settings"
+
+ "golang.org/x/net/context"
+
+ . "github.com/smartystreets/goconvey/convey"
+)
+
+func TestSettingsURLToHostTranslation(t *testing.T) {
+ t.Parallel()
+
+ Convey(`A testing settings configuration`, t, func() {
+ c := context.Background()
+
+ memSettings := settings.MemoryStorage{}
+ c = settings.Use(c, settings.New(&memSettings))
+
+ Convey(`Loaded with a URL value in ConfigServiceHost`, func() {
+ s := Settings{
+ ConfigServiceHost: "https://example.com/foo/bar",
+ }
+ So(s.SetIfChanged(c, "test harness", "initial settings"), ShouldBeNil)
+
+ Convey(`Will load the setting as a host.`, func() {
+ s, err := FetchCachedSettings(c)
+ So(err, ShouldBeNil)
+ So(s, ShouldResemble, Settings{
+ ConfigServiceHost: "example.com",
+ })
+ })
+ })
+
+ Convey(`Loaded with a host value in ConfigServiceHost`, func() {
+ s := Settings{
+ ConfigServiceHost: "example.com",
+ }
+ So(s.SetIfChanged(c, "test harness", "initial settings"), ShouldBeNil)
+
+ Convey(`Will load the setting as a host.`, func() {
+ s, err := FetchCachedSettings(c)
+ So(err, ShouldBeNil)
+ So(s, ShouldResemble, Settings{
+ ConfigServiceHost: "example.com",
+ })
+ })
+ })
+ })
+}
« no previous file with comments | « luci_config/appengine/gaeconfig/settings.go ('k') | luci_config/server/cfgclient/backend/client/client.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698