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

Unified Diff: appengine/logdog/coordinator/endpoints/services/service_test.go

Issue 1863973002: LogDog: Update to archival V2. (Closed) Base URL: https://github.com/luci/luci-go@grpcutil-errors
Patch Set: Fix proto comment. 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
Index: appengine/logdog/coordinator/endpoints/services/service_test.go
diff --git a/appengine/logdog/coordinator/endpoints/services/service_test.go b/appengine/logdog/coordinator/endpoints/services/service_test.go
index 52cb78bdd7f69f1371d92a4958fb86806e3d2707..446a198a391497d1a896efef8f2c1ecd941e90a9 100644
--- a/appengine/logdog/coordinator/endpoints/services/service_test.go
+++ b/appengine/logdog/coordinator/endpoints/services/service_test.go
@@ -8,9 +8,9 @@ import (
"testing"
"github.com/luci/gae/impl/memory"
+ "github.com/luci/luci-go/appengine/logdog/coordinator"
ct "github.com/luci/luci-go/appengine/logdog/coordinator/coordinatorTest"
"github.com/luci/luci-go/common/clock/testclock"
- "github.com/luci/luci-go/common/proto/logdog/svcconfig"
"github.com/luci/luci-go/server/auth"
"github.com/luci/luci-go/server/auth/authtest"
"golang.org/x/net/context"
@@ -26,18 +26,24 @@ func TestServiceAuth(t *testing.T) {
c, _ := testclock.UseTime(context.Background(), testclock.TestTimeLocal)
c = memory.Use(c)
+ svcStub := ct.Services{}
+
+ be := Server{
+ ServiceBase: coordinator.ServiceBase{&svcStub},
+ }
+ svc := be.GetServices()
+
c = auth.SetAuthenticator(c, auth.Authenticator{&authtest.FakeAuth{}})
Convey(`Will reject all traffic if no configuration is present.`, func() {
- So(Auth(c), ShouldBeRPCInternal)
+ So(Auth(c, svc), ShouldBeRPCInternal)
})
Convey(`With an application config installed`, func() {
- c := ct.UseConfig(c, &svcconfig.Coordinator{
- ServiceAuthGroup: "test-services",
- })
+ svcStub.InitConfig()
+ svcStub.ServiceConfig.Coordinator.ServiceAuthGroup = "test-services"
Convey(`Will reject users if there is an authentication error (no state).`, func() {
- So(Auth(c), ShouldBeRPCInternal)
+ So(Auth(c, svc), ShouldBeRPCInternal)
})
Convey(`With an authentication state`, func() {
@@ -45,19 +51,19 @@ func TestServiceAuth(t *testing.T) {
c = auth.WithState(c, &fs)
Convey(`Will reject users who are not logged in.`, func() {
- So(Auth(c), ShouldBeRPCPermissionDenied)
+ So(Auth(c, svc), ShouldBeRPCPermissionDenied)
})
Convey(`When a user is logged in`, func() {
fs.Identity = "user:user@example.com"
Convey(`Will reject users who are not members of the service group.`, func() {
- So(Auth(c), ShouldBeRPCPermissionDenied)
+ So(Auth(c, svc), ShouldBeRPCPermissionDenied)
})
Convey(`Will allow users who are members of the service group.`, func() {
fs.IdentityGroups = []string{"test-services"}
- So(Auth(c), ShouldBeNil)
+ So(Auth(c, svc), ShouldBeNil)
})
})
})

Powered by Google App Engine
This is Rietveld 408576698