Files
beads/internal/rpc/comments_test.go
Steve Yegge 82902432f5 test: Tag 16 slow integration tests with build tags
Identified and tagged obviously-slow integration tests with
`//go:build integration` to exclude them from default test runs.

This is step 1 of fixing test performance. The real fix is in
bd-1rh: refactoring tests to use shared DB setup instead of
creating 279 separate databases.

Tagged files:
- cmd/bd: 8 files (CLI tests, git ops, performance benchmarks)
- internal: 8 files (integration tests, E2E tests)

Issues:
- bd-1rh: Main issue tracking test performance
- bd-c49: Audit all tests and create grouping plan (next step)
- bd-y6d: POC refactor of create_test.go

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 14:40:22 -05:00

72 lines
1.6 KiB
Go

//go:build integration
// +build integration
package rpc
import (
"encoding/json"
"testing"
"github.com/steveyegge/beads/internal/types"
)
func TestCommentOperationsViaRPC(t *testing.T) {
if testing.Short() {
t.Skip("skipping slow RPC test in short mode")
}
_, client, cleanup := setupTestServer(t)
defer cleanup()
createResp, err := client.Create(&CreateArgs{
Title: "Comment test",
IssueType: "task",
Priority: 2,
})
if err != nil {
t.Fatalf("create issue failed: %v", err)
}
var created types.Issue
if err := json.Unmarshal(createResp.Data, &created); err != nil {
t.Fatalf("failed to decode create response: %v", err)
}
if created.ID == "" {
t.Fatal("expected issue ID to be set")
}
addResp, err := client.AddComment(&CommentAddArgs{
ID: created.ID,
Author: "tester",
Text: "first comment",
})
if err != nil {
t.Fatalf("add comment failed: %v", err)
}
var added types.Comment
if err := json.Unmarshal(addResp.Data, &added); err != nil {
t.Fatalf("failed to decode add comment response: %v", err)
}
if added.Text != "first comment" {
t.Fatalf("expected comment text 'first comment', got %q", added.Text)
}
listResp, err := client.ListComments(&CommentListArgs{ID: created.ID})
if err != nil {
t.Fatalf("list comments failed: %v", err)
}
var comments []*types.Comment
if err := json.Unmarshal(listResp.Data, &comments); err != nil {
t.Fatalf("failed to decode comment list: %v", err)
}
if len(comments) != 1 {
t.Fatalf("expected 1 comment, got %d", len(comments))
}
if comments[0].Text != "first comment" {
t.Fatalf("expected comment text 'first comment', got %q", comments[0].Text)
}
}