=== RUN   TestDuplicatePlaylist_Success
2025/12/07 11:38:32 github.com/testcontainers/testcontainers-go - Connected to docker: 
  Server Version: 28.1.1
  API Version: 1.46
  Operating System: Fedora Linux 40 (Workstation Edition)
  Total Memory: 15703 MB
  Testcontainers for Go Version: v0.33.0
  Resolved Docker Host: unix:///var/run/docker.sock
  Resolved Docker Socket Path: /var/run/docker.sock
  Test SessionID: ab58b9d3320075a141f918c98803ff9c8ae90abfec9a020064ae28bec5b82496
  Test ProcessID: c4f2ba27-0849-4034-9d19-40d1ca65fdbe
2025/12/07 11:38:32 🐳 Creating container for image testcontainers/ryuk:0.8.1
2025/12/07 11:38:42 ✅ Container created: 5ae9e99b5196
2025/12/07 11:38:42 🐳 Starting container: 5ae9e99b5196
2025/12/07 11:38:42 ✅ Container started: 5ae9e99b5196
2025/12/07 11:38:42 ⏳ Waiting for container id 5ae9e99b5196 image: testcontainers/ryuk:0.8.1. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms skipInternalCheck:false}
2025/12/07 11:38:43 🔔 Container is ready: 5ae9e99b5196
2025/12/07 11:38:43 🐳 Creating container for image postgres:15-alpine
2025/12/07 11:38:52 ✅ Container created: 8afa6e529142
2025/12/07 11:39:49 🐳 Starting container: 8afa6e529142
2025/12/07 11:39:49 ✅ Container started: 8afa6e529142
2025/12/07 11:39:49 ⏳ Waiting for container id 8afa6e529142 image: postgres:15-alpine. Waiting for: &{timeout:<nil> deadline:0xc000294fb8 Strategies:[0xc00029e960]}
2025/12/07 11:39:52 🔔 Container is ready: 8afa6e529142

