mirror of
https://github.com/safing/portmaster
synced 2025-04-21 11:29:09 +00:00
Fix tests
This commit is contained in:
parent
b8ab348095
commit
67cfefde9b
2 changed files with 2 additions and 2 deletions
|
@ -10,6 +10,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
|
"github.com/safing/portmaster/base/database/dbmodule"
|
||||||
"github.com/safing/portmaster/base/dataroot"
|
"github.com/safing/portmaster/base/dataroot"
|
||||||
"github.com/safing/portmaster/base/utils"
|
"github.com/safing/portmaster/base/utils"
|
||||||
"github.com/safing/portmaster/base/utils/debug"
|
"github.com/safing/portmaster/base/utils/debug"
|
||||||
|
@ -150,6 +151,7 @@ func InitializeUnitTestDataroot(testName string) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed to initialize dataroot: %w", err)
|
return "", fmt.Errorf("failed to initialize dataroot: %w", err)
|
||||||
}
|
}
|
||||||
|
dbmodule.SetDatabaseLocation(dataroot.Root())
|
||||||
|
|
||||||
return basePath, nil
|
return basePath, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"github.com/safing/portmaster/base/api"
|
"github.com/safing/portmaster/base/api"
|
||||||
"github.com/safing/portmaster/base/config"
|
"github.com/safing/portmaster/base/config"
|
||||||
"github.com/safing/portmaster/base/database/dbmodule"
|
"github.com/safing/portmaster/base/database/dbmodule"
|
||||||
"github.com/safing/portmaster/base/dataroot"
|
|
||||||
"github.com/safing/portmaster/base/notifications"
|
"github.com/safing/portmaster/base/notifications"
|
||||||
"github.com/safing/portmaster/service/updates"
|
"github.com/safing/portmaster/service/updates"
|
||||||
)
|
)
|
||||||
|
@ -57,7 +56,6 @@ func runTest(m *testing.M) error {
|
||||||
defer func() { _ = os.RemoveAll(ds) }()
|
defer func() { _ = os.RemoveAll(ds) }()
|
||||||
|
|
||||||
stub := &testInstance{}
|
stub := &testInstance{}
|
||||||
dbmodule.SetDatabaseLocation(dataroot.Root())
|
|
||||||
stub.db, err = dbmodule.New(stub)
|
stub.db, err = dbmodule.New(stub)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create database: %w", err)
|
return fmt.Errorf("failed to create database: %w", err)
|
||||||
|
|
Loading…
Add table
Reference in a new issue