fix: preserve OA configuration during database startup
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
"io"
|
||||
"kra/internal/config"
|
||||
"kra/internal/integration/storage"
|
||||
"log/slog"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDatabaseStartupPreservesBusinessOAConfiguration(t *testing.T) {
|
||||
runtime := config.NewStore(&config.Config{BusinessOA: &config.BusinessOA{URL: "http://oa.test", Key: "test-only-key"}, Data: &config.Data{Database: &config.Database{Driver: "sqlite", Source: filepath.Join(t.TempDir(), "startup.db")}}, Admin: &config.Admin{Local: &config.Local{StorePath: filepath.Join(t.TempDir(), "uploads")}}})
|
||||
manager, err := storage.NewFileStorage(runtime)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, cleanup, err := NewData(runtime, slog.New(slog.NewTextHandler(io.Discard, nil)), manager, testCatalog())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer cleanup()
|
||||
actual := runtime.Snapshot().BusinessOA
|
||||
if actual == nil || actual.URL != "http://oa.test" || actual.Key != "test-only-key" {
|
||||
t.Fatal("database startup discarded the OA service configuration")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user