Fix: llmapi use same db conn, delete old test;

This commit is contained in:
Grail Finder
2025-07-08 10:34:54 +03:00
parent 9a0e8d01ba
commit 587adfbbda
3 changed files with 2 additions and 26 deletions

View File

@ -39,7 +39,7 @@ func LoadConfigOrDefault(fn string) *Config {
config.CookieSecret = "test"
config.ServerConfig.Host = "localhost"
config.ServerConfig.Port = "3000"
config.DBPath = "sqlite3://gralias.db"
config.DBPath = "gralias.db"
}
fmt.Printf("config debug; config.LLMConfig.URL: %s\n", config.LLMConfig.URL)
return config

View File

@ -19,7 +19,7 @@ import (
var (
// botname -> channel
repo = repos.NewRepoProvider("sqlite3://../gralias.db")
repo = repos.RP
SignalChanMap = make(map[string]chan bool)
DoneChanMap = make(map[string]chan bool)
// got prompt: control character (\\u0000-\\u001F) found while parsing a string at line 4 column 0

View File

@ -1,24 +0,0 @@
package repos
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewRepoProvider(t *testing.T) {
// Create a temporary SQLite database file for testing
tmpDBFile := "./test_gralias.db"
defer os.Remove(tmpDBFile) // Clean up the temporary file after the test
// Initialize a new RepoProvider
repoProvider := NewRepoProvider(tmpDBFile)
// Assert that the DB connection is not nil
assert.NotNil(t, repoProvider.DB, "DB connection should not be nil")
// Close the database connection
err := repoProvider.DB.Close()
assert.NoError(t, err, "Error closing database connection")
}