gitgram/aitimemachine/beads/cmd/bd/dolt_doctor_integration_test.go
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

78 lines
2.8 KiB
Go

//go:build cgo && integration
package main
import (
"os"
"path/filepath"
"runtime"
"strings"
"testing"
)
func TestDoltDoctor_NoSQLiteWarningsAfterInitAndCreate(t *testing.T) {
if runtime.GOOS == windowsOS {
t.Skip("dolt doctor integration test not supported on windows")
}
tmpDir := createTempDirWithCleanup(t)
// Set up a real git repo so init/create/doctor behave normally.
if err := runCommandInDir(tmpDir, "git", "init"); err != nil {
t.Fatalf("git init failed: %v", err)
}
_ = runCommandInDir(tmpDir, "git", "config", "user.email", "test@example.com")
_ = runCommandInDir(tmpDir, "git", "config", "user.name", "Test User")
if testDoltServerPort == 0 {
t.Skip("skipping: Dolt test container not available")
}
env := append(os.Environ(), "BEADS_TEST_MODE=1")
// Init dolt backend.
initOut, initErr := runBDExecAllowErrorWithEnv(t, tmpDir, env, "init", "--backend", "dolt", "--prefix", "test", "--quiet")
if initErr != nil {
// If dolt backend isn't available in this build, skip rather than fail.
lower := strings.ToLower(initOut)
if strings.Contains(lower, "dolt") && (strings.Contains(lower, "not supported") || strings.Contains(lower, "not available") || strings.Contains(lower, "unknown")) {
t.Skipf("dolt backend not available: %s", initOut)
}
t.Fatalf("bd init --backend dolt failed: %v\n%s", initErr, initOut)
}
// Create one issue so the store is definitely initialized.
createOut, createErr := runBDExecAllowErrorWithEnv(t, tmpDir, env, "create", "doctor dolt smoke", "--json")
if createErr != nil {
t.Fatalf("bd create failed: %v\n%s", createErr, createOut)
}
// Run doctor; it may return non-zero for unrelated warnings (upstream, claude, etc),
// but it should NOT include SQLite-only failures on dolt.
doctorOut, _ := runBDExecAllowErrorWithEnv(t, tmpDir, env, "doctor")
// Also include stderr-like output if doctor wrote it to stdout in some modes.
// (CombinedOutput already captures both.)
for _, forbidden := range []string{
"No beads.db found",
"Unable to read database version",
"Legacy database",
} {
if strings.Contains(doctorOut, forbidden) {
t.Fatalf("bd doctor printed sqlite-specific warning %q in dolt mode; output:\n%s", forbidden, doctorOut)
}
}
// Sanity check: doctor should mention dolt somewhere so we know we exercised the right path.
if !strings.Contains(strings.ToLower(doctorOut), "dolt") {
// Some doctor output is terse depending on flags; don't be too strict, but
// if it's completely missing, that usually means we didn't use dolt config.
t.Fatalf("bd doctor output did not mention dolt; output:\n%s", doctorOut)
}
// Regression check: dolt init must NOT create a SQLite database file.
if _, err := os.Stat(filepath.Join(tmpDir, ".beads", "beads.db")); err == nil {
t.Fatalf("unexpected sqlite database created in dolt mode: %s", filepath.Join(tmpDir, ".beads", "beads.db"))
}
}