Bogdan Caprita | d820405 | 2015-01-28 10:40:34 -0800 | [diff] [blame] | 1 | package impl_test |
| 2 | |
| 3 | import ( |
| 4 | "v.io/core/veyron2" |
| 5 | "v.io/core/veyron2/context" |
| 6 | |
| 7 | "v.io/core/veyron/lib/testutil/security" |
| 8 | _ "v.io/core/veyron/profiles" |
| 9 | "v.io/core/veyron/tools/mgmt/device/impl" |
| 10 | ) |
| 11 | |
| 12 | var gctx *context.T |
| 13 | |
| 14 | func initTest() veyron2.Shutdown { |
| 15 | ctx, shutdown := veyron2.Init() |
| 16 | var err error |
| 17 | if ctx, err = veyron2.SetPrincipal(ctx, security.NewPrincipal("test-blessing")); err != nil { |
| 18 | panic(err) |
| 19 | } |
| 20 | gctx = ctx |
| 21 | impl.SetGlobalContext(gctx) |
| 22 | return func() { |
| 23 | shutdown() |
| 24 | impl.SetGlobalContext(nil) |
| 25 | gctx = nil |
| 26 | } |
| 27 | } |