Beispiel #1
0
        public void TestInmem()
        {
            using (var lf = VaultLogger.CreateLoggerFactory(LogLevel.Trace))
            {
                var logger = lf.CreateLogger <IBackend>();

                var inm = InmemBackendFactory.INSTANCE.CreateBackend(null, logger);
                PhysicalTests.TestBackend(inm);
                PhysicalTests.TestBackend_ListPrefix(inm);
            }
        }
Beispiel #2
0
        //~ func TestFileBackend(t *testing.T) {
        public void TestFileBackend()
        {
            //~ dir, err := ioutil.TempDir("", "vault")
            //~ if err != nil {
            //~     t.Fatalf("err: %s", err)
            //~ }
            //~ defer os.RemoveAll(dir)
            //~
            //~ logger := logformat.NewVaultLogger(log.LevelTrace)
            //~
            //~ b, err := NewBackend("file", logger, map[string]string{
            //~     "path": dir,
            //~ })
            //~ if err != nil {
            //~     t.Fatalf("err: %s", err)
            //~ }
            //~
            //~ testBackend(t, b)
            //~ testBackend_ListPrefix(t, b)

            using (var defer = new Util.Defer())
                using (var lf = VaultLogger.CreateLoggerFactory(LogLevel.Trace))
                {
                    var dir = Util.IO.Directory.CreateTempDir(prefix: "vault");
                    defer.Add(() =>
                    {
                        Debug.WriteLine($"WOULD DELETE ALL AT:  [{dir}]");
                        //Directory.Delete(dir, true);
                    });

                    lf.AddConsole(LogLevel.Trace);
                    var logger = lf.CreateLogger <FileBackend>();
                    var b      = Physical.Global.NewBackend("file", logger,
                                                            new Util.ConfigMap <string>
                    {
                        ["path"] = dir,
                    });

                    PhysicalTests.TestBackend(b);
                    PhysicalTests.TestBackend_ListPrefix(b);
                }
        }