mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-29 06:27:14 +00:00
test: name temp sqlite db x-ui.db to match the real db filename
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
|||||||
func TestSeedClientsFromInboundJSON_IsIdempotentAgainstExistingClients(t *testing.T) {
|
func TestSeedClientsFromInboundJSON_IsIdempotentAgainstExistingClients(t *testing.T) {
|
||||||
dbDir := t.TempDir()
|
dbDir := t.TempDir()
|
||||||
t.Setenv("XUI_DB_FOLDER", dbDir)
|
t.Setenv("XUI_DB_FOLDER", dbDir)
|
||||||
if err := InitDB(filepath.Join(dbDir, "3x-ui.db")); err != nil {
|
if err := InitDB(filepath.Join(dbDir, "x-ui.db")); err != nil {
|
||||||
t.Fatalf("InitDB failed: %v", err)
|
t.Fatalf("InitDB failed: %v", err)
|
||||||
}
|
}
|
||||||
t.Cleanup(func() { _ = CloseDB() })
|
t.Cleanup(func() { _ = CloseDB() })
|
||||||
@@ -74,7 +74,7 @@ func TestSeedClientsFromInboundJSON_IsIdempotentAgainstExistingClients(t *testin
|
|||||||
func TestNormalizeInboundClientSubId_FillsMissingAndPreservesExisting(t *testing.T) {
|
func TestNormalizeInboundClientSubId_FillsMissingAndPreservesExisting(t *testing.T) {
|
||||||
dbDir := t.TempDir()
|
dbDir := t.TempDir()
|
||||||
t.Setenv("XUI_DB_FOLDER", dbDir)
|
t.Setenv("XUI_DB_FOLDER", dbDir)
|
||||||
if err := InitDB(filepath.Join(dbDir, "3x-ui.db")); err != nil {
|
if err := InitDB(filepath.Join(dbDir, "x-ui.db")); err != nil {
|
||||||
t.Fatalf("InitDB failed: %v", err)
|
t.Fatalf("InitDB failed: %v", err)
|
||||||
}
|
}
|
||||||
t.Cleanup(func() { _ = CloseDB() })
|
t.Cleanup(func() { _ = CloseDB() })
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func setupIntegrationDB(t *testing.T) {
|
|||||||
log.SetFlags(origLogFlags)
|
log.SetFlags(origLogFlags)
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := database.InitDB(filepath.Join(dbDir, "3x-ui.db")); err != nil {
|
if err := database.InitDB(filepath.Join(dbDir, "x-ui.db")); err != nil {
|
||||||
t.Fatalf("database.InitDB failed: %v", err)
|
t.Fatalf("database.InitDB failed: %v", err)
|
||||||
}
|
}
|
||||||
// LIFO cleanup order: this runs before t.TempDir's own cleanup.
|
// LIFO cleanup order: this runs before t.TempDir's own cleanup.
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func TestClientWithInboundFlow_GatesByInboundCapability(t *testing.T) {
|
|||||||
func TestFlowIsolation_VisionDoesNotLeakToWsInbound(t *testing.T) {
|
func TestFlowIsolation_VisionDoesNotLeakToWsInbound(t *testing.T) {
|
||||||
dbDir := t.TempDir()
|
dbDir := t.TempDir()
|
||||||
t.Setenv("XUI_DB_FOLDER", dbDir)
|
t.Setenv("XUI_DB_FOLDER", dbDir)
|
||||||
if err := database.InitDB(filepath.Join(dbDir, "3x-ui.db")); err != nil {
|
if err := database.InitDB(filepath.Join(dbDir, "x-ui.db")); err != nil {
|
||||||
t.Fatalf("InitDB: %v", err)
|
t.Fatalf("InitDB: %v", err)
|
||||||
}
|
}
|
||||||
t.Cleanup(func() { _ = database.CloseDB() })
|
t.Cleanup(func() { _ = database.CloseDB() })
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
func TestSyncInbound_PreservesCredentialsAcrossProtocols(t *testing.T) {
|
func TestSyncInbound_PreservesCredentialsAcrossProtocols(t *testing.T) {
|
||||||
dbDir := t.TempDir()
|
dbDir := t.TempDir()
|
||||||
t.Setenv("XUI_DB_FOLDER", dbDir)
|
t.Setenv("XUI_DB_FOLDER", dbDir)
|
||||||
if err := database.InitDB(filepath.Join(dbDir, "3x-ui.db")); err != nil {
|
if err := database.InitDB(filepath.Join(dbDir, "x-ui.db")); err != nil {
|
||||||
t.Fatalf("InitDB: %v", err)
|
t.Fatalf("InitDB: %v", err)
|
||||||
}
|
}
|
||||||
t.Cleanup(func() { _ = database.CloseDB() })
|
t.Cleanup(func() { _ = database.CloseDB() })
|
||||||
@@ -74,7 +74,7 @@ func TestSyncInbound_PreservesCredentialsAcrossProtocols(t *testing.T) {
|
|||||||
func TestSyncInbound_AllowsClearingFlow(t *testing.T) {
|
func TestSyncInbound_AllowsClearingFlow(t *testing.T) {
|
||||||
dbDir := t.TempDir()
|
dbDir := t.TempDir()
|
||||||
t.Setenv("XUI_DB_FOLDER", dbDir)
|
t.Setenv("XUI_DB_FOLDER", dbDir)
|
||||||
if err := database.InitDB(filepath.Join(dbDir, "3x-ui.db")); err != nil {
|
if err := database.InitDB(filepath.Join(dbDir, "x-ui.db")); err != nil {
|
||||||
t.Fatalf("InitDB: %v", err)
|
t.Fatalf("InitDB: %v", err)
|
||||||
}
|
}
|
||||||
t.Cleanup(func() { _ = database.CloseDB() })
|
t.Cleanup(func() { _ = database.CloseDB() })
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func setupConflictDB(t *testing.T) {
|
|||||||
|
|
||||||
dbDir := t.TempDir()
|
dbDir := t.TempDir()
|
||||||
t.Setenv("XUI_DB_FOLDER", dbDir)
|
t.Setenv("XUI_DB_FOLDER", dbDir)
|
||||||
if err := database.InitDB(filepath.Join(dbDir, "3x-ui.db")); err != nil {
|
if err := database.InitDB(filepath.Join(dbDir, "x-ui.db")); err != nil {
|
||||||
t.Fatalf("InitDB: %v", err)
|
t.Fatalf("InitDB: %v", err)
|
||||||
}
|
}
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user