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>
64 lines
1.7 KiB
Go
64 lines
1.7 KiB
Go
package testutil
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestTempDirInMemory(t *testing.T) {
|
|
tmpDir := TempDirInMemory(t)
|
|
|
|
// Verify directory exists
|
|
if stat, err := os.Stat(tmpDir); err != nil || !stat.IsDir() {
|
|
t.Fatalf("TempDirInMemory() did not create valid directory: %v", err)
|
|
}
|
|
|
|
// Verify it's a beads test directory
|
|
if !strings.Contains(filepath.Base(tmpDir), "beads-test") {
|
|
t.Errorf("Expected directory name to contain 'beads-test', got: %s", tmpDir)
|
|
}
|
|
|
|
// On Linux CI, verify we're using /dev/shm if available
|
|
if runtime.GOOS == "linux" {
|
|
if stat, err := os.Stat("/dev/shm"); err == nil && stat.IsDir() {
|
|
if !strings.HasPrefix(tmpDir, "/dev/shm") {
|
|
t.Errorf("On Linux with /dev/shm available, expected tmpDir to use it, got: %s", tmpDir)
|
|
} else {
|
|
t.Logf("✓ Using tmpfs ramdisk: %s", tmpDir)
|
|
}
|
|
}
|
|
} else {
|
|
t.Logf("Platform: %s, using standard temp: %s", runtime.GOOS, tmpDir)
|
|
}
|
|
|
|
// Verify cleanup happens
|
|
testFile := filepath.Join(tmpDir, "test.txt")
|
|
if err := os.WriteFile(testFile, []byte("test"), 0644); err != nil {
|
|
t.Fatalf("Failed to write test file: %v", err)
|
|
}
|
|
|
|
if _, err := os.Stat(testFile); err != nil {
|
|
t.Fatalf("Test file should exist: %v", err)
|
|
}
|
|
}
|
|
|
|
func TestTempDirInMemory_Cleanup(t *testing.T) {
|
|
var tmpDir string
|
|
|
|
// Run in subtest to trigger cleanup
|
|
t.Run("create", func(t *testing.T) {
|
|
tmpDir = TempDirInMemory(t)
|
|
if err := os.WriteFile(filepath.Join(tmpDir, "data"), []byte("test"), 0644); err != nil {
|
|
t.Fatalf("Failed to write file: %v", err)
|
|
}
|
|
})
|
|
|
|
// After subtest completes, cleanup should have run
|
|
if _, err := os.Stat(tmpDir); !os.IsNotExist(err) {
|
|
t.Errorf("Expected tmpDir to be cleaned up, but it still exists: %s", tmpDir)
|
|
}
|
|
}
|