Delete dead test helpers and rename vestigial test paths

- Remove seed_helpers.go (SeedTestMessage, SeedTestMessages,
  SeedTestCursor — all unused, channel/message features gutted)
- Rename channel- prefixed test paths to test- in storage tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-27 13:06:40 +00:00
parent 57c981d52d
commit 8e40f04445
3 changed files with 9 additions and 71 deletions

View File

@@ -1,62 +0,0 @@
package database
import (
"strings"
"testing"
)
// ── Additional Test Seed Helpers (v0.15.0) ──
// SeedTestMessage creates a single message in a channel and returns the message ID.
func SeedTestMessage(t *testing.T, channelID, parentID, role, content string) string {
t.Helper()
var id string
var parentPtr *string
if parentID != "" {
parentPtr = &parentID
}
err := DB.QueryRow(`
INSERT INTO messages (channel_id, parent_id, role, content, sibling_index)
VALUES ($1, $2, $3, $4, 0)
RETURNING id
`, channelID, parentPtr, role, content).Scan(&id)
if err != nil {
t.Fatalf("SeedTestMessage: %v", err)
}
return id
}
// SeedTestMessages creates a linear chain of alternating user/assistant messages.
// Returns all message IDs in order. The first message has no parent.
func SeedTestMessages(t *testing.T, channelID string, count int, contentSize int) []string {
t.Helper()
content := strings.Repeat("x", contentSize)
ids := make([]string, 0, count)
parentID := ""
for i := 0; i < count; i++ {
role := "user"
if i%2 == 1 {
role = "assistant"
}
id := SeedTestMessage(t, channelID, parentID, role, content)
ids = append(ids, id)
parentID = id
}
return ids
}
// SeedTestCursor sets the active leaf for a user in a channel.
func SeedTestCursor(t *testing.T, channelID, userID, leafID string) {
t.Helper()
_, err := DB.Exec(`
INSERT INTO channel_cursors (channel_id, user_id, active_leaf_id)
VALUES ($1, $2, $3)
ON CONFLICT (channel_id, user_id)
DO UPDATE SET active_leaf_id = $3, updated_at = NOW()
`, channelID, userID, leafID)
if err != nil {
t.Fatalf("SeedTestCursor: %v", err)
}
}

View File

@@ -24,7 +24,7 @@ func TestPVC_PutGetRoundTrip(t *testing.T) {
ctx := context.Background()
data := []byte("hello, storage world")
key := "files/channel-1/att-1_test.txt"
key := "files/test-1/att-1_test.txt"
// Put
err := s.Put(ctx, key, bytes.NewReader(data), int64(len(data)), "text/plain")
@@ -129,18 +129,18 @@ func TestPVC_DeletePrefix(t *testing.T) {
ctx := context.Background()
// Create several files under a channel prefix
prefix := "files/channel-abc/"
prefix := "files/test-abc/"
for _, name := range []string{"a.txt", "b.png", "c.pdf"} {
key := prefix + name
_ = s.Put(ctx, key, bytes.NewReader([]byte("x")), 1, "text/plain")
}
// Also create a file in a different channel
other := "files/channel-other/keep.txt"
other := "files/test-other/keep.txt"
_ = s.Put(ctx, other, bytes.NewReader([]byte("y")), 1, "text/plain")
// Delete the channel prefix
err := s.DeletePrefix(ctx, "files/channel-abc")
err := s.DeletePrefix(ctx, "files/test-abc")
if err != nil {
t.Fatalf("DeletePrefix: %v", err)
}

View File

@@ -78,7 +78,7 @@ func TestS3_KeyValidation(t *testing.T) {
good := []string{
"files/ch/f.txt",
"files/channel-1/att-abc_test.pdf",
"files/test-1/att-abc_test.pdf",
"processing/abc123/status.json",
}
for _, key := range good {
@@ -145,7 +145,7 @@ func TestS3_Integration_PutGetRoundTrip(t *testing.T) {
ctx := context.Background()
data := []byte("hello, S3 storage world")
key := "files/channel-1/att-1_test.txt"
key := "files/test-1/att-1_test.txt"
err := s.Put(ctx, key, bytes.NewReader(data), int64(len(data)), "text/plain")
if err != nil {
@@ -214,16 +214,16 @@ func TestS3_Integration_DeletePrefix(t *testing.T) {
s := testS3Store(t)
ctx := context.Background()
prefix := "files/channel-abc/"
prefix := "files/test-abc/"
for _, name := range []string{"a.txt", "b.png", "c.pdf"} {
key := prefix + name
_ = s.Put(ctx, key, bytes.NewReader([]byte("x")), 1, "text/plain")
}
other := "files/channel-other/keep.txt"
other := "files/test-other/keep.txt"
_ = s.Put(ctx, other, bytes.NewReader([]byte("y")), 1, "text/plain")
err := s.DeletePrefix(ctx, "files/channel-abc")
err := s.DeletePrefix(ctx, "files/test-abc")
if err != nil {
t.Fatalf("DeletePrefix: %v", err)
}