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

Side by Side Diff: logdog/client/butlerlib/bootstrap/bootstrap_test.go

Issue 2456673003: Butler: export Coordinator host in environment. (Closed)
Patch Set: Relieve suspense. Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package bootstrap 5 package bootstrap
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "testing" 9 "testing"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 Convey(`Yields a Bootstrap with a Project, Prefix, and n o Client.`, func() { 46 Convey(`Yields a Bootstrap with a Project, Prefix, and n o Client.`, func() {
47 bs, err := getFromEnv(env, reg) 47 bs, err := getFromEnv(env, reg)
48 So(err, ShouldBeNil) 48 So(err, ShouldBeNil)
49 49
50 So(bs, ShouldResemble, &Bootstrap{ 50 So(bs, ShouldResemble, &Bootstrap{
51 Project: "test-project", 51 Project: "test-project",
52 Prefix: "butler/prefix", 52 Prefix: "butler/prefix",
53 }) 53 })
54 }) 54 })
55 55
56 » » » Convey(`And a stream server path`, func() { 56 » » » Convey(`And the remaining environment parameters`, func( ) {
57 env[EnvStreamServerPath] = "test:client:params" 57 env[EnvStreamServerPath] = "test:client:params"
58 env[EnvCoordinatorHost] = "example.appspot.com"
58 59
59 » » » » Convey(`Yields a Bootstrap with a Prefix and Cli ent.`, func() { 60 » » » » Convey(`Yields a fully-populated Bootstrap.`, fu nc() {
60 bs, err := getFromEnv(env, reg) 61 bs, err := getFromEnv(env, reg)
61 So(err, ShouldBeNil) 62 So(err, ShouldBeNil)
62 63
63 So(bs, ShouldResemble, &Bootstrap{ 64 So(bs, ShouldResemble, &Bootstrap{
64 » » » » » » Project: "test-project", 65 » » » » » » CoordinatorHost: "example.appspo t.com",
65 » » » » » » Prefix: "butler/prefix", 66 » » » » » » Project: "test-project",
66 » » » » » » Client: &sentinelClient{}, 67 » » » » » » Prefix: "butler/prefix" ,
68 » » » » » » Client: &sentinelClient {},
67 }) 69 })
68 So(regSpec, ShouldEqual, "client:params" ) 70 So(regSpec, ShouldEqual, "client:params" )
69 }) 71 })
70 72
71 Convey(`If Client creation fails, will fail.`, f unc() { 73 Convey(`If Client creation fails, will fail.`, f unc() {
72 regErr = errors.New("testing error") 74 regErr = errors.New("testing error")
73 _, err := getFromEnv(env, reg) 75 _, err := getFromEnv(env, reg)
74 So(err, ShouldErrLike, "failed to create stream client") 76 So(err, ShouldErrLike, "failed to create stream client")
75 }) 77 })
76 }) 78 })
(...skipping 11 matching lines...) Expand all
88 }) 90 })
89 91
90 Convey(`With an invalid Butler project, will fail.`, fun c() { 92 Convey(`With an invalid Butler project, will fail.`, fun c() {
91 env[EnvStreamProject] = "_notavaildproject" 93 env[EnvStreamProject] = "_notavaildproject"
92 _, err := getFromEnv(env, reg) 94 _, err := getFromEnv(env, reg)
93 So(err, ShouldErrLike, "failed to validate proje ct") 95 So(err, ShouldErrLike, "failed to validate proje ct")
94 }) 96 })
95 }) 97 })
96 }) 98 })
97 } 99 }
OLDNEW
« no previous file with comments | « logdog/client/butlerlib/bootstrap/bootstrap.go ('k') | logdog/client/butlerlib/bootstrap/environment.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698