diff --git a/coverage/coverage.out b/coverage/coverage.out index 3b3f325a..c398ba4a 100644 --- a/coverage/coverage.out +++ b/coverage/coverage.out @@ -1,4 +1,59 @@ mode: set +github.com/echovault/echovault/internal/aof/log/store.go:46.60,47.34 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:47.34,49.3 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:52.61,53.34 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:53.34,55.3 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:58.67,59.34 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:59.34,61.3 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:64.63,65.34 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:65.34,67.3 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:70.77,71.34 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:71.34,73.3 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:76.80,83.39 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:83.40,83.41 0 0 +github.com/echovault/echovault/internal/aof/log/store.go:86.2,86.33 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:86.33,88.3 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:91.2,91.46 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:91.46,94.17 2 1 +github.com/echovault/echovault/internal/aof/log/store.go:94.17,96.4 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:97.3,98.17 2 1 +github.com/echovault/echovault/internal/aof/log/store.go:98.17,100.4 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:101.3,101.15 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:106.2,106.51 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:106.51,107.13 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:107.13,108.8 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:108.8,110.40 2 1 +github.com/echovault/echovault/internal/aof/log/store.go:110.40,113.11 3 0 +github.com/echovault/echovault/internal/aof/log/store.go:115.5,116.41 2 1 +github.com/echovault/echovault/internal/aof/log/store.go:121.2,121.19 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:124.55,126.21 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:126.21,128.3 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:130.2,135.47 4 1 +github.com/echovault/echovault/internal/aof/log/store.go:135.47,137.3 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:139.2,139.49 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:139.49,140.38 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:140.38,142.4 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:145.2,145.12 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:148.40,149.21 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:149.21,151.3 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:152.2,152.12 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:155.43,160.47 3 1 +github.com/echovault/echovault/internal/aof/log/store.go:160.47,162.3 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:164.2,165.6 2 1 +github.com/echovault/echovault/internal/aof/log/store.go:165.6,167.34 2 1 +github.com/echovault/echovault/internal/aof/log/store.go:167.34,169.4 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:170.3,170.13 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:170.13,172.9 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:174.3,175.17 2 1 +github.com/echovault/echovault/internal/aof/log/store.go:175.17,177.4 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:178.3,178.31 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:181.2,181.12 1 1 +github.com/echovault/echovault/internal/aof/log/store.go:184.44,187.45 3 0 +github.com/echovault/echovault/internal/aof/log/store.go:187.45,189.3 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:191.2,191.47 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:191.47,193.3 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:194.2,194.12 1 0 +github.com/echovault/echovault/internal/aof/log/store.go:197.41,201.2 3 1 github.com/echovault/echovault/internal/aof/engine.go:50.56,51.30 1 1 github.com/echovault/echovault/internal/aof/engine.go:51.30,53.3 1 1 github.com/echovault/echovault/internal/aof/engine.go:56.57,57.30 1 1 @@ -102,61 +157,6 @@ github.com/echovault/echovault/internal/aof/preamble/store.go:185.43,187.4 1 1 github.com/echovault/echovault/internal/aof/preamble/store.go:189.2,189.35 1 1 github.com/echovault/echovault/internal/aof/preamble/store.go:189.35,191.3 1 1 github.com/echovault/echovault/internal/aof/preamble/store.go:192.2,192.14 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:46.60,47.34 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:47.34,49.3 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:52.61,53.34 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:53.34,55.3 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:58.67,59.34 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:59.34,61.3 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:64.63,65.34 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:65.34,67.3 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:70.77,71.34 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:71.34,73.3 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:76.80,83.39 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:83.40,83.41 0 0 -github.com/echovault/echovault/internal/aof/log/store.go:86.2,86.33 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:86.33,88.3 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:91.2,91.46 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:91.46,94.17 2 1 -github.com/echovault/echovault/internal/aof/log/store.go:94.17,96.4 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:97.3,98.17 2 1 -github.com/echovault/echovault/internal/aof/log/store.go:98.17,100.4 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:101.3,101.15 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:106.2,106.51 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:106.51,107.13 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:107.13,108.8 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:108.8,110.40 2 1 -github.com/echovault/echovault/internal/aof/log/store.go:110.40,113.11 3 1 -github.com/echovault/echovault/internal/aof/log/store.go:115.5,116.41 2 0 -github.com/echovault/echovault/internal/aof/log/store.go:121.2,121.19 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:124.55,126.21 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:126.21,128.3 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:130.2,135.47 4 1 -github.com/echovault/echovault/internal/aof/log/store.go:135.47,137.3 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:139.2,139.49 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:139.49,140.38 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:140.38,142.4 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:145.2,145.12 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:148.40,149.21 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:149.21,151.3 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:152.2,152.12 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:155.43,160.47 3 1 -github.com/echovault/echovault/internal/aof/log/store.go:160.47,162.3 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:164.2,165.6 2 1 -github.com/echovault/echovault/internal/aof/log/store.go:165.6,167.34 2 1 -github.com/echovault/echovault/internal/aof/log/store.go:167.34,169.4 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:170.3,170.13 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:170.13,172.9 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:174.3,175.17 2 1 -github.com/echovault/echovault/internal/aof/log/store.go:175.17,177.4 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:178.3,178.31 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:181.2,181.12 1 1 -github.com/echovault/echovault/internal/aof/log/store.go:184.44,187.45 3 0 -github.com/echovault/echovault/internal/aof/log/store.go:187.45,189.3 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:191.2,191.47 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:191.47,193.3 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:194.2,194.12 1 0 -github.com/echovault/echovault/internal/aof/log/store.go:197.41,201.2 3 1 github.com/echovault/echovault/internal/eviction/lfu.go:35.29,42.2 3 1 github.com/echovault/echovault/internal/eviction/lfu.go:44.34,46.2 1 1 github.com/echovault/echovault/internal/eviction/lfu.go:48.44,50.54 1 1 @@ -1643,99 +1643,6 @@ github.com/echovault/echovault/internal/modules/acl/user.go:289.40,304.2 1 1 github.com/echovault/echovault/internal/modules/acl/user.go:306.46,307.24 1 1 github.com/echovault/echovault/internal/modules/acl/user.go:307.24,309.3 1 1 github.com/echovault/echovault/internal/modules/acl/user.go:310.2,310.26 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:27.78,33.29 4 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:33.29,34.54 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:34.54,40.42 4 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:40.42,42.5 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:44.4,47.12 3 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:50.3,50.36 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:50.36,57.43 5 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:57.43,59.5 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:61.4,63.21 2 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:67.2,69.25 2 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:72.76,76.35 3 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:76.35,77.65 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:77.65,78.41 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:78.41,80.5 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:81.4,81.12 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:83.3,83.13 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:86.2,86.51 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:89.75,90.29 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:91.9,96.36 4 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:96.36,97.66 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:97.66,98.52 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:98.52,102.6 3 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:103.5,103.13 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:105.4,106.14 2 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:108.3,109.26 2 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:111.9,115.56 3 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:115.56,117.4 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:118.3,118.53 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:118.53,122.37 3 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:122.37,123.67 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:123.67,124.53 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:124.53,125.59 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:125.59,129.8 3 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:131.6,131.14 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:133.5,133.54 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:133.54,136.6 2 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:138.9,138.61 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:138.61,142.37 3 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:142.37,143.67 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:143.67,144.53 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:144.53,146.24 2 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:146.24,149.8 2 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:151.6,151.14 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:153.5,153.33 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:153.33,156.6 2 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:158.9,158.60 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:158.60,162.37 3 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:162.37,163.67 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:163.67,164.53 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:164.53,165.55 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:165.55,169.8 3 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:171.6,171.14 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:173.5,173.50 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:173.50,176.6 2 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:178.9,180.4 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:181.3,182.26 2 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:183.10,184.54 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:188.75,190.2 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:192.36,200.84 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:200.84,204.5 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:213.84,217.5 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:225.86,229.7 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:238.86,242.7 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:252.86,256.7 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:267.84,271.5 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:272.73,273.49 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:273.49,275.6 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:276.5,276.45 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:285.84,289.5 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:290.73,292.18 2 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:292.18,294.6 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:295.5,295.53 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:304.84,308.5 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:309.73,310.47 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:310.47,312.6 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:313.5,313.45 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:321.84,325.5 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:335.86,339.7 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:340.75,341.34 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:341.34,343.8 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:344.7,345.34 2 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:345.34,347.8 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:348.7,348.75 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:348.75,350.8 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:351.7,351.47 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:360.86,364.7 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:365.75,366.35 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:366.35,368.8 1 0 -github.com/echovault/echovault/internal/modules/admin/commands.go:369.7,370.47 2 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:379.86,383.7 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:384.75,387.38 3 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:387.38,389.8 1 1 -github.com/echovault/echovault/internal/modules/admin/commands.go:390.7,390.30 1 1 github.com/echovault/echovault/internal/modules/connection/commands.go:24.68,25.29 1 1 github.com/echovault/echovault/internal/modules/connection/commands.go:26.10,27.54 1 1 github.com/echovault/echovault/internal/modules/connection/commands.go:28.9,29.34 1 1 @@ -3960,6 +3867,99 @@ github.com/echovault/echovault/internal/modules/sorted_set/utils.go:162.3,162.13 github.com/echovault/echovault/internal/modules/sorted_set/utils.go:163.12,164.16 1 1 github.com/echovault/echovault/internal/modules/sorted_set/utils.go:164.16,166.4 1 1 github.com/echovault/echovault/internal/modules/sorted_set/utils.go:167.3,167.13 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:27.78,33.29 4 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:33.29,34.54 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:34.54,40.42 4 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:40.42,42.5 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:44.4,47.12 3 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:50.3,50.36 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:50.36,57.43 5 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:57.43,59.5 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:61.4,63.21 2 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:67.2,69.25 2 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:72.76,76.35 3 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:76.35,77.65 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:77.65,78.41 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:78.41,80.5 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:81.4,81.12 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:83.3,83.13 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:86.2,86.51 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:89.75,90.29 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:91.9,96.36 4 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:96.36,97.66 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:97.66,98.52 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:98.52,102.6 3 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:103.5,103.13 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:105.4,106.14 2 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:108.3,109.26 2 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:111.9,115.56 3 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:115.56,117.4 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:118.3,118.53 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:118.53,122.37 3 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:122.37,123.67 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:123.67,124.53 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:124.53,125.59 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:125.59,129.8 3 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:131.6,131.14 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:133.5,133.54 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:133.54,136.6 2 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:138.9,138.61 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:138.61,142.37 3 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:142.37,143.67 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:143.67,144.53 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:144.53,146.24 2 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:146.24,149.8 2 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:151.6,151.14 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:153.5,153.33 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:153.33,156.6 2 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:158.9,158.60 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:158.60,162.37 3 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:162.37,163.67 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:163.67,164.53 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:164.53,165.55 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:165.55,169.8 3 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:171.6,171.14 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:173.5,173.50 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:173.50,176.6 2 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:178.9,180.4 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:181.3,182.26 2 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:183.10,184.54 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:188.75,190.2 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:192.36,200.84 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:200.84,204.5 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:213.84,217.5 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:225.86,229.7 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:238.86,242.7 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:252.86,256.7 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:267.84,271.5 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:272.73,273.49 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:273.49,275.6 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:276.5,276.45 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:285.84,289.5 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:290.73,292.18 2 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:292.18,294.6 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:295.5,295.53 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:304.84,308.5 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:309.73,310.47 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:310.47,312.6 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:313.5,313.45 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:321.84,325.5 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:335.86,339.7 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:340.75,341.34 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:341.34,343.8 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:344.7,345.34 2 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:345.34,347.8 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:348.7,348.75 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:348.75,350.8 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:351.7,351.47 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:360.86,364.7 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:365.75,366.35 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:366.35,368.8 1 0 +github.com/echovault/echovault/internal/modules/admin/commands.go:369.7,370.47 2 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:379.86,383.7 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:384.75,387.38 3 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:387.38,389.8 1 1 +github.com/echovault/echovault/internal/modules/admin/commands.go:390.7,390.30 1 1 github.com/echovault/echovault/internal/modules/string/commands.go:24.72,26.16 2 1 github.com/echovault/echovault/internal/modules/string/commands.go:26.16,28.3 1 1 github.com/echovault/echovault/internal/modules/string/commands.go:30.2,33.9 3 1 diff --git a/internal/modules/admin/commands_test.go b/internal/modules/admin/commands_test.go index 6a6f1cb9..474f0d94 100644 --- a/internal/modules/admin/commands_test.go +++ b/internal/modules/admin/commands_test.go @@ -153,6 +153,185 @@ func Test_AdminCommand(t *testing.T) { } }) + t.Run("Test COMMAND COUNT command", func(t *testing.T) { + t.Parallel() + + port, err := internal.GetFreePort() + if err != nil { + t.Error(err) + return + } + mockServer, err := setupServer(uint16(port)) + if err != nil { + t.Error(err) + return + } + + res, err := getHandler(mockServer, "COMMAND", "COUNT")( + getHandlerFuncParams(context.Background(), mockServer, []string{"command", "count"}, nil), + ) + if err != nil { + t.Error(err) + } + + rd := resp.NewReader(bytes.NewReader(res)) + rv, _, err := rd.ReadValue() + if err != nil { + t.Error(err) + } + + // Get all the commands from the existing modules. + var commands []internal.Command + commands = append(commands, acl.Commands()...) + commands = append(commands, admin.Commands()...) + commands = append(commands, generic.Commands()...) + commands = append(commands, hash.Commands()...) + commands = append(commands, list.Commands()...) + commands = append(commands, connection.Commands()...) + commands = append(commands, pubsub.Commands()...) + commands = append(commands, set.Commands()...) + commands = append(commands, sorted_set.Commands()...) + commands = append(commands, str.Commands()...) + + // Flatten the commands and subcommands. + var allCommands []string + for _, c := range commands { + if c.SubCommands == nil || len(c.SubCommands) == 0 { + allCommands = append(allCommands, c.Command) + continue + } + for _, sc := range c.SubCommands { + allCommands = append(allCommands, fmt.Sprintf("%s|%s", c.Command, sc.Command)) + } + } + + if len(allCommands) != rv.Integer() { + t.Errorf("expected COMMAND COUNT to return %d, got %d", len(allCommands), rv.Integer()) + } + }) + + t.Run("Test COMMAND LIST command", func(t *testing.T) { + t.Parallel() + + port, err := internal.GetFreePort() + if err != nil { + t.Error(err) + return + } + + mockServer, err := setupServer(uint16(port)) + if err != nil { + t.Error(err) + return + } + + // Get all the commands from the existing modules. + var allCommands []internal.Command + allCommands = append(allCommands, acl.Commands()...) + allCommands = append(allCommands, admin.Commands()...) + allCommands = append(allCommands, generic.Commands()...) + allCommands = append(allCommands, hash.Commands()...) + allCommands = append(allCommands, list.Commands()...) + allCommands = append(allCommands, connection.Commands()...) + allCommands = append(allCommands, pubsub.Commands()...) + allCommands = append(allCommands, set.Commands()...) + allCommands = append(allCommands, sorted_set.Commands()...) + allCommands = append(allCommands, str.Commands()...) + + tests := []struct { + name string + cmd []string + want []string + }{ + { + name: "1. Return all commands with no filter specified", + cmd: []string{"COMMAND", "LIST"}, + want: func() []string { + var commands []string + for _, command := range allCommands { + if command.SubCommands == nil || len(command.SubCommands) == 0 { + commands = append(commands, command.Command) + continue + } + for _, subcommand := range command.SubCommands { + commands = append(commands, fmt.Sprintf("%s %s", command.Command, subcommand.Command)) + } + } + return commands + }(), + }, + { + name: "2. Return all commands that contain the provided ACL category", + cmd: []string{"COMMAND", "LIST", "FILTERBY", "ACLCAT", constants.FastCategory}, + want: func() []string { + var commands []string + for _, command := range allCommands { + if (command.SubCommands == nil || len(command.SubCommands) == 0) && + slices.Contains(command.Categories, constants.FastCategory) { + commands = append(commands, command.Command) + continue + } + for _, subcommand := range command.SubCommands { + if slices.Contains(subcommand.Categories, constants.FastCategory) { + commands = append(commands, fmt.Sprintf("%s %s", command.Command, subcommand.Command)) + } + } + } + return commands + }(), + }, + { + name: "3. Return all commands that match the provided pattern", + cmd: []string{"COMMAND", "LIST", "FILTERBY", "PATTERN", "z*"}, + want: func() []string { + var commands []string + for _, command := range sorted_set.Commands() { + commands = append(commands, command.Command) + } + return commands + }(), + }, + { + name: "4. Return all commands that belong to the specified module", + cmd: []string{"COMMAND", "LIST", "FILTERBY", "MODULE", constants.HashModule}, + want: func() []string { + var commands []string + for _, command := range hash.Commands() { + commands = append(commands, command.Command) + } + return commands + }(), + }, + } + + for _, test := range tests { + res, err := getHandler(mockServer, test.cmd...)( + getHandlerFuncParams(context.Background(), mockServer, test.cmd, nil), + ) + if err != nil { + t.Error(err) + } + + rd := resp.NewReader(bytes.NewReader(res)) + rv, _, err := rd.ReadValue() + if err != nil { + t.Error(err) + } + + if len(rv.Array()) != len(test.want) { + t.Errorf("expected response of length %d, got %d", len(test.want), len(rv.Array())) + } + + for _, command := range rv.Array() { + if !slices.ContainsFunc(test.want, func(c string) bool { + return strings.EqualFold(c, command.String()) + }) { + t.Errorf("command \"%s\" is not expected in response but is returned", command.String()) + } + } + } + }) + t.Run("Test MODULE LOAD command", func(t *testing.T) { t.Parallel()