sarafu-vise/testutil/gdbmdb.go

35 lines
583 B
Go
Raw Normal View History

2025-01-21 16:43:26 +01:00
//go:build testgdbmdb
2025-01-21 16:02:32 +01:00
// +build testgdbmdb
package testutil
import (
"net/url"
2025-01-21 16:43:26 +01:00
"os"
2025-01-21 16:02:32 +01:00
)
const (
testDbCookie = true
)
func init() {
stateDir, err := os.MkdirTemp("", "sarafu-vise-menutraversal-gdbm-state-")
if err != nil {
panic(err)
}
stateDir, err = url.JoinPath("gdbm:///", stateDir)
if err != nil {
panic(err)
}
2025-01-24 11:15:37 +01:00
override.StateConn = stateDir
2025-01-21 16:02:32 +01:00
userDir, err := os.MkdirTemp("", "sarafu-vise-menutraversal-gdbm-user-")
if err != nil {
panic(err)
}
userDir, err = url.JoinPath("gdbm:///", userDir)
if err != nil {
panic(err)
}
2025-01-24 11:15:37 +01:00
override.UserConn = userDir
2025-01-21 16:02:32 +01:00
}