Harden host deletion and test stability
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -13,6 +12,7 @@ import (
|
||||
"sub2api-cn-relay-manager/internal/host/sub2api"
|
||||
"sub2api-cn-relay-manager/internal/pack"
|
||||
"sub2api-cn-relay-manager/internal/store/sqlite"
|
||||
"sub2api-cn-relay-manager/internal/testutil"
|
||||
)
|
||||
|
||||
func TestRuntimeImportServicePersistsOperationalState(t *testing.T) {
|
||||
@@ -706,21 +706,12 @@ func TestRuntimeImportServiceImportReconcilesExistingChannelConfiguration(t *tes
|
||||
|
||||
func openProvisionTestStore(t *testing.T) *sqlite.DB {
|
||||
t.Helper()
|
||||
|
||||
dbPath := filepath.Join(t.TempDir(), "state.db")
|
||||
dsn := fmt.Sprintf("file:%s?_busy_timeout=5000&_pragma=foreign_keys(0)", filepath.ToSlash(dbPath))
|
||||
store, err := sqlite.Open(context.Background(), dsn)
|
||||
if err != nil {
|
||||
t.Fatalf("sqlite.Open() error = %v", err)
|
||||
}
|
||||
return store
|
||||
return testutil.OpenSQLiteStore(t, testutil.SQLiteTestDSN(t, "state.db", true))
|
||||
}
|
||||
|
||||
func closeProvisionTestStore(t *testing.T, store *sqlite.DB) {
|
||||
t.Helper()
|
||||
if err := store.Close(); err != nil {
|
||||
t.Fatalf("store.Close() error = %v", err)
|
||||
}
|
||||
testutil.CloseSQLiteStore(t, store)
|
||||
}
|
||||
|
||||
func seedProvisionHost(t *testing.T, store *sqlite.DB, hostID, baseURL string) int64 {
|
||||
|
||||
Reference in New Issue
Block a user