mirror of
https://github.com/safing/portbase
synced 2025-09-10 15:34:26 +00:00
Complete database MVP
This commit is contained in:
parent
2c70416873
commit
ac13b73d65
12 changed files with 160 additions and 480 deletions
|
@ -30,6 +30,19 @@ func testDatabase(t *testing.T, storageType string) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// hook
|
||||
hook, err := RegisterHook(q.New(dbName).MustBeValid(), &HookBase{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// sub
|
||||
sub, err := Subscribe(q.New(dbName).MustBeValid())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// interface
|
||||
db := NewInterface(nil)
|
||||
|
||||
A := NewExample(makeKey(dbName, "A"), "Herbert", 411)
|
||||
|
@ -92,6 +105,15 @@ func testDatabase(t *testing.T, storageType string) {
|
|||
t.Fatal("expected two records")
|
||||
}
|
||||
|
||||
err = hook.Cancel()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err = sub.Cancel()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestDatabaseSystem(t *testing.T) {
|
||||
|
@ -99,7 +121,7 @@ func TestDatabaseSystem(t *testing.T) {
|
|||
// panic after 10 seconds, to check for locks
|
||||
go func() {
|
||||
time.Sleep(10 * time.Second)
|
||||
fmt.Println("===== TAKING TOO LONG FOR SHUTDOWN - PRINTING STACK TRACES =====")
|
||||
fmt.Println("===== TAKING TOO LONG - PRINTING STACK TRACES =====")
|
||||
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
|
||||
os.Exit(1)
|
||||
}()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue