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

Unified Diff: client/logdog/butlerlib/bootstrap/bootstrap_test.go

Issue 1906023002: LogDog: Add project namespace to Butler/Collector. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-archivist
Patch Set: Rebase? Created 4 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 | « client/logdog/butlerlib/bootstrap/bootstrap.go ('k') | client/logdog/butlerlib/bootstrap/environment.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/logdog/butlerlib/bootstrap/bootstrap_test.go
diff --git a/client/logdog/butlerlib/bootstrap/bootstrap_test.go b/client/logdog/butlerlib/bootstrap/bootstrap_test.go
index 172caaa50da334fa76a42de3f8a783f4bbddcb70..9b75c85febc1f85a1843dc1f06c68d1d32e9affa 100644
--- a/client/logdog/butlerlib/bootstrap/bootstrap_test.go
+++ b/client/logdog/butlerlib/bootstrap/bootstrap_test.go
@@ -11,8 +11,8 @@ import (
"github.com/luci/luci-go/client/environ"
"github.com/luci/luci-go/client/logdog/butlerlib/streamclient"
"github.com/luci/luci-go/client/logdog/butlerlib/streamproto"
- "github.com/luci/luci-go/common/logdog/types"
- "github.com/luci/luci-go/common/testing/assertions"
+
+ . "github.com/luci/luci-go/common/testing/assertions"
. "github.com/smartystreets/goconvey/convey"
)
@@ -39,14 +39,18 @@ func TestBootstrap(t *testing.T) {
So(err, ShouldEqual, ErrNotBootstrapped)
})
- Convey(`With a Butler prefix`, func() {
+ Convey(`With a Butler project and prefix`, func() {
+ env[EnvStreamProject] = "test-project"
env[EnvStreamPrefix] = "butler/prefix"
- Convey(`Yields a Bootstrap with a Prefix and no Client.`, func() {
+ Convey(`Yields a Bootstrap with a Project, Prefix, and no Client.`, func() {
bs, err := getFromEnv(env, reg)
So(err, ShouldBeNil)
- So(bs.Prefix, ShouldEqual, types.StreamName("butler/prefix"))
- So(bs.Client, ShouldBeNil)
+
+ So(bs, ShouldResemble, &Bootstrap{
+ Project: "test-project",
+ Prefix: "butler/prefix",
+ })
})
Convey(`And a stream server path`, func() {
@@ -55,24 +59,39 @@ func TestBootstrap(t *testing.T) {
Convey(`Yields a Bootstrap with a Prefix and Client.`, func() {
bs, err := getFromEnv(env, reg)
So(err, ShouldBeNil)
- So(bs.Prefix, ShouldEqual, types.StreamName("butler/prefix"))
- So(bs.Client, ShouldEqual, &sentinelClient{})
+
+ So(bs, ShouldResemble, &Bootstrap{
+ Project: "test-project",
+ Prefix: "butler/prefix",
+ Client: &sentinelClient{},
+ })
So(regSpec, ShouldEqual, "client:params")
})
Convey(`If Client creation fails, will fail.`, func() {
regErr = errors.New("testing error")
_, err := getFromEnv(env, reg)
- So(err, assertions.ShouldErrLike, "failed to create stream client")
+ So(err, ShouldErrLike, "failed to create stream client")
})
})
- })
- Convey(`With an invalid Butler prefix, will fail.`, func() {
- env[EnvStreamPrefix] = "_notavaildprefix"
- _, err := getFromEnv(env, reg)
- So(err, assertions.ShouldErrLike, "failed to validate prefix")
- })
+ Convey(`With an invalid Butler prefix, will fail.`, func() {
+ env[EnvStreamPrefix] = "_notavaildprefix"
+ _, err := getFromEnv(env, reg)
+ So(err, ShouldErrLike, "failed to validate prefix")
+ })
+
+ Convey(`With an missing Butler project, will fail.`, func() {
+ delete(env, EnvStreamProject)
+ _, err := getFromEnv(env, reg)
+ So(err, ShouldErrLike, "failed to validate project")
+ })
+ Convey(`With an invalid Butler project, will fail.`, func() {
+ env[EnvStreamProject] = "_notavaildproject"
+ _, err := getFromEnv(env, reg)
+ So(err, ShouldErrLike, "failed to validate project")
+ })
+ })
})
}
« no previous file with comments | « client/logdog/butlerlib/bootstrap/bootstrap.go ('k') | client/logdog/butlerlib/bootstrap/environment.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698