From df51142217c595f5d220e99137f88be947f99595 Mon Sep 17 00:00:00 2001 From: Kelvin Clement Mwinuka Date: Thu, 9 May 2024 01:36:52 +0800 Subject: [PATCH 1/2] Implemented test for LoadModule, ListModules, and UnloadModule. Added check for existence of module file using os.Stat before attempting to open the file. Added build-module-tests step in makefile to simplify building modules for unit and race tests --- Makefile | 12 +- coverage/coverage.out | 534 ++++++++++++++++++------------------ echovault/api_admin_test.go | 58 ++++ echovault/plugin.go | 9 + 4 files changed, 344 insertions(+), 269 deletions(-) diff --git a/Makefile b/Makefile index e9607b5a..e3d689da 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,10 @@ build-modules: CGO_ENABLED=$(CGO_ENABLED) CC=$(CC) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -buildmode=plugin -o $(DEST)/module_set/module_set.so ./volumes/modules/module_set/module_set.go && \ CGO_ENABLED=$(CGO_ENABLED) CC=$(CC) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -buildmode=plugin -o $(DEST)/module_get/module_get.so ./volumes/modules/module_get/module_get.go +build-modules-test: + CGO_ENABLED=1 go build --race=$(RACE) -buildmode=plugin -o $(OUT)/modules/module_set/module_set.so ./volumes/modules/module_set/module_set.go && \ + CGO_ENABLED=1 go build --race=$(RACE) -buildmode=plugin -o $(OUT)/modules/module_get/module_get.so ./volumes/modules/module_get/module_get.go + build-server: CGO_ENABLED=$(CGO_ENABLED) CC=$(CC) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(DEST)/server ./cmd/main.go @@ -13,13 +17,13 @@ run: make build && docker-compose up --build test-unit: - CGO_ENABLED=1 go build -buildmode=plugin -o internal/modules/admin/testdata/modules/module_set/module_set.so ./volumes/modules/module_set/module_set.go && \ - CGO_ENABLED=1 go build -buildmode=plugin -o internal/modules/admin/testdata/modules/module_get/module_get.so ./volumes/modules/module_get/module_get.go && \ + env RACE=false OUT=internal/modules/admin/testdata make build-modules-test && \ + env RACE=false OUT=echovault/testdata make build-modules-test && \ go clean -testcache && \ CGO_ENABLED=1 go test ./... -coverprofile coverage/coverage.out test-race: - CGO_ENABLED=1 go build -buildmode=plugin --race -o internal/modules/admin/testdata/modules/module_set/module_set.so ./volumes/modules/module_set/module_set.go && \ - CGO_ENABLED=1 go build -buildmode=plugin --race -o internal/modules/admin/testdata/modules/module_get/module_get.so ./volumes/modules/module_get/module_get.go && \ + env RACE=true OUT=internal/modules/admin/testdata make build-modules-test && \ + env RACE=true OUT=echovault/testdata make build-modules-test && \ go clean -testcache && \ CGO_ENABLED=1 go test ./... --race \ No newline at end of file diff --git a/coverage/coverage.out b/coverage/coverage.out index db263395..3b3f325a 100644 --- a/coverage/coverage.out +++ b/coverage/coverage.out @@ -1,4 +1,52 @@ mode: set +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 +github.com/echovault/echovault/internal/aof/engine.go:57.30,59.3 1 1 +github.com/echovault/echovault/internal/aof/engine.go:62.59,63.30 1 1 +github.com/echovault/echovault/internal/aof/engine.go:63.30,65.3 1 1 +github.com/echovault/echovault/internal/aof/engine.go:68.58,69.30 1 1 +github.com/echovault/echovault/internal/aof/engine.go:69.30,71.3 1 1 +github.com/echovault/echovault/internal/aof/engine.go:74.59,75.30 1 1 +github.com/echovault/echovault/internal/aof/engine.go:75.30,77.3 1 1 +github.com/echovault/echovault/internal/aof/engine.go:80.82,81.30 1 1 +github.com/echovault/echovault/internal/aof/engine.go:81.30,83.3 1 1 +github.com/echovault/echovault/internal/aof/engine.go:86.89,87.30 1 1 +github.com/echovault/echovault/internal/aof/engine.go:87.30,89.3 1 1 +github.com/echovault/echovault/internal/aof/engine.go:92.73,93.30 1 1 +github.com/echovault/echovault/internal/aof/engine.go:93.30,95.3 1 1 +github.com/echovault/echovault/internal/aof/engine.go:98.82,99.30 1 1 +github.com/echovault/echovault/internal/aof/engine.go:99.30,101.3 1 1 +github.com/echovault/echovault/internal/aof/engine.go:104.78,105.30 1 1 +github.com/echovault/echovault/internal/aof/engine.go:105.30,107.3 1 1 +github.com/echovault/echovault/internal/aof/engine.go:110.69,118.29 1 1 +github.com/echovault/echovault/internal/aof/engine.go:118.30,118.31 0 0 +github.com/echovault/echovault/internal/aof/engine.go:119.30,119.31 0 0 +github.com/echovault/echovault/internal/aof/engine.go:120.57,120.71 1 0 +github.com/echovault/echovault/internal/aof/engine.go:121.63,121.64 0 0 +github.com/echovault/echovault/internal/aof/engine.go:122.44,122.45 0 0 +github.com/echovault/echovault/internal/aof/engine.go:127.2,127.33 1 1 +github.com/echovault/echovault/internal/aof/engine.go:127.33,129.3 1 1 +github.com/echovault/echovault/internal/aof/engine.go:132.2,139.16 2 1 +github.com/echovault/echovault/internal/aof/engine.go:139.16,141.3 1 0 +github.com/echovault/echovault/internal/aof/engine.go:142.2,152.16 3 1 +github.com/echovault/echovault/internal/aof/engine.go:152.16,154.3 1 0 +github.com/echovault/echovault/internal/aof/engine.go:155.2,159.12 2 1 +github.com/echovault/echovault/internal/aof/engine.go:159.12,160.7 1 1 +github.com/echovault/echovault/internal/aof/engine.go:160.7,162.54 2 1 +github.com/echovault/echovault/internal/aof/engine.go:162.54,164.5 1 0 +github.com/echovault/echovault/internal/aof/engine.go:168.2,168.20 1 1 +github.com/echovault/echovault/internal/aof/engine.go:171.52,173.2 1 1 +github.com/echovault/echovault/internal/aof/engine.go:175.42,183.62 5 1 +github.com/echovault/echovault/internal/aof/engine.go:183.62,185.3 1 0 +github.com/echovault/echovault/internal/aof/engine.go:188.2,188.54 1 1 +github.com/echovault/echovault/internal/aof/engine.go:188.54,190.3 1 0 +github.com/echovault/echovault/internal/aof/engine.go:192.2,192.12 1 1 +github.com/echovault/echovault/internal/aof/engine.go:195.39,196.55 1 1 +github.com/echovault/echovault/internal/aof/engine.go:196.55,198.3 1 0 +github.com/echovault/echovault/internal/aof/engine.go:199.2,199.53 1 1 +github.com/echovault/echovault/internal/aof/engine.go:199.53,201.3 1 0 +github.com/echovault/echovault/internal/aof/engine.go:202.2,202.12 1 1 github.com/echovault/echovault/internal/aof/preamble/store.go:45.62,46.36 1 1 github.com/echovault/echovault/internal/aof/preamble/store.go:46.36,48.3 1 1 github.com/echovault/echovault/internal/aof/preamble/store.go:51.71,52.36 1 0 @@ -54,6 +102,95 @@ 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 +github.com/echovault/echovault/internal/eviction/lfu.go:50.54,52.3 1 1 +github.com/echovault/echovault/internal/eviction/lfu.go:54.2,54.56 1 1 +github.com/echovault/echovault/internal/eviction/lfu.go:57.39,61.2 3 1 +github.com/echovault/echovault/internal/eviction/lfu.go:63.38,72.2 3 1 +github.com/echovault/echovault/internal/eviction/lfu.go:74.34,83.2 8 1 +github.com/echovault/echovault/internal/eviction/lfu.go:85.43,87.26 1 1 +github.com/echovault/echovault/internal/eviction/lfu.go:87.26,90.3 2 1 +github.com/echovault/echovault/internal/eviction/lfu.go:92.2,92.69 1 1 +github.com/echovault/echovault/internal/eviction/lfu.go:92.69,94.3 1 1 +github.com/echovault/echovault/internal/eviction/lfu.go:95.2,97.27 3 1 +github.com/echovault/echovault/internal/eviction/lfu.go:100.43,101.73 1 0 +github.com/echovault/echovault/internal/eviction/lfu.go:101.73,103.3 1 0 +github.com/echovault/echovault/internal/eviction/lfu.go:104.2,104.19 1 0 +github.com/echovault/echovault/internal/eviction/lfu.go:104.19,106.3 1 0 +github.com/echovault/echovault/internal/eviction/lfu.go:109.50,112.2 2 1 +github.com/echovault/echovault/internal/eviction/lru.go:34.29,41.2 3 1 +github.com/echovault/echovault/internal/eviction/lru.go:43.34,45.2 1 1 +github.com/echovault/echovault/internal/eviction/lru.go:47.44,49.2 1 1 +github.com/echovault/echovault/internal/eviction/lru.go:51.39,55.2 3 1 +github.com/echovault/echovault/internal/eviction/lru.go:57.38,64.2 2 1 +github.com/echovault/echovault/internal/eviction/lru.go:66.34,75.2 8 1 +github.com/echovault/echovault/internal/eviction/lru.go:77.43,79.26 1 1 +github.com/echovault/echovault/internal/eviction/lru.go:79.26,81.3 1 1 +github.com/echovault/echovault/internal/eviction/lru.go:83.2,83.69 1 1 +github.com/echovault/echovault/internal/eviction/lru.go:83.69,85.3 1 1 +github.com/echovault/echovault/internal/eviction/lru.go:86.2,88.27 3 1 +github.com/echovault/echovault/internal/eviction/lru.go:91.43,92.73 1 0 +github.com/echovault/echovault/internal/eviction/lru.go:92.73,94.3 1 0 +github.com/echovault/echovault/internal/eviction/lru.go:95.2,95.19 1 0 +github.com/echovault/echovault/internal/eviction/lru.go:95.19,97.3 1 0 +github.com/echovault/echovault/internal/eviction/lru.go:100.50,103.2 2 1 github.com/echovault/echovault/echovault/api_acl.go:125.71,127.23 2 0 github.com/echovault/echovault/echovault/api_acl.go:127.23,129.3 1 0 github.com/echovault/echovault/echovault/api_acl.go:130.2,131.16 2 0 @@ -1014,50 +1151,54 @@ github.com/echovault/echovault/echovault/modules.go:131.3,131.18 1 0 github.com/echovault/echovault/echovault/modules.go:135.2,135.34 1 0 github.com/echovault/echovault/echovault/modules.go:135.34,138.3 2 0 github.com/echovault/echovault/echovault/modules.go:140.2,140.72 1 0 -github.com/echovault/echovault/echovault/plugin.go:35.72,40.16 4 0 -github.com/echovault/echovault/echovault/plugin.go:40.16,42.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:44.2,45.16 2 0 -github.com/echovault/echovault/echovault/plugin.go:45.16,47.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:48.2,49.9 2 0 -github.com/echovault/echovault/echovault/plugin.go:49.9,51.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:53.2,54.16 2 0 +github.com/echovault/echovault/echovault/plugin.go:37.72,41.41 3 1 +github.com/echovault/echovault/echovault/plugin.go:41.41,42.37 1 1 +github.com/echovault/echovault/echovault/plugin.go:42.37,44.4 1 1 +github.com/echovault/echovault/echovault/plugin.go:45.3,45.44 1 0 +github.com/echovault/echovault/echovault/plugin.go:48.2,49.16 2 1 +github.com/echovault/echovault/echovault/plugin.go:49.16,51.3 1 0 +github.com/echovault/echovault/echovault/plugin.go:53.2,54.16 2 1 github.com/echovault/echovault/echovault/plugin.go:54.16,56.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:57.2,58.9 2 0 +github.com/echovault/echovault/echovault/plugin.go:57.2,58.9 2 1 github.com/echovault/echovault/echovault/plugin.go:58.9,60.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:62.2,63.16 2 0 +github.com/echovault/echovault/echovault/plugin.go:62.2,63.16 2 1 github.com/echovault/echovault/echovault/plugin.go:63.16,65.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:66.2,67.9 2 0 +github.com/echovault/echovault/echovault/plugin.go:66.2,67.9 2 1 github.com/echovault/echovault/echovault/plugin.go:67.9,69.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:71.2,72.16 2 0 +github.com/echovault/echovault/echovault/plugin.go:71.2,72.16 2 1 github.com/echovault/echovault/echovault/plugin.go:72.16,74.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:75.2,76.9 2 0 +github.com/echovault/echovault/echovault/plugin.go:75.2,76.9 2 1 github.com/echovault/echovault/echovault/plugin.go:76.9,78.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:80.2,81.16 2 0 +github.com/echovault/echovault/echovault/plugin.go:80.2,81.16 2 1 github.com/echovault/echovault/echovault/plugin.go:81.16,83.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:84.2,85.9 2 0 +github.com/echovault/echovault/echovault/plugin.go:84.2,85.9 2 1 github.com/echovault/echovault/echovault/plugin.go:85.9,87.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:89.2,90.16 2 0 +github.com/echovault/echovault/echovault/plugin.go:89.2,90.16 2 1 github.com/echovault/echovault/echovault/plugin.go:90.16,92.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:93.2,106.9 2 0 -github.com/echovault/echovault/echovault/plugin.go:106.9,108.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:111.2,111.91 1 0 -github.com/echovault/echovault/echovault/plugin.go:111.91,113.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:116.2,119.31 1 0 -github.com/echovault/echovault/echovault/plugin.go:119.31,122.36 2 0 -github.com/echovault/echovault/echovault/plugin.go:122.36,124.5 1 0 -github.com/echovault/echovault/echovault/plugin.go:125.4,125.15 1 0 -github.com/echovault/echovault/echovault/plugin.go:130.83,132.18 2 0 -github.com/echovault/echovault/echovault/plugin.go:132.18,134.5 1 0 -github.com/echovault/echovault/echovault/plugin.go:135.4,139.10 1 0 -github.com/echovault/echovault/echovault/plugin.go:141.72,155.4 1 0 -github.com/echovault/echovault/echovault/plugin.go:158.2,158.12 1 0 -github.com/echovault/echovault/echovault/plugin.go:166.54,169.91 3 0 -github.com/echovault/echovault/echovault/plugin.go:169.91,171.3 1 0 -github.com/echovault/echovault/echovault/plugin.go:177.49,181.42 4 0 -github.com/echovault/echovault/echovault/plugin.go:181.42,182.61 1 0 -github.com/echovault/echovault/echovault/plugin.go:182.61,184.4 1 0 -github.com/echovault/echovault/echovault/plugin.go:184.6,186.4 1 0 -github.com/echovault/echovault/echovault/plugin.go:188.2,188.16 1 0 +github.com/echovault/echovault/echovault/plugin.go:93.2,94.9 2 1 +github.com/echovault/echovault/echovault/plugin.go:94.9,96.3 1 0 +github.com/echovault/echovault/echovault/plugin.go:98.2,99.16 2 1 +github.com/echovault/echovault/echovault/plugin.go:99.16,101.3 1 0 +github.com/echovault/echovault/echovault/plugin.go:102.2,115.9 2 1 +github.com/echovault/echovault/echovault/plugin.go:115.9,117.3 1 0 +github.com/echovault/echovault/echovault/plugin.go:120.2,120.91 1 1 +github.com/echovault/echovault/echovault/plugin.go:120.91,122.3 1 1 +github.com/echovault/echovault/echovault/plugin.go:125.2,128.31 1 1 +github.com/echovault/echovault/echovault/plugin.go:128.31,131.36 2 1 +github.com/echovault/echovault/echovault/plugin.go:131.36,133.5 1 1 +github.com/echovault/echovault/echovault/plugin.go:134.4,134.15 1 1 +github.com/echovault/echovault/echovault/plugin.go:139.83,141.18 2 0 +github.com/echovault/echovault/echovault/plugin.go:141.18,143.5 1 0 +github.com/echovault/echovault/echovault/plugin.go:144.4,148.10 1 0 +github.com/echovault/echovault/echovault/plugin.go:150.72,164.4 1 0 +github.com/echovault/echovault/echovault/plugin.go:167.2,167.12 1 1 +github.com/echovault/echovault/echovault/plugin.go:175.54,178.91 3 1 +github.com/echovault/echovault/echovault/plugin.go:178.91,180.3 1 1 +github.com/echovault/echovault/echovault/plugin.go:186.49,190.42 4 1 +github.com/echovault/echovault/echovault/plugin.go:190.42,191.61 1 1 +github.com/echovault/echovault/echovault/plugin.go:191.61,193.4 1 1 +github.com/echovault/echovault/echovault/plugin.go:193.6,195.4 1 1 +github.com/echovault/echovault/echovault/plugin.go:197.2,197.16 1 1 github.com/echovault/echovault/echovault/test_helpers.go:9.35,16.2 2 1 github.com/echovault/echovault/echovault/test_helpers.go:18.95,19.61 1 1 github.com/echovault/echovault/echovault/test_helpers.go:19.61,21.3 1 0 @@ -1065,143 +1206,6 @@ github.com/echovault/echovault/echovault/test_helpers.go:22.2,22.57 1 1 github.com/echovault/echovault/echovault/test_helpers.go:22.57,24.3 1 0 github.com/echovault/echovault/echovault/test_helpers.go:25.2,26.12 2 1 github.com/echovault/echovault/echovault/test_helpers.go:29.95,34.2 4 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 -github.com/echovault/echovault/internal/aof/engine.go:57.30,59.3 1 1 -github.com/echovault/echovault/internal/aof/engine.go:62.59,63.30 1 1 -github.com/echovault/echovault/internal/aof/engine.go:63.30,65.3 1 1 -github.com/echovault/echovault/internal/aof/engine.go:68.58,69.30 1 1 -github.com/echovault/echovault/internal/aof/engine.go:69.30,71.3 1 1 -github.com/echovault/echovault/internal/aof/engine.go:74.59,75.30 1 1 -github.com/echovault/echovault/internal/aof/engine.go:75.30,77.3 1 1 -github.com/echovault/echovault/internal/aof/engine.go:80.82,81.30 1 1 -github.com/echovault/echovault/internal/aof/engine.go:81.30,83.3 1 1 -github.com/echovault/echovault/internal/aof/engine.go:86.89,87.30 1 1 -github.com/echovault/echovault/internal/aof/engine.go:87.30,89.3 1 1 -github.com/echovault/echovault/internal/aof/engine.go:92.73,93.30 1 1 -github.com/echovault/echovault/internal/aof/engine.go:93.30,95.3 1 1 -github.com/echovault/echovault/internal/aof/engine.go:98.82,99.30 1 1 -github.com/echovault/echovault/internal/aof/engine.go:99.30,101.3 1 1 -github.com/echovault/echovault/internal/aof/engine.go:104.78,105.30 1 1 -github.com/echovault/echovault/internal/aof/engine.go:105.30,107.3 1 1 -github.com/echovault/echovault/internal/aof/engine.go:110.69,118.29 1 1 -github.com/echovault/echovault/internal/aof/engine.go:118.30,118.31 0 0 -github.com/echovault/echovault/internal/aof/engine.go:119.30,119.31 0 0 -github.com/echovault/echovault/internal/aof/engine.go:120.57,120.71 1 0 -github.com/echovault/echovault/internal/aof/engine.go:121.63,121.64 0 0 -github.com/echovault/echovault/internal/aof/engine.go:122.44,122.45 0 0 -github.com/echovault/echovault/internal/aof/engine.go:127.2,127.33 1 1 -github.com/echovault/echovault/internal/aof/engine.go:127.33,129.3 1 1 -github.com/echovault/echovault/internal/aof/engine.go:132.2,139.16 2 1 -github.com/echovault/echovault/internal/aof/engine.go:139.16,141.3 1 0 -github.com/echovault/echovault/internal/aof/engine.go:142.2,152.16 3 1 -github.com/echovault/echovault/internal/aof/engine.go:152.16,154.3 1 0 -github.com/echovault/echovault/internal/aof/engine.go:155.2,159.12 2 1 -github.com/echovault/echovault/internal/aof/engine.go:159.12,160.7 1 1 -github.com/echovault/echovault/internal/aof/engine.go:160.7,162.54 2 1 -github.com/echovault/echovault/internal/aof/engine.go:162.54,164.5 1 0 -github.com/echovault/echovault/internal/aof/engine.go:168.2,168.20 1 1 -github.com/echovault/echovault/internal/aof/engine.go:171.52,173.2 1 1 -github.com/echovault/echovault/internal/aof/engine.go:175.42,183.62 5 1 -github.com/echovault/echovault/internal/aof/engine.go:183.62,185.3 1 0 -github.com/echovault/echovault/internal/aof/engine.go:188.2,188.54 1 1 -github.com/echovault/echovault/internal/aof/engine.go:188.54,190.3 1 0 -github.com/echovault/echovault/internal/aof/engine.go:192.2,192.12 1 1 -github.com/echovault/echovault/internal/aof/engine.go:195.39,196.55 1 1 -github.com/echovault/echovault/internal/aof/engine.go:196.55,198.3 1 0 -github.com/echovault/echovault/internal/aof/engine.go:199.2,199.53 1 1 -github.com/echovault/echovault/internal/aof/engine.go:199.53,201.3 1 0 -github.com/echovault/echovault/internal/aof/engine.go:202.2,202.12 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 -github.com/echovault/echovault/internal/eviction/lfu.go:50.54,52.3 1 1 -github.com/echovault/echovault/internal/eviction/lfu.go:54.2,54.56 1 1 -github.com/echovault/echovault/internal/eviction/lfu.go:57.39,61.2 3 1 -github.com/echovault/echovault/internal/eviction/lfu.go:63.38,72.2 3 1 -github.com/echovault/echovault/internal/eviction/lfu.go:74.34,83.2 8 1 -github.com/echovault/echovault/internal/eviction/lfu.go:85.43,87.26 1 1 -github.com/echovault/echovault/internal/eviction/lfu.go:87.26,90.3 2 1 -github.com/echovault/echovault/internal/eviction/lfu.go:92.2,92.69 1 1 -github.com/echovault/echovault/internal/eviction/lfu.go:92.69,94.3 1 1 -github.com/echovault/echovault/internal/eviction/lfu.go:95.2,97.27 3 1 -github.com/echovault/echovault/internal/eviction/lfu.go:100.43,101.73 1 0 -github.com/echovault/echovault/internal/eviction/lfu.go:101.73,103.3 1 0 -github.com/echovault/echovault/internal/eviction/lfu.go:104.2,104.19 1 0 -github.com/echovault/echovault/internal/eviction/lfu.go:104.19,106.3 1 0 -github.com/echovault/echovault/internal/eviction/lfu.go:109.50,112.2 2 1 -github.com/echovault/echovault/internal/eviction/lru.go:34.29,41.2 3 1 -github.com/echovault/echovault/internal/eviction/lru.go:43.34,45.2 1 1 -github.com/echovault/echovault/internal/eviction/lru.go:47.44,49.2 1 1 -github.com/echovault/echovault/internal/eviction/lru.go:51.39,55.2 3 1 -github.com/echovault/echovault/internal/eviction/lru.go:57.38,64.2 2 1 -github.com/echovault/echovault/internal/eviction/lru.go:66.34,75.2 8 1 -github.com/echovault/echovault/internal/eviction/lru.go:77.43,79.26 1 1 -github.com/echovault/echovault/internal/eviction/lru.go:79.26,81.3 1 1 -github.com/echovault/echovault/internal/eviction/lru.go:83.2,83.69 1 1 -github.com/echovault/echovault/internal/eviction/lru.go:83.69,85.3 1 1 -github.com/echovault/echovault/internal/eviction/lru.go:86.2,88.27 3 1 -github.com/echovault/echovault/internal/eviction/lru.go:91.43,92.73 1 0 -github.com/echovault/echovault/internal/eviction/lru.go:92.73,94.3 1 0 -github.com/echovault/echovault/internal/eviction/lru.go:95.2,95.19 1 0 -github.com/echovault/echovault/internal/eviction/lru.go:95.19,97.3 1 0 -github.com/echovault/echovault/internal/eviction/lru.go:100.50,103.2 2 1 github.com/echovault/echovault/internal/modules/acl/acl.go:52.40,57.24 3 1 github.com/echovault/echovault/internal/modules/acl/acl.go:57.24,65.3 2 1 github.com/echovault/echovault/internal/modules/acl/acl.go:68.2,68.28 1 1 @@ -1639,6 +1643,99 @@ 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 @@ -4038,96 +4135,3 @@ github.com/echovault/echovault/internal/snapshot/snapshot.go:354.94,356.3 1 1 github.com/echovault/echovault/internal/snapshot/snapshot.go:358.2,360.12 2 1 github.com/echovault/echovault/internal/snapshot/snapshot.go:363.46,365.2 1 0 github.com/echovault/echovault/internal/snapshot/snapshot.go:367.42,369.2 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 diff --git a/echovault/api_admin_test.go b/echovault/api_admin_test.go index ff3c0e29..6432781c 100644 --- a/echovault/api_admin_test.go +++ b/echovault/api_admin_test.go @@ -20,6 +20,9 @@ import ( "fmt" "github.com/echovault/echovault/internal/constants" "github.com/tidwall/resp" + "os" + "path" + "slices" "strconv" "testing" ) @@ -295,3 +298,58 @@ func TestEchoVault_RemoveCommand(t *testing.T) { }) } } + +func TestEchoVault_Plugins(t *testing.T) { + t.Cleanup(func() { + _ = os.RemoveAll("./testdata") + }) + + server := createEchoVault() + + moduleSet := path.Join(".", "testdata", "modules", "module_set", "module_set.so") + moduleGet := path.Join(".", "testdata", "modules", "module_get", "module_get.so") + nonExistent := path.Join(".", "testdata", "modules", "non_existent", "module_non_existent.so") + + // Load module.set module + if err := server.LoadModule(moduleSet); err != nil { + t.Error(err) + } + + // Load module.get module with args + if err := server.LoadModule(moduleGet, "10"); err != nil { + t.Error(err) + } + + // Return error when trying to load module that does not exist + if err := server.LoadModule(nonExistent); err == nil { + t.Error("expected error but got nil instead") + } else { + if err.Error() != fmt.Sprintf("load module: module %s not found", nonExistent) { + t.Errorf( + "expected error \"%s\", got \"%s\"", + fmt.Sprintf("load module: module %s not found", nonExistent), + err.Error(), + ) + } + } + + // Module list should contain module_get and module_set modules + modules := server.ListModules() + for _, mod := range []string{moduleSet, moduleGet} { + if !slices.Contains(modules, mod) { + t.Errorf("expected modules list to contain module \"%s\" but did not find it", mod) + } + } + + // Unload modules + server.UnloadModule(moduleSet) + server.UnloadModule(moduleGet) + + // Make sure the modules are no longer loaded + modules = server.ListModules() + for _, mod := range []string{moduleSet, moduleGet} { + if slices.Contains(modules, mod) { + t.Errorf("expected modules list to not contain module \"%s\" but found it", mod) + } + } +} diff --git a/echovault/plugin.go b/echovault/plugin.go index c3a070b1..dd883d60 100644 --- a/echovault/plugin.go +++ b/echovault/plugin.go @@ -19,6 +19,8 @@ import ( "errors" "fmt" "github.com/echovault/echovault/internal" + "io/fs" + "os" "plugin" "slices" "strings" @@ -36,6 +38,13 @@ func (server *EchoVault) LoadModule(path string, args ...string) error { server.commandsRWMut.Lock() defer server.commandsRWMut.Unlock() + if _, err := os.Stat(path); err != nil { + if errors.Is(err, fs.ErrNotExist) { + return fmt.Errorf("load module: module %s not found", path) + } + return fmt.Errorf("load module: %v", err) + } + p, err := plugin.Open(path) if err != nil { return fmt.Errorf("plugin open: %v", err) From 1981fe9d1d74458f4056bdcf7c2f790a971e6600 Mon Sep 17 00:00:00 2001 From: Kelvin Clement Mwinuka Date: Thu, 9 May 2024 02:06:31 +0800 Subject: [PATCH 2/2] Added unit tests for COMMAND COUNT and COMMAND LIST commands in admin module --- coverage/coverage.out | 296 ++++++++++++------------ internal/modules/admin/commands_test.go | 179 ++++++++++++++ 2 files changed, 327 insertions(+), 148 deletions(-) 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()