Skip to content

Commit 6368942

Browse files
authored
Merge pull request #1077 from entireio/prune-subsumed-strategy-tests
Prune subsumed tests in strategy package
2 parents 6c66968 + 072d69b commit 6368942

2 files changed

Lines changed: 0 additions & 138 deletions

File tree

‎cmd/entire/cli/strategy/common_test.go‎

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -23,88 +23,6 @@ import (
2323
"github.com/stretchr/testify/require"
2424
)
2525

26-
func TestOpenRepository(t *testing.T) {
27-
// Create a temporary directory for the test repository
28-
tmpDir := t.TempDir()
29-
30-
// Initialize a git repository
31-
repo, err := git.PlainInit(tmpDir, false)
32-
if err != nil {
33-
t.Fatalf("failed to init repo: %v", err)
34-
}
35-
36-
// Create a test file and commit it
37-
testFile := filepath.Join(tmpDir, "test.txt")
38-
if err := os.WriteFile(testFile, []byte("test content"), 0o644); err != nil {
39-
t.Fatalf("failed to write test file: %v", err)
40-
}
41-
42-
worktree, err := repo.Worktree()
43-
if err != nil {
44-
t.Fatalf("failed to get worktree: %v", err)
45-
}
46-
47-
if _, err := worktree.Add("test.txt"); err != nil {
48-
t.Fatalf("failed to add file: %v", err)
49-
}
50-
51-
if _, err := worktree.Commit("Initial commit", &git.CommitOptions{
52-
Author: &object.Signature{
53-
Name: "Test User",
54-
Email: "test@example.com",
55-
},
56-
}); err != nil {
57-
t.Fatalf("failed to commit: %v", err)
58-
}
59-
60-
// Change to the repository directory
61-
t.Chdir(tmpDir)
62-
63-
// Test OpenRepository
64-
openedRepo, err := OpenRepository(context.Background())
65-
if err != nil {
66-
t.Fatalf("OpenRepository(context.Background()) failed: %v", err)
67-
}
68-
69-
if openedRepo == nil {
70-
t.Fatal("OpenRepository(context.Background()) returned nil repository")
71-
}
72-
73-
// Verify we can perform basic operations
74-
head, err := openedRepo.Head()
75-
if err != nil {
76-
t.Fatalf("failed to get HEAD: %v", err)
77-
}
78-
79-
if head == nil {
80-
t.Fatal("HEAD is nil")
81-
}
82-
83-
// Verify we can get the commit
84-
commit, err := openedRepo.CommitObject(head.Hash())
85-
if err != nil {
86-
t.Fatalf("failed to get commit: %v", err)
87-
}
88-
89-
if commit.Message != "Initial commit" {
90-
t.Errorf("expected commit message 'Initial commit', got '%s'", commit.Message)
91-
}
92-
}
93-
94-
func TestOpenRepositoryError(t *testing.T) {
95-
// Create a temporary directory without git repository
96-
tmpDir := t.TempDir()
97-
98-
// Change to the non-repository directory
99-
t.Chdir(tmpDir)
100-
101-
// Test OpenRepository should fail
102-
_, err := OpenRepository(context.Background())
103-
if err == nil {
104-
t.Fatal("OpenRepository(context.Background()) should have failed in non-repository directory")
105-
}
106-
}
107-
10826
func TestWorktreeRoot_Cache(t *testing.T) {
10927
// Uses t.Chdir + t.Setenv so cannot be parallel.
11028
tmpDir := t.TempDir()

‎cmd/entire/cli/strategy/manual_commit_test.go‎

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,62 +1002,6 @@ func TestAddCheckpointTrailer_ExistingTrailers(t *testing.T) {
10021002
}
10031003
}
10041004

1005-
func TestCheckpointInfo_JSONRoundTrip(t *testing.T) {
1006-
original := CheckpointInfo{
1007-
CheckpointID: "a1b2c3d4e5f6",
1008-
SessionID: "session-123",
1009-
CreatedAt: time.Date(2025, 12, 2, 10, 0, 0, 0, time.UTC),
1010-
CheckpointsCount: 5,
1011-
FilesTouched: []string{"file1.go", "file2.go"},
1012-
}
1013-
1014-
data, err := json.Marshal(original)
1015-
if err != nil {
1016-
t.Fatalf("json.Marshal() error = %v", err)
1017-
}
1018-
1019-
var loaded CheckpointInfo
1020-
if err := json.Unmarshal(data, &loaded); err != nil {
1021-
t.Fatalf("json.Unmarshal() error = %v", err)
1022-
}
1023-
1024-
if loaded.CheckpointID != original.CheckpointID {
1025-
t.Errorf("CheckpointID = %q, want %q", loaded.CheckpointID, original.CheckpointID)
1026-
}
1027-
if loaded.SessionID != original.SessionID {
1028-
t.Errorf("SessionID = %q, want %q", loaded.SessionID, original.SessionID)
1029-
}
1030-
}
1031-
1032-
func TestSessionState_JSONRoundTrip(t *testing.T) {
1033-
original := SessionState{
1034-
SessionID: "session-123",
1035-
BaseCommit: "abc123def456",
1036-
StartedAt: time.Date(2025, 12, 2, 10, 0, 0, 0, time.UTC),
1037-
StepCount: 10,
1038-
}
1039-
1040-
data, err := json.Marshal(original)
1041-
if err != nil {
1042-
t.Fatalf("json.Marshal() error = %v", err)
1043-
}
1044-
1045-
var loaded SessionState
1046-
if err := json.Unmarshal(data, &loaded); err != nil {
1047-
t.Fatalf("json.Unmarshal() error = %v", err)
1048-
}
1049-
1050-
if loaded.SessionID != original.SessionID {
1051-
t.Errorf("SessionID = %q, want %q", loaded.SessionID, original.SessionID)
1052-
}
1053-
if loaded.BaseCommit != original.BaseCommit {
1054-
t.Errorf("BaseCommit = %q, want %q", loaded.BaseCommit, original.BaseCommit)
1055-
}
1056-
if loaded.StepCount != original.StepCount {
1057-
t.Errorf("StepCount = %d, want %d", loaded.StepCount, original.StepCount)
1058-
}
1059-
}
1060-
10611005
func TestShadowStrategy_GetCheckpointLog_WithCheckpointID(t *testing.T) {
10621006
// This test verifies that GetCheckpointLog correctly uses the checkpoint ID
10631007
// to look up the log. Since getCheckpointLog requires a full git setup

0 commit comments

Comments
 (0)