Add Phase 1 foundation: Go module, core types, DB infrastructure, config
Establish the project foundation with three packages: - core: shared types (Header, Metadata, Value, ObjectType, UUID generation) - db: SQLite migration framework, connection management (WAL, FK, busy timeout), transaction helpers (StartTX/EndTX), time conversion - config: runtime configuration (DB path, blob store, Minio, gRPC addr) Includes initial schema migration (001_initial.sql) with 13 tables covering shared infrastructure, bibliographic data, and artifact repository. Full test coverage for all packages, strict linting (.golangci.yaml), and Makefile. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
39
config/config_test.go
Normal file
39
config/config_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDefault(t *testing.T) {
|
||||
cfg := Default()
|
||||
if cfg.BasePath == "" {
|
||||
t.Fatal("BasePath is empty")
|
||||
}
|
||||
if !strings.HasSuffix(cfg.BasePath, "exo") {
|
||||
t.Fatalf("BasePath should end with 'exo', got %q", cfg.BasePath)
|
||||
}
|
||||
if cfg.DatabasePath == "" {
|
||||
t.Fatal("DatabasePath is empty")
|
||||
}
|
||||
if cfg.BlobStorePath == "" {
|
||||
t.Fatal("BlobStorePath is empty")
|
||||
}
|
||||
if cfg.GRPCListenAddr == "" {
|
||||
t.Fatal("GRPCListenAddr is empty")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFromBasePath(t *testing.T) {
|
||||
cfg := FromBasePath("/tmp/testexo")
|
||||
if cfg.BasePath != "/tmp/testexo" {
|
||||
t.Fatalf("expected BasePath '/tmp/testexo', got %q", cfg.BasePath)
|
||||
}
|
||||
if cfg.DatabasePath != filepath.Join("/tmp/testexo", "exo.db") {
|
||||
t.Fatalf("unexpected DatabasePath: %q", cfg.DatabasePath)
|
||||
}
|
||||
if cfg.BlobStorePath != filepath.Join("/tmp/testexo", "blobs") {
|
||||
t.Fatalf("unexpected BlobStorePath: %q", cfg.BlobStorePath)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user