TBR: veyron/services/mgmt/device: Fix mistakenly (but silently) messed up device manager test.
I accidentally undid a change Robin had made to make the principal in tests
unrelated to the principal used by the device manager (which is run
under the modules system and therefore has a related identity by default).
This fixes it.
Change-Id: I75919c0a7e68599b1cfaa2eea486f67a6cc62967
diff --git a/services/mgmt/device/impl/impl_test.go b/services/mgmt/device/impl/impl_test.go
index 3d59b81..4a6fee9 100644
--- a/services/mgmt/device/impl/impl_test.go
+++ b/services/mgmt/device/impl/impl_test.go
@@ -309,6 +309,10 @@
func TestDeviceManagerUpdateAndRevert(t *testing.T) {
ctx, shutdown := veyron2.Init()
defer shutdown()
+ ctx, err := veyron2.SetPrincipal(ctx, tsecurity.NewPrincipal("test-principal"))
+ if err != nil {
+ panic(err)
+ }
veyron2.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
sh, deferFn := mgmttest.CreateShellAndMountTable(t, ctx, veyron2.GetPrincipal(ctx))
@@ -550,6 +554,10 @@
func TestAppLifeCycle(t *testing.T) {
ctx, shutdown := veyron2.Init()
defer shutdown()
+ ctx, err := veyron2.SetPrincipal(ctx, tsecurity.NewPrincipal("test-principal"))
+ if err != nil {
+ panic(err)
+ }
veyron2.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
sh, deferFn := mgmttest.CreateShellAndMountTable(t, ctx, nil)
@@ -771,6 +779,10 @@
func TestDeviceManagerClaim(t *testing.T) {
ctx, shutdown := veyron2.Init()
defer shutdown()
+ ctx, err := veyron2.SetPrincipal(ctx, tsecurity.NewPrincipal("test-principal"))
+ if err != nil {
+ panic(err)
+ }
veyron2.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
sh, deferFn := mgmttest.CreateShellAndMountTable(t, ctx, nil)
@@ -846,6 +858,10 @@
func TestDeviceManagerUpdateACL(t *testing.T) {
ctx, shutdown := veyron2.Init()
defer shutdown()
+ ctx, err := veyron2.SetPrincipal(ctx, tsecurity.NewPrincipal("test-principal"))
+ if err != nil {
+ panic(err)
+ }
veyron2.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
sh, deferFn := mgmttest.CreateShellAndMountTable(t, ctx, nil)
@@ -953,6 +969,10 @@
func TestDeviceManagerInstallation(t *testing.T) {
ctx, shutdown := veyron2.Init()
defer shutdown()
+ ctx, err := veyron2.SetPrincipal(ctx, tsecurity.NewPrincipal("test-principal"))
+ if err != nil {
+ panic(err)
+ }
veyron2.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
sh, deferFn := mgmttest.CreateShellAndMountTable(t, ctx, nil)
@@ -1011,6 +1031,10 @@
func TestDeviceManagerGlobAndDebug(t *testing.T) {
ctx, shutdown := veyron2.Init()
defer shutdown()
+ ctx, err := veyron2.SetPrincipal(ctx, tsecurity.NewPrincipal("test-principal"))
+ if err != nil {
+ panic(err)
+ }
veyron2.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
sh, deferFn := mgmttest.CreateShellAndMountTable(t, ctx, nil)
@@ -1179,6 +1203,10 @@
func TestDeviceManagerPackages(t *testing.T) {
ctx, shutdown := veyron2.Init()
defer shutdown()
+ ctx, err := veyron2.SetPrincipal(ctx, tsecurity.NewPrincipal("test-principal"))
+ if err != nil {
+ panic(err)
+ }
veyron2.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
sh, deferFn := mgmttest.CreateShellAndMountTable(t, ctx, nil)
@@ -1253,6 +1281,10 @@
func TestAccountAssociation(t *testing.T) {
ctx, shutdown := veyron2.Init()
defer shutdown()
+ ctx, err := veyron2.SetPrincipal(ctx, tsecurity.NewPrincipal("test-principal"))
+ if err != nil {
+ panic(err)
+ }
veyron2.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
sh, deferFn := mgmttest.CreateShellAndMountTable(t, ctx, nil)
@@ -1357,6 +1389,10 @@
func TestAppWithSuidHelper(t *testing.T) {
ctx, shutdown := veyron2.Init()
defer shutdown()
+ ctx, err := veyron2.SetPrincipal(ctx, tsecurity.NewPrincipal("test-principal"))
+ if err != nil {
+ panic(err)
+ }
veyron2.GetNamespace(ctx).CacheCtl(naming.DisableCache(true))
sh, deferFn := mgmttest.CreateShellAndMountTable(t, ctx, nil)