(pdir string)
| 31 | var KeyFile string |
| 32 | |
| 33 | func openDgraph(pdir string) (*badger.DB, error) { |
| 34 | // Get key. |
| 35 | config := viper.New() |
| 36 | flags := &pflag.FlagSet{} |
| 37 | x.RegisterEncFlag(flags) |
| 38 | if err := config.BindPFlags(flags); err != nil { |
| 39 | return nil, err |
| 40 | } |
| 41 | config.Set("encryption", x.BuildEncFlag(KeyFile)) |
| 42 | keys, err := x.GetEncAclKeys(config) |
| 43 | if err != nil { |
| 44 | return nil, err |
| 45 | } |
| 46 | |
| 47 | opt := badger.DefaultOptions(pdir). |
| 48 | WithBlockCacheSize(10 * (1 << 20)). |
| 49 | WithIndexCacheSize(10 * (1 << 20)). |
| 50 | WithEncryptionKey(keys.EncKey). |
| 51 | WithNamespaceOffset(x.NamespaceOffset) |
| 52 | return badger.OpenManaged(opt) |
| 53 | } |
| 54 | |
| 55 | func WaitForRestore(t *testing.T, dg *dgo.Dgraph, HttpSocket string) { |
| 56 | // Use a 10-minute overall deadline so the test fails quickly if the |
no test coverage detected