go-vise

Constrained Size Output Virtual Machine
Info | Log | Files | Refs | README | LICENSE

commit ad80e6e1a19fee0fbd4601ae41c93a5b6f54a252
parent 23db5d74860604bb92392184393924a8cd7c1b8c
Author: lash <dev@holbrook.no>
Date:   Sun,  1 Sep 2024 19:15:07 +0100

Run test driver for all db types

Diffstat:
Mdb/fs_test.go | 19+++++++++++++++++++
Mdb/gdbm_test.go | 19+++++++++++++++++++
Mdb/pg_test.go | 17+++++++++++++++++
3 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/db/fs_test.go b/db/fs_test.go @@ -9,6 +9,25 @@ import ( "testing" ) +func TestCasesFs(t *testing.T) { + ctx := context.Background() + + db := NewFsDb() + d, err := ioutil.TempDir("", "vise-db-fs-*") + if err != nil { + t.Fatal(err) + } + err = db.Connect(ctx, d) + if err != nil { + t.Fatal(err) + } + + err = runTests(t, ctx, db) + if err != nil { + t.Fatal(err) + } +} + func TestPutGetFs(t *testing.T) { var dbi Db ctx := context.Background() diff --git a/db/gdbm_test.go b/db/gdbm_test.go @@ -7,6 +7,25 @@ import ( "testing" ) +func TestCasesGdbm(t *testing.T) { + ctx := context.Background() + + db := NewGdbmDb() + f, err := ioutil.TempFile("", "vise-db-gdbm-*") + if err != nil { + t.Fatal(err) + } + err = db.Connect(ctx, f.Name()) + if err != nil { + t.Fatal(err) + } + + err = runTests(t, ctx, db) + if err != nil { + t.Fatal(err) + } +} + func TestPutGetGdbm(t *testing.T) { var dbi Db ctx := context.Background() diff --git a/db/pg_test.go b/db/pg_test.go @@ -6,6 +6,23 @@ import ( "testing" ) +func TestCasesPg(t *testing.T) { + ctx := context.Background() + + db := NewPgDb().WithSchema("vvise") + t.Skip("need postgresql mock") + + err := db.Connect(ctx, "postgres://vise:esiv@localhost:5432/visedb") + if err != nil { + t.Fatal(err) + } + + err = runTests(t, ctx, db) + if err != nil { + t.Fatal(err) + } +} + func TestPutGetPg(t *testing.T) { var dbi Db ses := "xyzzy"