v2 tests fix (#1956)

* v2 tests fix
* test: added tests for sqlite
This commit is contained in:
Alexandr Stelnykovych
2025-08-07 02:04:38 +03:00
committed by GitHub
parent 5609594b2a
commit 58f4058633
15 changed files with 347 additions and 447 deletions

View File

@@ -22,31 +22,24 @@ type testInstance struct {
base *base.Base
}
func (stub *testInstance) Config() *config.Config {
return stub.config
}
func (stub *testInstance) SPNGroup() *mgr.ExtendedGroup {
return nil
}
func (stub *testInstance) Stopping() bool {
return false
}
func (stub *testInstance) Ready() bool {
return true
}
func (stub *testInstance) Config() *config.Config { return stub.config }
func (stub *testInstance) SPNGroup() *mgr.ExtendedGroup { return nil }
func (stub *testInstance) Stopping() bool { return false }
func (stub *testInstance) Ready() bool { return true }
func (stub *testInstance) SetCmdLineOperation(f func() error) {}
func (stub *testInstance) DataDir() string { return _dataDir }
var _dataDir string
func runTest(m *testing.M) error {
api.SetDefaultAPIListenAddress("0.0.0.0:8080")
// Initialize dataroot
ds, err := config.InitializeUnitTestDataroot("test-cabin")
var err error
// Create a temporary directory for the data
_dataDir, err = os.MkdirTemp("", "")
if err != nil {
return fmt.Errorf("failed to initialize dataroot: %w", err)
}
defer func() { _ = os.RemoveAll(ds) }()
defer func() { _ = os.RemoveAll(_dataDir) }()
// Init
instance := &testInstance{}