From f93d44c5d169a0cbbf15fbe6e14253dab1eab99c Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Wed, 11 Feb 2026 10:56:47 -0500 Subject: [PATCH] fix(tests): make collection names unique in bulk operations tests - Fix TestCollectionsBulkOperations/BulkAddBooks_SingleOperation failure - Each subtest was creating "Test Collection" with same name - Collections table has UNIQUE(user_id, name) constraint causing 500 errors - Made collection names unique by adding test name suffix: - Test Collection - InvalidBookID - Test Collection - SingleOperation - Test Collection - MultipleBooksSingleCollection - Test Collection 1 - MultipleCollections - Test Collection 2 - MultipleCollections - Test Collection - DuplicateBooks This preserves test data for manual API testing with Bruno while ensuring test isolation and preventing unique constraint violations. --- cmd/server/tests/collections_bulk_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/server/tests/collections_bulk_test.go b/cmd/server/tests/collections_bulk_test.go index f31b7ef..127ce68 100644 --- a/cmd/server/tests/collections_bulk_test.go +++ b/cmd/server/tests/collections_bulk_test.go @@ -96,7 +96,7 @@ func TestCollectionsBulkOperations(t *testing.T) { t.Run("BulkAddBooks_InvalidBookID", func(t *testing.T) { // Create a collection first collectionReq := map[string]interface{}{ - "name": "Test Collection", + "name": "Test Collection - InvalidBookID", "description": "A test collection", } collectionBody, _ := json.Marshal(collectionReq) @@ -145,7 +145,7 @@ func TestCollectionsBulkOperations(t *testing.T) { t.Run("BulkAddBooks_SingleOperation", func(t *testing.T) { // Create a collection collectionReq := map[string]interface{}{ - "name": "Test Collection", + "name": "Test Collection - SingleOperation", "description": "A test collection", } collectionBody, _ := json.Marshal(collectionReq) @@ -202,7 +202,7 @@ func TestCollectionsBulkOperations(t *testing.T) { t.Run("BulkAddBooks_MultipleBooksSingleCollection", func(t *testing.T) { // Create a collection collectionReq := map[string]interface{}{ - "name": "Test Collection", + "name": "Test Collection - MultipleBooksSingleCollection", "description": "A test collection", } collectionBody, _ := json.Marshal(collectionReq) @@ -255,7 +255,7 @@ func TestCollectionsBulkOperations(t *testing.T) { t.Run("BulkAddBooks_MultipleCollections", func(t *testing.T) { // Create multiple collections collectionReq := map[string]interface{}{ - "name": "Test Collection 1", + "name": "Test Collection 1 - MultipleCollections", "description": "First test collection", } collectionBody, _ := json.Marshal(collectionReq) @@ -273,7 +273,7 @@ func TestCollectionsBulkOperations(t *testing.T) { collectionID1 := collectionResult1["id"].(string) collectionReq2 := map[string]interface{}{ - "name": "Test Collection 2", + "name": "Test Collection 2 - MultipleCollections", "description": "Second test collection", } collectionBody2, _ := json.Marshal(collectionReq2) @@ -329,7 +329,7 @@ func TestCollectionsBulkOperations(t *testing.T) { t.Run("BulkAddBooks_DuplicateBooks", func(t *testing.T) { // Create a collection collectionReq := map[string]interface{}{ - "name": "Test Collection", + "name": "Test Collection - DuplicateBooks", "description": "A test collection", } collectionBody, _ := json.Marshal(collectionReq)