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

Unified Diff: server/config/naming_test.go

Issue 2580713002: Implement a server-side config service interface. (Closed)
Patch Set: Update MultiResolver interface, add test for MultiError. Created 4 years 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: server/config/naming_test.go
diff --git a/server/config/naming_test.go b/server/config/naming_test.go
new file mode 100644
index 0000000000000000000000000000000000000000..ec514518887f1884a793208e94f05502e263dbbd
--- /dev/null
+++ b/server/config/naming_test.go
@@ -0,0 +1,47 @@
+// Copyright 2016 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 config
+
+import (
+ "testing"
+
+ "github.com/luci/gae/impl/memory"
+
+ "golang.org/x/net/context"
+
+ . "github.com/smartystreets/goconvey/convey"
+)
+
+func TestNaming(t *testing.T) {
+ t.Parallel()
+
+ Convey(`Testing naming utility methods`, t, func() {
+ So(ServiceConfigSet("my-service"), ShouldEqual, "services/my-service")
+ So(ProjectConfigSet("my-project"), ShouldEqual, "projects/my-project")
+
+ project, configSet, tail := ParseProjectConfigSet("projects/foo")
+ So(project, ShouldEqual, "foo")
+ So(configSet, ShouldEqual, "projects/foo")
+ So(tail, ShouldEqual, "")
+
+ project, configSet, tail = ParseProjectConfigSet("projects/foo/refs/heads/master")
+ So(project, ShouldEqual, "foo")
+ So(configSet, ShouldEqual, "projects/foo")
+ So(tail, ShouldEqual, "refs/heads/master")
+
+ project, configSet, tail = ParseProjectConfigSet("not/a/project/config/set")
+ So(project, ShouldEqual, "")
+ So(configSet, ShouldEqual, "")
+ So(tail, ShouldEqual, "")
+
+ Convey(`With a testing AppEngine context`, func() {
+ c := memory.Use(context.Background())
+
+ Convey(`Can get the current service config set.`, func() {
+ So(CurrentServiceConfigSet(c), ShouldEqual, "services/app")
+ })
+ })
+ })
+}

Powered by Google App Engine
This is Rietveld 408576698