2025/12/07 11:39:53 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/services/playlist_duplicate_service.go:115 [35;1mERROR: insert or update on table "playlist_tracks" violates foreign key constraint "playlist_tracks_added_by_fkey" (SQLSTATE 23503)
[0m[33m[1.211ms] [34;1m[rows:0][0m INSERT INTO "playlist_tracks" ("id","playlist_id","track_id","position","added_by","added_at") VALUES ('7646d9aa-8d4b-4337-87e0-5aed63b43028','ffdd7508-6cf4-469f-a895-18b9b1dacaf5','f9180654-7acd-40d2-bf5c-fe03f4ce7c8a',1,'00000000-0000-0000-0000-000000000000','2025-12-07 11:39:53.92')
    playlist_duplicate_transaction_test.go:158: 
        	Error Trace:	/home/senke/Documents/veza/veza-backend-api/tests/transactions/playlist_duplicate_transaction_test.go:158
        	Error:      	Received unexpected error:
        	            	DuplicatePlaylist: failed to add track f9180654-7acd-40d2-bf5c-fe03f4ce7c8a to duplicate: ERROR: insert or update on table "playlist_tracks" violates foreign key constraint "playlist_tracks_added_by_fkey" (SQLSTATE 23503)
        	Test:       	TestDuplicatePlaylist_Success
        	Messages:   	DuplicatePlaylist should succeed
--- FAIL: TestDuplicatePlaylist_Success (81.19s)
=== RUN   TestDuplicatePlaylist_RollbackOnPlaylistNotFound

2025/12/07 11:39:54 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/services/playlist_duplicate_service.go:56 [35;1mrecord not found
[0m[33m[2.777ms] [34;1m[rows:0][0m SELECT * FROM "playlists" WHERE id = 'a25682a4-2fb1-450a-b495-78f2be6a3ad6' AND "playlists"."deleted_at" IS NULL ORDER BY "playlists"."id" LIMIT 1
--- PASS: TestDuplicatePlaylist_RollbackOnPlaylistNotFound (0.79s)
=== RUN   TestDuplicatePlaylist_RollbackOnTrackError

2025/12/07 11:39:55 [31;1m/home/senke/Documents/veza/veza-backend-api/tests/transactions/playlist_duplicate_transaction_test.go:239 [35;1mERROR: missing FROM-clause entry for table "tracks" (SQLSTATE 42P01)
[0m[33m[0.565ms] [34;1m[rows:1][0m SELECT * FROM "playlist_tracks" WHERE playlist_id = '4b2dddb7-4013-43cf-9c88-d537f91bc49d' AND "tracks"."id" IN (NULL) AND "playlist_tracks"."deleted_at" IS NULL ORDER BY position ASC,"playlist_tracks"."id" LIMIT 1

2025/12/07 11:39:55 [31;1m/home/senke/Documents/veza/veza-backend-api/tests/transactions/playlist_duplicate_transaction_test.go:242 [35;1mWHERE conditions required
[0m[33m[0.652ms] [34;1m[rows:0][0m UPDATE "tracks" SET "deleted_at"='2025-12-07 11:39:55.458' WHERE "tracks"."deleted_at" IS NULL

2025/12/07 11:39:55 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/services/playlist_duplicate_service.go:115 [35;1mERROR: insert or update on table "playlist_tracks" violates foreign key constraint "playlist_tracks_added_by_fkey" (SQLSTATE 23503)
[0m[33m[1.045ms] [34;1m[rows:0][0m INSERT INTO "playlist_tracks" ("id","playlist_id","track_id","position","added_by","added_at") VALUES ('64d8c1e2-7ff1-4c28-89ad-a382f7a8b05f','e5f6d0e6-eb19-42c9-a1a9-8874462531d9','6440b55d-f440-4fb6-b313-5b41dea5e320',1,'00000000-0000-0000-0000-000000000000','2025-12-07 11:39:55.462')
--- PASS: TestDuplicatePlaylist_RollbackOnTrackError (0.79s)
=== RUN   TestDuplicatePlaylist_Coherence

2025/12/07 11:39:56 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/services/playlist_duplicate_service.go:115 [35;1mERROR: insert or update on table "playlist_tracks" violates foreign key constraint "playlist_tracks_added_by_fkey" (SQLSTATE 23503)
[0m[33m[0.749ms] [34;1m[rows:0][0m INSERT INTO "playlist_tracks" ("id","playlist_id","track_id","position","added_by","added_at") VALUES ('4278d64a-c7b4-412a-92c2-58afa6583eba','a1c67e05-3691-4840-9e6c-d5bdaa76a118','f1bbf3ae-49dc-4e86-863d-07208dc3225f',1,'00000000-0000-0000-0000-000000000000','2025-12-07 11:39:56.343')
    playlist_duplicate_transaction_test.go:299: 
        	Error Trace:	/home/senke/Documents/veza/veza-backend-api/tests/transactions/playlist_duplicate_transaction_test.go:299
        	Error:      	Received unexpected error:
        	            	DuplicatePlaylist: failed to add track f1bbf3ae-49dc-4e86-863d-07208dc3225f to duplicate: ERROR: insert or update on table "playlist_tracks" violates foreign key constraint "playlist_tracks_added_by_fkey" (SQLSTATE 23503)
        	Test:       	TestDuplicatePlaylist_Coherence
--- FAIL: TestDuplicatePlaylist_Coherence (0.88s)
=== RUN   TestDuplicatePlaylist_EmptyPlaylist
    logger.go:146: 2025-12-07T11:39:57.018+0100	INFO	Playlist duplicated	{"original_playlist_id": "cc5bc09b-1401-4de0-98ed-03c273d40ca5", "new_playlist_id": "cf99e993-d133-4b46-b75a-82c6b34567d8", "user_id": "4944519c-0db7-4452-8e32-cabfb5ab85a3", "tracks_count": 0}
--- PASS: TestDuplicatePlaylist_EmptyPlaylist (0.62s)
=== RUN   TestAssignRoleToUser_Success

2025/12/07 11:39:57 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/services/rbac_service.go:195 [35;1mrecord not found
[0m[33m[2.161ms] [34;1m[rows:0][0m SELECT * FROM "user_roles" WHERE user_id = '9adf7145-8c3c-48a3-87b3-0e37761b7bca' AND role_id = '5c4bcb87-39eb-47a8-aab6-16f7980fb73a' ORDER BY "user_roles"."id" LIMIT 1 FOR UPDATE
    logger.go:146: 2025-12-07T11:39:57.598+0100	INFO	Role assigned to user successfully	{"user_id": "9adf7145-8c3c-48a3-87b3-0e37761b7bca", "role_id": "5c4bcb87-39eb-47a8-aab6-16f7980fb73a"}

2025/12/07 11:39:57 [32m/home/senke/Documents/veza/veza-backend-api/tests/transactions/rbac_transaction_test.go:43 [33mSLOW SQL >= 200ms
[0m[31;1m[218.234ms] [33m[rows:0][35m TRUNCATE TABLE users CASCADE[0m
--- PASS: TestAssignRoleToUser_Success (0.68s)
=== RUN   TestAssignRoleToUser_RollbackOnUserNotFound

2025/12/07 11:39:58 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/services/rbac_service.go:175 [35;1mrecord not found
[0m[33m[4.333ms] [34;1m[rows:0][0m SELECT * FROM "users" WHERE "users"."id" = 'ae279b9b-c37e-4110-8e6e-3ddc97907584' AND "users"."deleted_at" IS NULL ORDER BY "users"."id" LIMIT 1 FOR UPDATE
--- PASS: TestAssignRoleToUser_RollbackOnUserNotFound (0.73s)
=== RUN   TestAssignRoleToUser_RollbackOnRoleNotFound

2025/12/07 11:39:59 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/services/rbac_service.go:184 [35;1mrecord not found
[0m[33m[1.199ms] [34;1m[rows:0][0m SELECT * FROM "roles" WHERE "roles"."id" = '594634ef-f9e0-4886-b452-cd1d3cd0f2c2' ORDER BY "roles"."id" LIMIT 1 FOR UPDATE
--- PASS: TestAssignRoleToUser_RollbackOnRoleNotFound (0.63s)
=== RUN   TestAssignRoleToUser_RollbackOnDuplicate

2025/12/07 11:39:59 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/services/rbac_service.go:195 [35;1mrecord not found
[0m[33m[0.735ms] [34;1m[rows:0][0m SELECT * FROM "user_roles" WHERE user_id = '49d08b7e-94ac-4b02-87e6-1d251d7409d5' AND role_id = '2f85939c-4c22-470d-bf30-a7f6c03a7596' ORDER BY "user_roles"."id" LIMIT 1 FOR UPDATE
    logger.go:146: 2025-12-07T11:39:59.598+0100	INFO	Role assigned to user successfully	{"user_id": "49d08b7e-94ac-4b02-87e6-1d251d7409d5", "role_id": "2f85939c-4c22-470d-bf30-a7f6c03a7596"}
--- PASS: TestAssignRoleToUser_RollbackOnDuplicate (0.51s)
=== RUN   TestAssignRoleToUser_Concurrency

2025/12/07 11:40:00 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/services/rbac_service.go:195 [35;1mrecord not found
[0m[33m[1.268ms] [34;1m[rows:0][0m SELECT * FROM "user_roles" WHERE user_id = '0a0a9a72-7bee-4cad-bff7-0dffb156532f' AND role_id = '5de75e92-95c8-4dd0-8182-b7a7b82f780c' ORDER BY "user_roles"."id" LIMIT 1 FOR UPDATE
    logger.go:146: 2025-12-07T11:40:00.190+0100	INFO	Role assigned to user successfully	{"user_id": "0a0a9a72-7bee-4cad-bff7-0dffb156532f", "role_id": "5de75e92-95c8-4dd0-8182-b7a7b82f780c"}
--- PASS: TestAssignRoleToUser_Concurrency (0.64s)
=== RUN   TestAssignRoleToUser_Atomicity

2025/12/07 11:40:00 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/services/rbac_service.go:195 [35;1mrecord not found
[0m[33m[0.782ms] [34;1m[rows:0][0m SELECT * FROM "user_roles" WHERE user_id = '7576c90d-cf9f-4066-997a-93a80ff75383' AND role_id = '18f63163-ddc0-4739-92da-43b1376d5a00' ORDER BY "user_roles"."id" LIMIT 1 FOR UPDATE
    logger.go:146: 2025-12-07T11:40:00.701+0100	INFO	Role assigned to user successfully	{"user_id": "7576c90d-cf9f-4066-997a-93a80ff75383", "role_id": "18f63163-ddc0-4739-92da-43b1376d5a00"}

2025/12/07 11:40:00 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/services/rbac_service.go:184 [35;1mrecord not found
[0m[33m[0.332ms] [34;1m[rows:0][0m SELECT * FROM "roles" WHERE "roles"."id" = '18f63163-ddc0-4739-92da-43b1376d5a00' ORDER BY "roles"."id" LIMIT 1 FOR UPDATE
--- PASS: TestAssignRoleToUser_Atomicity (0.45s)
=== RUN   TestToggleLike_Success

2025/12/07 11:40:01 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/core/social/service.go:138 [35;1mrecord not found
[0m[33m[1.899ms] [34;1m[rows:0][0m SELECT * FROM "likes" WHERE user_id = 'c70df77e-1f62-4985-b4b6-930b3404984b' AND target_id = '9d565670-99c0-4e32-9e1e-09084eaf9324' AND target_type = 'post' ORDER BY "likes"."id" LIMIT 1
--- PASS: TestToggleLike_Success (0.37s)
=== RUN   TestToggleLike_Unlike

2025/12/07 11:40:01 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/core/social/service.go:138 [35;1mrecord not found
[0m[33m[3.592ms] [34;1m[rows:0][0m SELECT * FROM "likes" WHERE user_id = 'a28bb41d-0ab3-4873-8143-d16e0c9c2d2c' AND target_id = '370425dd-622a-4a6d-9f0b-12bb8809e512' AND target_type = 'post' ORDER BY "likes"."id" LIMIT 1
--- PASS: TestToggleLike_Unlike (0.39s)
=== RUN   TestToggleLike_RollbackOnError

2025/12/07 11:40:01 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/core/social/service.go:138 [35;1mrecord not found
[0m[33m[2.031ms] [34;1m[rows:0][0m SELECT * FROM "likes" WHERE user_id = '4f29cfd8-8662-4c13-97d1-c642142f8971' AND target_id = 'cba090b5-65b4-41b5-b66f-ceb85d90a758' AND target_type = 'post' ORDER BY "likes"."id" LIMIT 1
    social_transaction_test.go:190: 
        	Error Trace:	/home/senke/Documents/veza/veza-backend-api/tests/transactions/social_transaction_test.go:190
        	Error:      	An error is expected but got nil.
        	Test:       	TestToggleLike_RollbackOnError
        	Messages:   	ToggleLike should fail
--- FAIL: TestToggleLike_RollbackOnError (0.34s)
=== RUN   TestToggleLike_Coherence

2025/12/07 11:40:02 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/core/social/service.go:138 [35;1mrecord not found
[0m[33m[2.297ms] [34;1m[rows:0][0m SELECT * FROM "likes" WHERE user_id = '49d0d7d4-b783-406f-b3e6-5d483e76dd35' AND target_id = '7ea9bccd-fd7b-471c-bb74-502c90eeedee' AND target_type = 'post' ORDER BY "likes"."id" LIMIT 1

2025/12/07 11:40:02 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/core/social/service.go:138 [35;1mrecord not found
[0m[33m[0.354ms] [34;1m[rows:0][0m SELECT * FROM "likes" WHERE user_id = 'c43f4fee-f595-4542-9c81-692164c013ac' AND target_id = '7ea9bccd-fd7b-471c-bb74-502c90eeedee' AND target_type = 'post' ORDER BY "likes"."id" LIMIT 1
--- PASS: TestToggleLike_Coherence (0.35s)
=== RUN   TestAddComment_Success
--- PASS: TestAddComment_Success (0.39s)
=== RUN   TestAddComment_RollbackOnError

2025/12/07 11:40:02 [31;1m/home/senke/Documents/veza/veza-backend-api/internal/core/social/service.go:196 [35;1mrecord not found
[0m[33m[1.911ms] [34;1m[rows:0][0m SELECT * FROM "posts" WHERE id = 'f2e8af16-219e-4ad3-b82a-9336dc1700f7' AND "posts"."deleted_at" IS NULL ORDER BY "posts"."id" LIMIT 1
--- PASS: TestAddComment_RollbackOnError (0.40s)
=== RUN   TestAddComment_Coherence
--- PASS: TestAddComment_Coherence (0.38s)
FAIL
FAIL	veza-backend-api/tests/transactions	90.673s
FAIL
