From d4cce2baf963598b629c349219c72087ee59a6da Mon Sep 17 00:00:00 2001 From: Wil Simpson Date: Sun, 31 Mar 2024 23:39:14 -0400 Subject: [PATCH] Updated test cases --- coverage.out | 564 +++++++++++++++++++++++- pkg/config/global.go | 1 + pkg/config/global_test.go | 22 +- pkg/config/server_test.go | 3 + pkg/helpers/character_test.go | 4 +- pkg/helpers/config.go | 23 +- pkg/helpers/config_test.go | 3 +- pkg/helpers/srv_test.go | 25 +- pkg/mocks/character_s_mock.go | 4 +- pkg/mocks/gamebackend_r_mock.go | 30 -- pkg/repository/character_r.go | 5 +- pkg/repository/repository_suite_test.go | 8 +- pkg/service/character_s_test.go | 6 +- pkg/srv/character_test.go | 10 +- pkg/srv/chat_test.go | 18 +- pkg/srv/srv_suite_test.go | 34 +- test/config.yaml | 6 +- test/db/docker.go | 14 +- 18 files changed, 654 insertions(+), 126 deletions(-) diff --git a/coverage.out b/coverage.out index dfa7e0b..f6ed762 100644 --- a/coverage.out +++ b/coverage.out @@ -1,4 +1,558 @@ mode: atomic +github.com/ShatteredRealms/go-backend/pkg/config/db.go:20.37,29.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/config/db.go:31.40,40.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/config/db.go:42.37,50.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/config/global.go:33.57,159.45 7 6 +github.com/ShatteredRealms/go-backend/pkg/config/global.go:159.45,160.48 1 6 +github.com/ShatteredRealms/go-backend/pkg/config/global.go:160.48,162.4 1 0 +github.com/ShatteredRealms/go-backend/pkg/config/global.go:162.9,162.62 1 6 +github.com/ShatteredRealms/go-backend/pkg/config/global.go:162.62,164.4 1 6 +github.com/ShatteredRealms/go-backend/pkg/config/global.go:164.9,166.4 1 0 +github.com/ShatteredRealms/go-backend/pkg/config/global.go:169.2,174.49 3 6 +github.com/ShatteredRealms/go-backend/pkg/config/global.go:174.49,176.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/config/global.go:178.2,178.15 1 6 +github.com/ShatteredRealms/go-backend/pkg/config/server.go:48.42,50.2 1 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/auth.go:14.79,16.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/auth.go:18.85,26.2 2 3 +github.com/ShatteredRealms/go-backend/pkg/helpers/auth.go:28.59,33.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:16.17,17.19 1 5 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:17.19,19.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:21.2,22.33 2 4 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:23.32,25.17 2 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:25.17,27.4 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:28.3,28.42 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:30.30,31.33 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:33.10,35.41 2 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:38.2,38.31 1 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:45.19,46.19 1 5 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:46.19,48.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:50.2,51.33 2 4 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:52.32,53.31 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:55.30,57.17 2 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:57.17,59.4 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:60.3,60.40 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:62.10,64.42 2 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/character.go:68.2,68.33 1 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:10.40,14.55 3 6 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:14.55,16.3 1 3 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:18.2,18.38 1 6 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:18.38,21.22 3 18 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:21.22,23.4 1 6 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:24.3,24.35 1 18 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:28.51,29.34 1 30 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:29.34,33.3 3 18 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:35.2,35.38 1 12 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:35.38,38.22 3 12 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:38.22,40.4 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:40.9,40.23 1 12 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:40.23,42.4 1 6 +github.com/ShatteredRealms/go-backend/pkg/helpers/config.go:44.3,44.42 1 12 +github.com/ShatteredRealms/go-backend/pkg/helpers/conversions.go:3.48,5.28 2 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/conversions.go:5.28,7.3 1 12 +github.com/ShatteredRealms/go-backend/pkg/helpers/conversions.go:9.2,9.13 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/errors.go:8.63,9.16 1 4 +github.com/ShatteredRealms/go-backend/pkg/helpers/errors.go:9.16,11.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/grpc.go:17.87,18.86 1 4 +github.com/ShatteredRealms/go-backend/pkg/helpers/grpc.go:18.86,19.94 1 4 +github.com/ShatteredRealms/go-backend/pkg/helpers/grpc.go:19.94,21.4 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/grpc.go:21.9,26.29 4 3 +github.com/ShatteredRealms/go-backend/pkg/helpers/grpc.go:26.29,28.5 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/grpc.go:30.4,30.32 1 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/grpc.go:40.9,51.2 5 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/logging.go:12.38,27.2 4 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:23.145,29.45 2 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:29.45,31.36 2 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:31.36,33.4 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:34.3,35.13 2 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:39.2,39.33 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:39.33,41.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:43.2,56.16 5 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:56.16,59.3 2 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:62.2,67.16 4 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:67.16,70.3 2 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:71.2,76.16 4 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:76.16,79.3 2 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:80.2,83.8 3 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:86.52,91.2 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:93.122,98.16 4 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:98.16,100.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:102.2,108.27 3 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:111.122,116.16 4 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:116.16,118.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/opentelemetry.go:120.2,125.27 2 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:36.39,41.2 1 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:43.67,45.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:47.61,62.2 2 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:64.56,65.16 1 13 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:65.16,67.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:69.2,70.15 2 11 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:70.15,72.3 1 3 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:74.2,74.50 1 8 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:74.50,76.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:78.2,78.44 1 7 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:81.67,82.16 1 5 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:82.16,84.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:86.2,87.16 2 4 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:87.16,89.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:91.2,92.16 2 3 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:92.16,95.3 2 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:97.2,98.20 2 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:101.121,102.19 1 7 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:102.19,104.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:106.2,107.16 2 5 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:107.16,109.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:111.2,119.16 3 3 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:119.16,122.3 2 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:124.2,124.18 1 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:124.18,126.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:128.2,134.28 3 1 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:139.61,140.98 1 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:140.98,143.16 3 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:143.16,146.4 2 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:147.3,149.14 2 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:150.27,151.16 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:152.26,153.15 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:154.26,155.15 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:156.27,157.16 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/srv.go:158.11,159.37 1 0 +github.com/ShatteredRealms/go-backend/pkg/helpers/uuid.go:9.59,11.39 2 3 +github.com/ShatteredRealms/go-backend/pkg/helpers/uuid.go:11.39,13.17 2 29 +github.com/ShatteredRealms/go-backend/pkg/helpers/uuid.go:13.17,15.4 1 2 +github.com/ShatteredRealms/go-backend/pkg/helpers/uuid.go:16.3,16.17 1 27 +github.com/ShatteredRealms/go-backend/pkg/helpers/uuid.go:19.2,19.17 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:49.38,50.43 1 10 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:50.43,52.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:54.2,54.42 1 9 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:54.42,56.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:58.2,58.25 1 8 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:61.42,62.42 1 8 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:62.42,64.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:66.2,66.42 1 7 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:66.42,68.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:70.2,70.45 1 6 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:70.45,72.3 1 4 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:74.2,74.30 1 2 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:74.30,76.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:78.2,78.12 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:81.44,83.24 1 10 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:83.24,85.3 1 9 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:87.2,87.25 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:90.43,92.23 1 9 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:92.23,94.3 1 8 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:96.2,96.24 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:99.49,109.2 1 11 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:111.50,113.32 2 1 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:113.32,115.3 1 10 +github.com/ShatteredRealms/go-backend/pkg/model/character.go:117.2,117.13 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/chat.go:21.46,27.2 1 11 +github.com/ShatteredRealms/go-backend/pkg/model/chat.go:29.47,31.30 2 1 +github.com/ShatteredRealms/go-backend/pkg/model/chat.go:31.30,33.3 1 10 +github.com/ShatteredRealms/go-backend/pkg/model/chat.go:35.2,35.13 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/claims.go:30.78,31.52 1 3 +github.com/ShatteredRealms/go-backend/pkg/model/claims.go:31.52,32.44 1 2 +github.com/ShatteredRealms/go-backend/pkg/model/claims.go:32.44,33.31 1 4 +github.com/ShatteredRealms/go-backend/pkg/model/claims.go:33.31,35.5 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/claims.go:39.2,39.14 1 2 +github.com/ShatteredRealms/go-backend/pkg/model/claims.go:42.53,43.47 1 2 +github.com/ShatteredRealms/go-backend/pkg/model/claims.go:43.47,44.30 1 4 +github.com/ShatteredRealms/go-backend/pkg/model/claims.go:44.30,46.4 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/claims.go:49.2,49.14 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:36.46,37.46 1 2 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:37.46,39.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:41.2,41.33 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:44.50,45.50 1 3 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:45.50,47.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:49.2,49.50 1 2 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:49.50,51.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:53.2,53.12 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:56.50,58.37 2 11 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:58.37,60.3 1 11 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:62.2,68.3 1 11 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:71.52,73.33 2 1 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:73.33,75.3 1 10 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:77.2,79.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:82.51,84.29 2 2 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:84.29,86.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/dimension.go:88.2,88.89 1 2 +github.com/ShatteredRealms/go-backend/pkg/model/inventory.go:19.53,25.2 1 15 +github.com/ShatteredRealms/go-backend/pkg/model/inventory.go:27.56,29.31 2 3 +github.com/ShatteredRealms/go-backend/pkg/model/inventory.go:29.31,31.3 1 12 +github.com/ShatteredRealms/go-backend/pkg/model/inventory.go:33.2,33.12 1 3 +github.com/ShatteredRealms/go-backend/pkg/model/inventory.go:36.59,41.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/inventory.go:43.65,49.2 1 11 +github.com/ShatteredRealms/go-backend/pkg/model/inventory.go:51.69,53.31 2 1 +github.com/ShatteredRealms/go-backend/pkg/model/inventory.go:53.31,55.3 1 10 +github.com/ShatteredRealms/go-backend/pkg/model/inventory.go:57.2,57.12 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/location.go:15.39,25.2 1 12 +github.com/ShatteredRealms/go-backend/pkg/model/location.go:27.54,37.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/model/map.go:16.30,24.2 1 33 +github.com/ShatteredRealms/go-backend/pkg/model/map.go:26.35,28.27 2 12 +github.com/ShatteredRealms/go-backend/pkg/model/map.go:28.27,30.3 1 21 +github.com/ShatteredRealms/go-backend/pkg/model/map.go:32.2,32.12 1 12 +github.com/ShatteredRealms/go-backend/pkg/model/model.go:17.34,19.2 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/cacher.go:13.31,14.20 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/cacher.go:14.20,16.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/cacher.go:19.111,22.9 3 0 +github.com/ShatteredRealms/go-backend/pkg/repository/cacher.go:22.9,24.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/cacher.go:26.2,26.50 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/cacher.go:26.50,28.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/cacher.go:30.2,30.15 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/cacher.go:33.93,36.16 3 0 +github.com/ShatteredRealms/go-backend/pkg/repository/cacher.go:36.16,38.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/cacher.go:40.2,41.12 2 0 +github.com/ShatteredRealms/go-backend/pkg/repository/cacher.go:44.62,47.2 2 0 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:42.80,50.2 3 32 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:52.101,55.25 3 4 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:55.25,58.3 2 0 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:60.2,60.30 1 4 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:60.30,63.3 2 3 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:65.2,72.23 4 1 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:75.112,80.16 3 16 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:80.16,83.3 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:85.2,90.23 3 15 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:93.110,95.16 2 2 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:95.16,97.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:99.2,104.23 3 1 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:107.92,108.22 1 4 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:108.22,110.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:111.2,111.85 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:114.95,117.25 3 8 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:117.25,119.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:121.2,121.30 1 7 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:121.30,123.3 1 4 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:125.2,130.23 3 3 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:133.87,136.2 2 4 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:138.106,141.2 2 4 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:143.72,144.16 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:144.16,146.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:148.2,149.10 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/character_r.go:152.65,154.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:32.135,33.13 1 4 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:33.13,35.33 2 2 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:35.33,39.25 1 4 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:39.25,42.5 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:45.3,46.13 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:49.2,54.123 3 2 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:57.123,71.2 5 4 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:73.116,76.2 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:78.86,82.2 3 2 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:84.116,87.2 2 17 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:89.94,92.2 2 6 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:94.98,97.2 2 3 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:99.60,101.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:103.99,106.25 3 10 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:106.25,108.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:110.2,110.30 1 9 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:110.30,112.3 1 8 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:114.2,115.21 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:118.107,121.25 3 3 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:121.25,123.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:125.2,125.30 1 3 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:125.30,127.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:129.2,130.21 2 2 +github.com/ShatteredRealms/go-backend/pkg/repository/chat_r.go:133.52,135.2 1 32 +github.com/ShatteredRealms/go-backend/pkg/repository/db.go:20.60,22.16 2 2 +github.com/ShatteredRealms/go-backend/pkg/repository/db.go:22.16,24.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/db.go:25.2,44.16 6 2 +github.com/ShatteredRealms/go-backend/pkg/repository/db.go:44.16,46.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/db.go:48.2,48.26 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/db.go:48.26,50.37 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/db.go:50.37,52.4 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/db.go:54.3,57.6 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/db.go:60.2,60.90 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/db.go:60.90,62.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/db.go:64.2,64.16 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:68.66,72.2 1 32 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:79.37,80.21 1 26 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:80.21,82.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:84.2,89.16 3 25 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:89.16,91.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:93.2,93.16 1 25 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:97.99,98.15 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:98.15,100.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:102.2,102.75 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:106.116,107.15 1 6 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:107.15,109.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:111.2,113.25 3 5 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:113.25,116.3 2 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:118.2,118.30 1 5 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:118.30,121.3 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:123.2,124.26 2 4 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:134.29,136.16 2 26 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:136.16,138.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:140.2,147.100 2 26 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:147.100,149.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:151.2,151.23 1 26 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:161.23,169.68 2 26 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:169.68,171.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:173.2,173.20 1 25 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:177.91,179.2 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:182.95,184.2 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:187.95,189.2 1 3 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:192.89,194.2 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:197.89,199.2 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:205.29,206.22 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:206.22,208.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:209.2,211.16 3 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:211.16,213.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:215.2,216.16 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:216.16,218.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:220.2,220.23 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:224.96,226.16 2 2 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:226.16,228.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:230.2,230.15 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:234.98,237.2 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:240.86,243.2 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:246.113,249.25 3 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:249.25,251.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:253.2,253.30 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:253.30,255.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:257.2,257.23 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:261.113,264.25 3 3 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:264.25,266.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:268.2,268.30 1 3 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:268.30,270.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:272.2,272.23 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:276.101,277.15 1 3 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:277.15,279.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:280.2,282.25 3 2 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:282.25,284.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:286.2,286.30 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:286.30,288.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:290.2,290.15 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:294.101,297.25 3 3 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:297.25,299.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:301.2,301.30 1 3 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:301.30,303.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:305.2,305.15 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:309.118,312.2 2 3 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:315.118,318.2 2 3 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:321.106,324.2 2 26 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:327.106,330.2 2 3 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:333.123,344.2 2 3 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:347.77,348.16 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:348.16,350.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:352.2,353.10 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/gamebackend_r.go:357.68,363.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/inventory_r.go:21.69,25.2 1 31 +github.com/ShatteredRealms/go-backend/pkg/repository/inventory_r.go:28.132,30.16 2 6 +github.com/ShatteredRealms/go-backend/pkg/repository/inventory_r.go:30.16,32.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/repository/inventory_r.go:34.2,34.23 1 4 +github.com/ShatteredRealms/go-backend/pkg/repository/inventory_r.go:38.111,41.2 2 5 +github.com/ShatteredRealms/go-backend/pkg/repository/inventory_r.go:43.71,45.2 1 11 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:21.70,22.24 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:22.24,24.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:25.2,25.27 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:25.27,27.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:28.2,30.27 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:30.27,33.3 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:34.2,34.16 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:34.16,36.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:38.2,39.16 2 1 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:39.16,40.29 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:40.29,42.4 1 1 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:43.3,43.48 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:46.2,46.27 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:46.27,49.3 2 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:50.2,50.16 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:50.16,52.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:54.2,54.28 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:57.35,61.46 4 1 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:61.46,62.39 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:62.39,64.4 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:66.3,66.13 1 0 +github.com/ShatteredRealms/go-backend/pkg/repository/kafka.go:69.2,69.12 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:32.98,34.2 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:39.29,42.16 2 18 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:42.16,44.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:46.2,48.8 1 17 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:51.139,60.45 2 2 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:60.45,62.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:64.2,64.39 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:67.92,69.2 1 8 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:71.115,75.48 3 5 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:76.30,77.59 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:78.32,79.57 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:80.10,82.43 2 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:86.2,86.16 1 4 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:86.16,88.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:90.2,91.32 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:91.32,93.3 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:94.2,95.32 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:95.32,97.3 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:99.2,99.39 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:99.39,101.3 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:103.2,104.31 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:104.31,106.3 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:108.2,109.30 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:109.30,111.3 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:113.2,114.39 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:114.39,116.3 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:118.2,119.16 2 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:119.16,121.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:123.2,123.43 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:126.70,128.16 2 3 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:128.16,130.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:132.2,132.22 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:132.22,134.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:136.2,136.38 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:139.82,141.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:143.103,145.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:147.119,149.16 2 2 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:149.16,151.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/character_s.go:153.2,156.23 3 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:53.132,55.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:57.120,59.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:61.123,66.16 4 2 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:66.16,68.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:70.2,70.33 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:70.33,72.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:74.2,74.38 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:74.38,76.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:78.2,78.47 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:81.91,83.2 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:85.95,98.2 5 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:100.100,113.2 5 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:114.122,118.23 3 3 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:118.23,120.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:122.2,129.3 2 2 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:132.133,136.23 3 7 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:136.23,138.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:139.2,146.3 2 6 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:149.83,151.2 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:153.113,155.16 2 2 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:155.16,157.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:159.2,160.24 2 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:163.91,165.16 2 2 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:165.16,167.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:169.2,171.12 2 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:174.134,179.16 4 4 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:179.16,181.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:183.2,184.16 2 3 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:184.16,186.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:188.2,196.16 3 2 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:196.16,198.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:200.2,202.37 2 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:202.37,204.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:206.2,207.16 2 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:207.16,209.3 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:211.2,211.21 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:215.99,217.2 1 5 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:219.81,225.2 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:227.68,233.2 1 5 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:235.50,237.2 1 6 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:239.49,241.2 1 8 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:243.97,247.47 3 2 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:247.47,254.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:256.2,256.43 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:259.96,263.41 3 6 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:263.41,270.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/chat_s.go:272.2,272.37 1 6 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:80.119,81.35 1 14 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:82.32,83.60 1 8 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:85.30,87.17 2 5 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:87.17,89.4 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:90.3,90.55 1 4 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:92.10,94.43 2 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:100.101,101.35 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:102.26,103.54 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:105.24,107.17 2 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:107.17,109.4 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:110.3,110.49 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:112.10,114.43 2 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:120.137,122.16 2 6 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:122.16,124.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:125.2,125.22 1 4 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:125.22,128.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:130.2,131.35 2 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:131.35,133.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:135.2,135.97 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:141.31,143.16 2 43 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:143.16,145.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:147.2,149.8 1 42 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:157.37,159.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:162.141,164.15 2 4 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:164.15,166.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:168.2,168.33 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:168.33,171.3 2 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:174.2,175.43 2 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:175.43,179.3 3 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:181.2,182.16 2 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:186.160,188.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:191.142,193.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:196.92,198.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:201.92,203.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:206.86,208.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:211.86,213.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:216.125,219.16 2 8 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:219.16,221.3 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:223.2,223.29 1 6 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:223.29,226.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:228.2,228.33 1 5 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:228.33,230.3 1 5 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:232.2,232.36 1 5 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:232.36,234.3 1 5 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:236.2,236.37 1 5 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:236.37,238.3 1 5 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:240.2,240.22 1 5 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:240.22,242.17 2 5 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:242.17,244.4 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:246.3,247.17 2 4 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:247.17,249.4 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:251.3,251.28 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:251.28,255.36 4 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:255.36,257.5 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:258.4,258.27 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:258.27,259.35 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:259.35,262.6 2 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:264.4,264.68 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:267.3,267.31 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:270.2,270.63 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:274.107,278.48 3 4 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:279.24,281.17 2 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:281.17,283.4 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:284.3,284.44 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:285.26,286.54 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:287.10,289.37 2 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:293.2,293.16 1 3 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:293.16,295.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:297.2,297.23 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:297.23,300.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:302.2,302.33 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:302.33,304.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:306.2,306.33 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:306.33,308.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:310.2,310.39 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:310.39,312.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:314.2,314.38 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:314.38,316.3 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:318.2,318.51 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:322.95,324.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:327.83,329.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:332.110,334.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:337.110,339.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:342.115,344.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:347.115,349.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:352.120,354.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:357.98,359.2 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:362.98,364.2 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:367.103,369.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:372.103,374.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:377.101,378.35 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:379.32,380.46 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:382.30,384.17 2 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:384.17,386.4 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:387.3,387.41 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:389.10,391.38 2 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:397.89,398.35 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:399.26,400.40 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:402.24,404.17 2 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:404.17,406.4 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:407.3,407.35 1 0 +github.com/ShatteredRealms/go-backend/pkg/service/gamebackend_s.go:409.10,411.38 2 0 +github.com/ShatteredRealms/go-backend/pkg/service/inventory_s.go:19.80,23.2 1 2 +github.com/ShatteredRealms/go-backend/pkg/service/inventory_s.go:26.115,28.2 1 1 +github.com/ShatteredRealms/go-backend/pkg/service/inventory_s.go:31.108,33.2 1 1 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:50.62,53.2 2 124 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:59.33,61.16 2 6 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:61.16,64.3 2 1 @@ -8,7 +562,7 @@ github.com/ShatteredRealms/go-backend/pkg/srv/character.go:71.2,72.16 2 4 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:72.16,74.3 1 1 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:77.2,78.16 2 3 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:78.16,80.3 1 1 -github.com/ShatteredRealms/go-backend/pkg/srv/character.go:82.2,82.46 1 2 +github.com/ShatteredRealms/go-backend/pkg/srv/character.go:82.2,82.60 1 2 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:89.33,91.16 2 12 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:91.16,94.3 2 1 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:97.2,97.80 1 11 @@ -112,14 +666,14 @@ github.com/ShatteredRealms/go-backend/pkg/srv/character.go:431.17,434.4 2 1 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:435.3,435.18 1 1 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:435.18,437.4 1 0 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:439.3,439.24 1 1 -github.com/ShatteredRealms/go-backend/pkg/srv/character.go:440.10,442.35 2 0 +github.com/ShatteredRealms/go-backend/pkg/srv/character.go:440.10,442.41 2 0 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:445.2,445.25 1 3 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:451.29,455.43 3 23 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:455.43,457.3 1 0 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:459.2,459.39 1 23 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:460.30,461.76 1 19 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:463.32,464.74 1 4 -github.com/ShatteredRealms/go-backend/pkg/srv/character.go:466.10,468.37 2 0 +github.com/ShatteredRealms/go-backend/pkg/srv/character.go:466.10,468.43 2 0 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:471.2,471.16 1 23 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:471.16,474.3 2 3 github.com/ShatteredRealms/go-backend/pkg/srv/character.go:476.2,476.22 1 20 @@ -290,7 +844,7 @@ github.com/ShatteredRealms/go-backend/pkg/srv/chat.go:560.17,563.4 2 1 github.com/ShatteredRealms/go-backend/pkg/srv/chat.go:565.3,565.36 1 2 github.com/ShatteredRealms/go-backend/pkg/srv/chat.go:565.36,566.31 1 1 github.com/ShatteredRealms/go-backend/pkg/srv/chat.go:566.31,568.5 1 1 -github.com/ShatteredRealms/go-backend/pkg/srv/chat.go:572.2,572.30 1 1 +github.com/ShatteredRealms/go-backend/pkg/srv/chat.go:572.2,572.36 1 1 github.com/ShatteredRealms/go-backend/pkg/srv/connection.go:39.63,42.2 2 62 github.com/ShatteredRealms/go-backend/pkg/srv/connection.go:53.42,55.16 2 8 github.com/ShatteredRealms/go-backend/pkg/srv/connection.go:55.16,58.3 2 2 @@ -541,7 +1095,7 @@ github.com/ShatteredRealms/go-backend/pkg/srv/servermanager.go:734.24,736.17 2 6 github.com/ShatteredRealms/go-backend/pkg/srv/servermanager.go:736.17,738.4 1 1 github.com/ShatteredRealms/go-backend/pkg/srv/servermanager.go:739.3,739.63 1 5 github.com/ShatteredRealms/go-backend/pkg/srv/servermanager.go:741.26,742.73 1 3 -github.com/ShatteredRealms/go-backend/pkg/srv/servermanager.go:744.10,746.37 2 1 +github.com/ShatteredRealms/go-backend/pkg/srv/servermanager.go:744.10,746.43 2 1 github.com/ShatteredRealms/go-backend/pkg/srv/servermanager.go:749.2,749.16 1 8 github.com/ShatteredRealms/go-backend/pkg/srv/servermanager.go:749.16,751.3 1 1 github.com/ShatteredRealms/go-backend/pkg/srv/servermanager.go:752.2,752.16 1 7 diff --git a/pkg/config/global.go b/pkg/config/global.go index c2a6b2a..09eb729 100644 --- a/pkg/config/global.go +++ b/pkg/config/global.go @@ -166,6 +166,7 @@ func NewGlobalConfig(ctx context.Context) *GlobalConfig { } } + viper.SetEnvPrefix("SRO") // Read from environment variables helpers.BindEnvsToStruct(config) diff --git a/pkg/config/global_test.go b/pkg/config/global_test.go index 1bc4f38..8b67ffa 100644 --- a/pkg/config/global_test.go +++ b/pkg/config/global_test.go @@ -7,24 +7,37 @@ import ( "github.com/bxcodec/faker/v4" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/sirupsen/logrus/hooks/test" "gopkg.in/yaml.v2" "github.com/ShatteredRealms/go-backend/pkg/config" + "github.com/ShatteredRealms/go-backend/pkg/log" ) var _ = Describe("Global config", func() { + BeforeEach(func() { + log.Logger, _ = test.NewNullLogger() + }) Describe("NewGlobalConfig", func() { It("should generate a valid config", func() { - Expect(config.NewGlobalConfig(nil)).NotTo(BeNil()) + Expect(config.NewGlobalConfig(context.TODO())).NotTo(BeNil()) Expect(config.NewGlobalConfig(context.Background())).NotTo(BeNil()) }) It("should read in env variables", func() { - key := "SRO_CHARACTER_LOCAL_HOST" + key := "SRO_VERSION" val := faker.Username() GinkgoT().Setenv(key, val) Expect(os.Getenv(key)).To(Equal(val)) - conf := config.NewGlobalConfig(nil) + conf := config.NewGlobalConfig(context.TODO()) + Expect(conf).NotTo(BeNil()) + Expect(conf.Version).To(Equal(val)) + + key = "SRO_CHARACTER_LOCAL_HOST" + val = faker.Username() + GinkgoT().Setenv(key, val) + Expect(os.Getenv(key)).To(Equal(val)) + conf = config.NewGlobalConfig(context.TODO()) Expect(conf).NotTo(BeNil()) Expect(conf.Character.Local.Host).To(Equal(val)) }) @@ -32,9 +45,10 @@ var _ = Describe("Global config", func() { It("should read in from config file", func() { confFromFile := &config.GlobalConfig{} yamlFile, err := os.ReadFile("../../test/config.yaml") + Expect(err).To(BeNil()) err = yaml.Unmarshal(yamlFile, confFromFile) Expect(err).To(BeNil()) - conf := config.NewGlobalConfig(nil) + conf := config.NewGlobalConfig(context.TODO()) Expect(conf).NotTo(BeNil()) Expect(conf.Character.Keycloak.ClientSecret).To(Equal(confFromFile.Character.Keycloak.ClientSecret)) }) diff --git a/pkg/config/server_test.go b/pkg/config/server_test.go index f70f95c..e140242 100644 --- a/pkg/config/server_test.go +++ b/pkg/config/server_test.go @@ -7,13 +7,16 @@ import ( "github.com/bxcodec/faker/v4" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/sirupsen/logrus/hooks/test" "github.com/ShatteredRealms/go-backend/pkg/config" + "github.com/ShatteredRealms/go-backend/pkg/log" ) var _ = Describe("Server config", func() { Describe("ServerAddress Address", func() { It("should generate an address", func() { + log.Logger, _ = test.NewNullLogger() config := config.NewGlobalConfig(context.TODO()) Expect(config).NotTo(BeNil()) Expect(config.Character.Local.Address()).To(Equal(fmt.Sprintf("%s:%d", config.Character.Local.Host, config.Character.Local.Port))) diff --git a/pkg/helpers/character_test.go b/pkg/helpers/character_test.go index 377052a..3ab0f60 100644 --- a/pkg/helpers/character_test.go +++ b/pkg/helpers/character_test.go @@ -55,7 +55,7 @@ var _ = Describe("Character helpers", func() { It("should error on invalid target", func() { id, err := helpers.GetCharacterIdFromTarget(ctx, mockCSC, target) - Expect(err).Should(MatchError(model.ErrHandleRequest)) + Expect(err).Should(MatchError(model.ErrHandleRequest.Err())) Expect(id).NotTo(Equal(uint(characterDetails.Id))) Expect(hook.AllEntries()).To(HaveLen(1)) Expect(hook.LastEntry().String()).To(ContainSubstring("target type unknown")) @@ -107,7 +107,7 @@ var _ = Describe("Character helpers", func() { It("should error on invalid target", func() { name, err := helpers.GetCharacterNameFromTarget(ctx, mockCSC, target) - Expect(err).Should(MatchError(model.ErrHandleRequest)) + Expect(err).Should(MatchError(model.ErrHandleRequest.Err())) Expect(name).NotTo(Equal(characterDetails.Name)) Expect(hook.AllEntries()).To(HaveLen(1)) Expect(hook.LastEntry().String()).To(ContainSubstring("target type unknown")) diff --git a/pkg/helpers/config.go b/pkg/helpers/config.go index ce418f2..502ea37 100644 --- a/pkg/helpers/config.go +++ b/pkg/helpers/config.go @@ -18,34 +18,29 @@ func BindEnvsToStruct(obj interface{}) { for i := 0; i < val.NumField(); i++ { field := val.Type().Field(i) key := field.Name - env := field.Name if field.Anonymous { - env = "" + key = "" } - bindRecursive(key, env, val.Field(i)) + bindRecursive(key, val.Field(i)) } } -func bindRecursive(key, env string, val reflect.Value) { +func bindRecursive(key string, val reflect.Value) { if val.Kind() != reflect.Struct { - env = "SRO_" + strings.ToUpper(env) - _ = viper.BindEnv(key, env) + env := "SRO_" + strings.ReplaceAll(strings.ToUpper(key), ".", "_") + viper.MustBindEnv(key, env) return } for i := 0; i < val.NumField(); i++ { field := val.Type().Field(i) newKey := field.Name - newEnv := field.Name - if key != "" { - newKey = "." + newKey - } if field.Anonymous { - newEnv = "" - } else if env != "" { - newEnv = "_" + newEnv + newKey = "" + } else if key != "" { + newKey = "." + newKey } - bindRecursive(key+newKey, env+newEnv, val.Field(i)) + bindRecursive(key+newKey, val.Field(i)) } } diff --git a/pkg/helpers/config_test.go b/pkg/helpers/config_test.go index dea1aa8..30dbd3c 100644 --- a/pkg/helpers/config_test.go +++ b/pkg/helpers/config_test.go @@ -17,7 +17,8 @@ const ( ) type TestStruct struct { - EmbeddedStruct + EmbeddedStruct `yaml:",inline" mapstructure:",squash"` + Foo string Bar TestInnerStruct } diff --git a/pkg/helpers/srv_test.go b/pkg/helpers/srv_test.go index 59f9ec1..c67f204 100644 --- a/pkg/helpers/srv_test.go +++ b/pkg/helpers/srv_test.go @@ -28,28 +28,7 @@ var _ = Describe("Srv helpers", func() { BeforeEach(func() { log.Logger, hook = test.NewNullLogger() - }) - - Describe("UnaryLogRequest", func() { - It("should handle requests", func() { - method := faker.Username() - fakeHandler := &mockHandler{} - testFunc := helpers.UnaryLogRequest() - testFunc(nil, nil, &grpc.UnaryServerInfo{FullMethod: method}, fakeHandler.UnaryHandler) - Expect(fakeHandler.WasCalled).To(BeTrue()) - Expect(hook.LastEntry().Message).To(ContainSubstring(method)) - }) - }) - - Describe("StreamLogRequest", func() { - It("should handle requests", func() { - method := faker.Username() - fakeHandler := &mockHandler{} - testFunc := helpers.StreamLogRequest() - testFunc(nil, mockServerStream{}, &grpc.StreamServerInfo{FullMethod: method}, fakeHandler.StreamHandler) - Expect(fakeHandler.WasCalled).To(BeTrue()) - Expect(hook.LastEntry().Message).To(ContainSubstring(method)) - }) + hook.Reset() }) Describe("GrpcDialOpts", func() { @@ -236,7 +215,7 @@ var _ = Describe("Srv helpers", func() { jwtToken, outClaims, err := helpers.VerifyClaims(ctx, mockKeycloak, realm) Expect(jwtToken).To(BeNil()) Expect(outClaims).To(BeNil()) - Expect(err).To(MatchError(model.ErrUnauthorized)) + Expect(err).To(MatchError(model.ErrUnauthorized.Err())) }) }) diff --git a/pkg/mocks/character_s_mock.go b/pkg/mocks/character_s_mock.go index 6518d33..dd065a4 100644 --- a/pkg/mocks/character_s_mock.go +++ b/pkg/mocks/character_s_mock.go @@ -42,10 +42,10 @@ func (m *MockCharacterService) EXPECT() *MockCharacterServiceMockRecorder { } // AddPlayTime mocks base method. -func (m *MockCharacterService) AddPlayTime(ctx context.Context, characterId uint, amount uint64) (uint64, error) { +func (m *MockCharacterService) AddPlayTime(ctx context.Context, characterId uint, amount uint64) (*model.Character, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AddPlayTime", ctx, characterId, amount) - ret0, _ := ret[0].(uint64) + ret0, _ := ret[0].(*model.Character) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/pkg/mocks/gamebackend_r_mock.go b/pkg/mocks/gamebackend_r_mock.go index c80c553..2b5d820 100644 --- a/pkg/mocks/gamebackend_r_mock.go +++ b/pkg/mocks/gamebackend_r_mock.go @@ -86,21 +86,6 @@ func (mr *MockdimensionRepositoryMockRecorder) DeleteDimensionByName(ctx, name a return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteDimensionByName", reflect.TypeOf((*MockdimensionRepository)(nil).DeleteDimensionByName), ctx, name) } -// DuplicateDimension mocks base method. -func (m *MockdimensionRepository) DuplicateDimension(ctx context.Context, refId *uuid.UUID, name string) (*model.Dimension, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DuplicateDimension", ctx, refId, name) - ret0, _ := ret[0].(*model.Dimension) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// DuplicateDimension indicates an expected call of DuplicateDimension. -func (mr *MockdimensionRepositoryMockRecorder) DuplicateDimension(ctx, refId, name any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DuplicateDimension", reflect.TypeOf((*MockdimensionRepository)(nil).DuplicateDimension), ctx, refId, name) -} - // FindAllDimensions mocks base method. func (m *MockdimensionRepository) FindAllDimensions(ctx context.Context) (model.Dimensions, error) { m.ctrl.T.Helper() @@ -500,21 +485,6 @@ func (mr *MockGamebackendRepositoryMockRecorder) DeletePendingConnection(ctx, id return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePendingConnection", reflect.TypeOf((*MockGamebackendRepository)(nil).DeletePendingConnection), ctx, id) } -// DuplicateDimension mocks base method. -func (m *MockGamebackendRepository) DuplicateDimension(ctx context.Context, refId *uuid.UUID, name string) (*model.Dimension, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DuplicateDimension", ctx, refId, name) - ret0, _ := ret[0].(*model.Dimension) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// DuplicateDimension indicates an expected call of DuplicateDimension. -func (mr *MockGamebackendRepositoryMockRecorder) DuplicateDimension(ctx, refId, name any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DuplicateDimension", reflect.TypeOf((*MockGamebackendRepository)(nil).DuplicateDimension), ctx, refId, name) -} - // FindAllDimensions mocks base method. func (m *MockGamebackendRepository) FindAllDimensions(ctx context.Context) (model.Dimensions, error) { m.ctrl.T.Helper() diff --git a/pkg/repository/character_r.go b/pkg/repository/character_r.go index d9eb507..548aa9e 100644 --- a/pkg/repository/character_r.go +++ b/pkg/repository/character_r.go @@ -49,7 +49,8 @@ func NewCharacterRepository(db *gorm.DB) (repo CharacterRepository, err error) { return } -func (r characterRepository) FindByName(ctx context.Context, name string) (character *model.Character, err error) { +func (r characterRepository) FindByName(ctx context.Context, name string) (*model.Character, error) { + var character *model.Character result := r.DB.WithContext(ctx).Where("name = ?", name).Find(&character) if result.Error != nil { log.Logger.WithContext(ctx).Debugf("find by name err: %v", result.Error) @@ -58,7 +59,7 @@ func (r characterRepository) FindByName(ctx context.Context, name string) (chara if result.RowsAffected == 0 { log.Logger.WithContext(ctx).Debugf("find by name: no rows affected. character: %+v", character) - return + return nil, nil } log.Logger.WithContext(ctx).Debugf("character name %s found", name) diff --git a/pkg/repository/repository_suite_test.go b/pkg/repository/repository_suite_test.go index c712ea5..62b215e 100644 --- a/pkg/repository/repository_suite_test.go +++ b/pkg/repository/repository_suite_test.go @@ -49,7 +49,9 @@ func TestRepository(t *testing.T) { mdb = testdb.ConnectMongoDocker(mdbConnStr) Expect(mdb).NotTo(BeNil()) - characterRepo = repository.NewCharacterRepository(gdb) + var err error + characterRepo, err = repository.NewCharacterRepository(gdb) + Expect(err).NotTo(HaveOccurred()) Expect(characterRepo).NotTo(BeNil()) Expect(characterRepo.Migrate(context.Background())).NotTo(HaveOccurred()) @@ -87,7 +89,9 @@ func TestRepository(t *testing.T) { mdb = testdb.ConnectMongoDocker(hosts[1]) Expect(mdb).NotTo(BeNil()) - characterRepo = repository.NewCharacterRepository(gdb) + var err error + characterRepo, err = repository.NewCharacterRepository(gdb) + Expect(err).NotTo(HaveOccurred()) Expect(characterRepo).NotTo(BeNil()) chatRepo = repository.NewChatRepository(gdb) Expect(chatRepo).NotTo(BeNil()) diff --git a/pkg/service/character_s_test.go b/pkg/service/character_s_test.go index e0369d4..9d0e9ab 100644 --- a/pkg/service/character_s_test.go +++ b/pkg/service/character_s_test.go @@ -321,7 +321,7 @@ var _ = Describe("Character service", func() { Target: &pb.CharacterTarget{}, } out, err := charService.Edit(ctx, editReq) - Expect(err).To(MatchError(model.ErrHandleRequest)) + Expect(err).To(MatchError(model.ErrHandleRequest.Err())) Expect(out).To(BeNil()) }) }) @@ -390,7 +390,7 @@ var _ = Describe("Character service", func() { mockRepository.EXPECT().Save(ctx, gomock.Any()).Return(charOut, fakeError) out, err := charService.AddPlayTime(ctx, character.ID, amount) Expect(err).To(MatchError(fakeError)) - Expect(out).To(BeEquivalentTo(charOut.PlayTime)) + Expect(out.PlayTime).To(BeEquivalentTo(charOut.PlayTime)) }) }) @@ -399,7 +399,7 @@ var _ = Describe("Character service", func() { mockRepository.EXPECT().FindById(ctx, character.ID).Return(nil, fakeError) out, err := charService.AddPlayTime(ctx, character.ID, amount) Expect(err).To(MatchError(fakeError)) - Expect(out).To(BeEquivalentTo(0)) + Expect(out).To(BeNil()) }) }) }) diff --git a/pkg/srv/character_test.go b/pkg/srv/character_test.go index 1b24c8f..b6b2553 100644 --- a/pkg/srv/character_test.go +++ b/pkg/srv/character_test.go @@ -88,10 +88,10 @@ var _ = Describe("Character server", func() { Time: 100, } mockCharService.EXPECT().FindByName(gomock.Any(), character.Name).Return(character, nil) - mockCharService.EXPECT().AddPlayTime(gomock.Any(), character.ID, req.Time).Return(uint64(200), nil) + mockCharService.EXPECT().AddPlayTime(gomock.Any(), character.ID, req.Time).Return(character, nil) out, err := server.AddCharacterPlayTime(incAdminCtx, req) Expect(err).NotTo(HaveOccurred()) - Expect(out.Time).To(BeEquivalentTo(200)) + Expect(out.Time).To(BeEquivalentTo(character.PlayTime)) }) It("should work given character id", func() { req := &pb.AddPlayTimeRequest{ @@ -100,10 +100,10 @@ var _ = Describe("Character server", func() { }, Time: 100, } - mockCharService.EXPECT().AddPlayTime(gomock.Any(), character.ID, req.Time).Return(uint64(200), nil) + mockCharService.EXPECT().AddPlayTime(gomock.Any(), character.ID, req.Time).Return(character, nil) out, err := server.AddCharacterPlayTime(incAdminCtx, req) Expect(err).NotTo(HaveOccurred()) - Expect(out.Time).To(BeEquivalentTo(200)) + Expect(out.Time).To(BeEquivalentTo(character.PlayTime)) }) }) When("given invalid input", func() { @@ -114,7 +114,7 @@ var _ = Describe("Character server", func() { }, Time: 100, } - mockCharService.EXPECT().AddPlayTime(gomock.Any(), character.ID, req.Time).Return(uint64(200), fakeErr) + mockCharService.EXPECT().AddPlayTime(gomock.Any(), character.ID, req.Time).Return(character, fakeErr) out, err := server.AddCharacterPlayTime(incAdminCtx, req) Expect(err).To(HaveOccurred()) Expect(out).To(BeNil()) diff --git a/pkg/srv/chat_test.go b/pkg/srv/chat_test.go index 2e90a74..5287f47 100644 --- a/pkg/srv/chat_test.go +++ b/pkg/srv/chat_test.go @@ -188,12 +188,12 @@ var _ = Describe("Chat", func() { When("given invalid input", func() { It("should error on invalid claims", func() { mockInSrv.EXPECT().Context().Return(nil).AnyTimes() - Expect(server.ConnectChannel(req, mockInSrv)).To(MatchError(model.ErrUnauthorized)) + Expect(server.ConnectChannel(req, mockInSrv)).To(MatchError(model.ErrUnauthorized.Err())) }) It("should error on no permissions (guest)", func() { mockInSrv.EXPECT().Context().Return(incGuestCtx).AnyTimes() - Expect(server.ConnectChannel(req, mockInSrv)).To(MatchError(model.ErrUnauthorized)) + Expect(server.ConnectChannel(req, mockInSrv)).To(MatchError(model.ErrUnauthorized.Err())) }) It("should error on no permissions for chat channel (player)", func() { @@ -202,7 +202,7 @@ var _ = Describe("Chat", func() { Return(&pb.CharactersDetails{Characters: []*pb.CharacterDetails{character.ToPb()}}, nil) mockChatService.EXPECT().AuthorizedChannelsForCharacter(gomock.Any(), character.ID).Return(model.ChatChannels{}, nil) mockInSrv.EXPECT().Context().Return(incPlayerCtx).AnyTimes() - Expect(server.ConnectChannel(req, mockInSrv)).To(MatchError(model.ErrUnauthorized)) + Expect(server.ConnectChannel(req, mockInSrv)).To(MatchError(model.ErrUnauthorized.Err())) }) It("should error if getting characters has errors", func() { @@ -210,7 +210,7 @@ var _ = Describe("Chat", func() { GetAllCharactersForUser(gomock.Any(), gomock.Any()). Return(nil, fakeErr) mockInSrv.EXPECT().Context().Return(incPlayerCtx).AnyTimes() - Expect(server.ConnectChannel(req, mockInSrv)).To(MatchError(model.ErrHandleRequest)) + Expect(server.ConnectChannel(req, mockInSrv)).To(MatchError(model.ErrHandleRequest.Err())) }) It("should error if getting authorized channels for character has errors", func() { @@ -219,7 +219,7 @@ var _ = Describe("Chat", func() { Return(&pb.CharactersDetails{Characters: []*pb.CharacterDetails{character.ToPb()}}, nil) mockChatService.EXPECT().AuthorizedChannelsForCharacter(gomock.Any(), character.ID).Return(nil, fakeErr) mockInSrv.EXPECT().Context().Return(incPlayerCtx).AnyTimes() - Expect(server.ConnectChannel(req, mockInSrv)).To(MatchError(model.ErrHandleRequest)) + Expect(server.ConnectChannel(req, mockInSrv)).To(MatchError(model.ErrHandleRequest.Err())) }) }) }) @@ -259,7 +259,7 @@ var _ = Describe("Chat", func() { }) It("should work for users with chat permissions (player)", func() { - _, claims, err := helpers.VerifyClaims(incPlayerCtx, keycloak, conf.Chat.Keycloak.Realm) + _, claims, err := helpers.VerifyClaims(incPlayerCtx, keycloak, conf.Keycloak.Realm) Expect(err).NotTo(HaveOccurred()) Expect(claims.Subject).To(Equal(character.OwnerId)) mockChatService.EXPECT().DirectMessagesReader(gomock.Any(), character.Name).Return(kafka.NewReader(readerConfig)) @@ -276,12 +276,12 @@ var _ = Describe("Chat", func() { When("given invalid input", func() { It("should error on invalid claims", func() { mockInSrv.EXPECT().Context().Return(nil).AnyTimes() - Expect(server.ConnectDirectMessage(req, mockInSrv)).To(MatchError(model.ErrUnauthorized)) + Expect(server.ConnectDirectMessage(req, mockInSrv)).To(MatchError(model.ErrUnauthorized.Err())) }) It("should error on no permissions (guest)", func() { mockInSrv.EXPECT().Context().Return(incGuestCtx).AnyTimes() - Expect(server.ConnectDirectMessage(req, mockInSrv)).To(MatchError(model.ErrUnauthorized)) + Expect(server.ConnectDirectMessage(req, mockInSrv)).To(MatchError(model.ErrUnauthorized.Err())) }) It("should error if not owner of character (player)", func() { @@ -290,7 +290,7 @@ var _ = Describe("Chat", func() { GetCharacter(gomock.Any(), gomock.Any()). Return(character.ToPb(), nil) mockInSrv.EXPECT().Context().Return(incPlayerCtx).AnyTimes() - Expect(server.ConnectDirectMessage(req, mockInSrv)).To(MatchError(model.ErrUnauthorized)) + Expect(server.ConnectDirectMessage(req, mockInSrv)).To(MatchError(model.ErrUnauthorized.Err())) }) It("should error if getting characters has errors", func() { diff --git a/pkg/srv/srv_suite_test.go b/pkg/srv/srv_suite_test.go index 5d6a713..9371086 100644 --- a/pkg/srv/srv_suite_test.go +++ b/pkg/srv/srv_suite_test.go @@ -9,9 +9,11 @@ import ( "github.com/Nerzal/gocloak/v13" "github.com/ShatteredRealms/go-backend/pkg/config" + "github.com/ShatteredRealms/go-backend/pkg/log" testdb "github.com/ShatteredRealms/go-backend/test/db" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/sirupsen/logrus/hooks/test" "google.golang.org/grpc/metadata" ) @@ -98,6 +100,7 @@ func TestSrv(t *testing.T) { var err error SynchronizedBeforeSuite(func() []byte { + log.Logger, _ = test.NewNullLogger() var host string keycloakCloseFunc, host = testdb.SetupKeycloakWithDocker() Expect(host).NotTo(BeNil()) @@ -109,28 +112,28 @@ func TestSrv(t *testing.T) { context.Background(), conf.Character.Keycloak.ClientId, conf.Character.Keycloak.ClientSecret, - conf.Character.Keycloak.Realm, + conf.Keycloak.Realm, ) Expect(err).NotTo(HaveOccurred()) // Eventually(func() error { - *admin.ID, err = keycloak.CreateUser(context.Background(), clientToken.AccessToken, conf.Character.Keycloak.Realm, admin) + *admin.ID, err = keycloak.CreateUser(context.Background(), clientToken.AccessToken, conf.Keycloak.Realm, admin) Expect(err).NotTo(HaveOccurred()) // }).Within(time.Minute).ProbeEvery(time.Second).ShouldNot(HaveOccurred()) - *player.ID, err = keycloak.CreateUser(context.Background(), clientToken.AccessToken, conf.Character.Keycloak.Realm, player) + *player.ID, err = keycloak.CreateUser(context.Background(), clientToken.AccessToken, conf.Keycloak.Realm, player) Expect(err).NotTo(HaveOccurred()) - *guest.ID, err = keycloak.CreateUser(context.Background(), clientToken.AccessToken, conf.Character.Keycloak.Realm, guest) + *guest.ID, err = keycloak.CreateUser(context.Background(), clientToken.AccessToken, conf.Keycloak.Realm, guest) Expect(err).NotTo(HaveOccurred()) - saRole, err := keycloak.GetRealmRole(context.Background(), clientToken.AccessToken, conf.Character.Keycloak.Realm, "super admin") + saRole, err := keycloak.GetRealmRole(context.Background(), clientToken.AccessToken, conf.Keycloak.Realm, "super admin") Expect(err).NotTo(HaveOccurred()) - userRole, err := keycloak.GetRealmRole(context.Background(), clientToken.AccessToken, conf.Character.Keycloak.Realm, "user") + userRole, err := keycloak.GetRealmRole(context.Background(), clientToken.AccessToken, conf.Keycloak.Realm, "user") Expect(err).NotTo(HaveOccurred()) err = keycloak.AddRealmRoleToUser( context.Background(), clientToken.AccessToken, - conf.Character.Keycloak.Realm, + conf.Keycloak.Realm, *admin.ID, []gocloak.Role{*saRole}, ) @@ -138,7 +141,7 @@ func TestSrv(t *testing.T) { err = keycloak.AddRealmRoleToUser( context.Background(), clientToken.AccessToken, - conf.Character.Keycloak.Realm, + conf.Keycloak.Realm, *player.ID, []gocloak.Role{*userRole}, ) @@ -151,6 +154,7 @@ func TestSrv(t *testing.T) { return []byte(out) }, func(data []byte) { + log.Logger, _ = test.NewNullLogger() splitData := strings.Split(string(data), "\n") Expect(splitData).To(HaveLen(2)) @@ -166,10 +170,10 @@ func TestSrv(t *testing.T) { context.Background(), conf.Character.Keycloak.ClientId, conf.Character.Keycloak.ClientSecret, - conf.Character.Keycloak.Realm, + conf.Keycloak.Realm, ) Expect(err).NotTo(HaveOccurred()) - adminToken, err = keycloak.GetToken(context.Background(), conf.Character.Keycloak.Realm, gocloak.TokenOptions{ + adminToken, err = keycloak.GetToken(context.Background(), conf.Keycloak.Realm, gocloak.TokenOptions{ ClientID: &conf.Character.Keycloak.ClientId, ClientSecret: &conf.Character.Keycloak.ClientSecret, GrantType: gocloak.StringP("password"), @@ -177,7 +181,7 @@ func TestSrv(t *testing.T) { Password: gocloak.StringP("Password1!"), }) Expect(err).NotTo(HaveOccurred()) - playerToken, err = keycloak.GetToken(context.Background(), conf.Character.Keycloak.Realm, gocloak.TokenOptions{ + playerToken, err = keycloak.GetToken(context.Background(), conf.Keycloak.Realm, gocloak.TokenOptions{ ClientID: &conf.Character.Keycloak.ClientId, ClientSecret: &conf.Character.Keycloak.ClientSecret, GrantType: gocloak.StringP("password"), @@ -185,7 +189,7 @@ func TestSrv(t *testing.T) { Password: gocloak.StringP("Password1!"), }) Expect(err).NotTo(HaveOccurred()) - guestToken, err = keycloak.GetToken(context.Background(), conf.Character.Keycloak.Realm, gocloak.TokenOptions{ + guestToken, err = keycloak.GetToken(context.Background(), conf.Keycloak.Realm, gocloak.TokenOptions{ ClientID: &conf.Character.Keycloak.ClientId, ClientSecret: &conf.Character.Keycloak.ClientSecret, GrantType: gocloak.StringP("password"), @@ -197,7 +201,7 @@ func TestSrv(t *testing.T) { admins, err := keycloak.GetUsers( context.Background(), clientToken.AccessToken, - conf.Character.Keycloak.Realm, + conf.Keycloak.Realm, gocloak.GetUsersParams{Username: admin.Username}, ) Expect(err).NotTo(HaveOccurred()) @@ -207,7 +211,7 @@ func TestSrv(t *testing.T) { players, err := keycloak.GetUsers( context.Background(), clientToken.AccessToken, - conf.Character.Keycloak.Realm, + conf.Keycloak.Realm, gocloak.GetUsersParams{Username: player.Username}, ) Expect(err).NotTo(HaveOccurred()) @@ -217,7 +221,7 @@ func TestSrv(t *testing.T) { guests, err := keycloak.GetUsers( context.Background(), clientToken.AccessToken, - conf.Character.Keycloak.Realm, + conf.Keycloak.Realm, gocloak.GetUsersParams{Username: guest.Username}, ) Expect(err).NotTo(HaveOccurred()) diff --git a/test/config.yaml b/test/config.yaml index 66d7196..1318418 100644 --- a/test/config.yaml +++ b/test/config.yaml @@ -3,7 +3,7 @@ character: host: 'characters' port: 8081 mode: 'local' - logLevel: 5 + logLevel: Debug keycloak: clientSecret: '**********' id: '738a426a-da91-4b16-b5fc-92d63a22eb76' @@ -20,7 +20,7 @@ gamebackend: host: 'gamebackend' port: 8082 mode: 'local' - logLevel: 5 + logLevel: Debug keycloak: clientSecret: '**********' id: 'c3cacba8-cd16-4a4f-bc86-367274cb7cb5' @@ -32,7 +32,7 @@ chat: host: 'chat' port: 8180 mode: 'local' - logLevel: 5 + logLevel: Debug keycloak: clientSecret: '**********' id: '4c79d4a0-a3fd-495f-b56e-eea508bb0862' diff --git a/test/db/docker.go b/test/db/docker.go index 6108d41..67df9d2 100644 --- a/test/db/docker.go +++ b/test/db/docker.go @@ -85,7 +85,10 @@ func SetupKeycloakWithDocker() (func(), string) { return err }, time.Second*60) - _, err = http.Get(host + "/realms/default") + err = Retry(func() error { + _, err = http.Get(host + "/realms/default") + return err + }, time.Second*60) chk(err) return closeFunc, host @@ -136,7 +139,7 @@ func SetupKafkaWithDocker() (func(), uint) { } fnConfig := func(config *docker.HostConfig) { - config.AutoRemove = false + config.AutoRemove = true config.RestartPolicy = docker.NeverRestart() } @@ -154,11 +157,10 @@ func SetupKafkaWithDocker() (func(), uint) { })) fnCleanup := func() { - // err1 := kafkaResource.Close() - _ = kafkaResource + err1 := kafkaResource.Close() err2 := zookeeperResource.Close() err3 := net.Close() - // chk(err1) + chk(err1) chk(err2) chk(err3) } @@ -207,7 +209,7 @@ func ConnectMongoDocker(host string) *mongo.Database { } mdb = db.Database("testdb") return db.Ping(context.TODO(), nil) - }, time.Second*10)) + }, time.Second*30)) return mdb }