Skip to content

Commit

Permalink
cleanup redis7.4 stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver006 committed Oct 6, 2024
1 parent f24e6c1 commit 49c8302
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 105 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ test:
TEST_REDIS_URI="redis://localhost:16385" \
TEST_REDIS5_URI="redis://localhost:16383" \
TEST_REDIS6_URI="redis://localhost:16379" \
TEST_REDIS74_URI="redis://localhost:16385" \
TEST_VALKEY7_URI="redis://localhost:16384" \
TEST_VALKEY8_URI="redis://localhost:16382" \
TEST_REDIS_2_8_URI="redis://localhost:16381" \
Expand Down
20 changes: 10 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,62 @@ services:

redis74:
image: redis:7.4
command: "redis-server --enable-debug-command yes --protected-mode no --dbfilename dump74.rdb"
command: "redis-server --enable-debug-command yes --protected-mode no"
ports:
- "16385:6379"
- "6379:6379"

valkey8:
image: valkey/valkey:8
command: "redis-server --enable-debug-command yes --protected-mode no --dbfilename dump7.rdb"
command: "valkey-server --enable-debug-command yes --protected-mode no"
ports:
- "16382:6379"

valkey7:
image: valkey/valkey:7.2
command: "redis-server --enable-debug-command yes --protected-mode no --dbfilename dump7.rdb"
command: "valkey-server --enable-debug-command yes --protected-mode no"
ports:
- "16384:6379"

redis6:
image: redis:6.2
command: "redis-server --protected-mode no --dbfilename dump6.rdb"
command: "redis-server --protected-mode no"
ports:
- "16379:6379"

redis5:
image: redis:5
command: "redis-server --dbfilename dump5.rdb"
command: "redis-server"
ports:
- "16383:6379"

pwd-redis5:
image: redis:5
command: "redis-server --requirepass redis-password --dbfilename dump5-pwd.rdb"
command: "redis-server --requirepass redis-password"
ports:
- "16380:6379"

pwd-redis6:
image: redis:6
command: "redis-server --requirepass dummy --user exporter on +CLIENT +INFO +SELECT +SLOWLOG +LATENCY '>exporter-password' --dbfilename dump6-pwd.rdb"
command: "redis-server --requirepass dummy --user exporter on +CLIENT +INFO +SELECT +SLOWLOG +LATENCY '>exporter-password'"
ports:
- "16390:6379"

redis-2-8:
image: redis:2.8
command: "redis-server --dbfilename dump2-8.rdb"
command: "redis-server"
ports:
- "16381:6379"

keydb-01:
image: "eqalpha/keydb:x86_64_v6.3.1"
command: "keydb-server --protected-mode no --dbfilename dump-keydb-01.rdb"
command: "keydb-server --protected-mode no"
ports:
- "16401:6379"

keydb-02:
image: "eqalpha/keydb:x86_64_v6.3.1"
command: "keydb-server --protected-mode no --active-replica yes --replicaof keydb-01 6379 --dbfilename dump-keydb-02.rdb"
command: "keydb-server --protected-mode no --active-replica yes --replicaof keydb-01 6379"
ports:
- "16402:6379"

Expand Down
108 changes: 14 additions & 94 deletions exporter/clients_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package exporter

import (
"os"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -159,29 +158,20 @@ func TestExportClientList(t *testing.T) {
in string
found bool
}{
{
in: "connected_client_info",
}, {
in: "connected_client_output_buffer_memory_usage_bytes",
}, {
in: "connected_client_total_memory_consumed_bytes",
}, {
in: "connected_client_created_at_timestamp",
}, {
in: "connected_client_idle_since_timestamp",
}, {
in: "connected_client_channel_subscriptions_count",
}, {
in: "connected_client_pattern_matching_subscriptions_count",
}, {
in: "connected_client_query_buffer_length_bytes",
}, {
in: "connected_client_query_buffer_free_space_bytes",
}, {
in: "connected_client_output_buffer_length_bytes",
}, {
in: "connected_client_output_list_length",
},
{in: "connected_client_info"},
{in: "connected_client_output_buffer_memory_usage_bytes"},
{in: "connected_client_total_memory_consumed_bytes"},
{in: "connected_client_created_at_timestamp"},
{in: "connected_client_idle_since_timestamp"},
{in: "connected_client_channel_subscriptions_count"},
{in: "connected_client_pattern_matching_subscriptions_count"},
{in: "connected_client_query_buffer_length_bytes"},
{in: "connected_client_query_buffer_free_space_bytes"},
{in: "connected_client_output_buffer_length_bytes"},
{in: "connected_client_output_list_length"},
{in: "connected_client_shard_channel_subscriptions_count"},
{in: "connected_client_shard_channel_watched_keys"},
{in: "connected_client_info"},
}
for m := range chM {
desc := m.Desc().String()
Expand Down Expand Up @@ -233,73 +223,3 @@ func TestExportClientListInclPort(t *testing.T) {
}
}
}

func TestExportClientListRedis7(t *testing.T) {
redisSevenAddr := os.Getenv("TEST_REDIS74_URI")
if redisSevenAddr == "" {
t.Skipf("Skipping TestExportClientListRedis7, missing env var TEST_REDIS74_URI")
}
e := getTestExporterWithAddrAndOptions(redisSevenAddr, Options{
Namespace: "test", Registry: prometheus.NewRegistry(),
ExportClientList: true,
})

chM := make(chan prometheus.Metric)
go func() {
e.Collect(chM)
close(chM)
}()

tsts := []struct {
in string
found bool
}{
{
in: "connected_client_shard_channel_subscriptions_count",
}, {
in: "connected_client_shard_channel_watched_keys",
},
}
for m := range chM {
desc := m.Desc().String()
for i := range tsts {
if strings.Contains(desc, tsts[i].in) {
tsts[i].found = true
}
}
}

for _, tst := range tsts {
if !tst.found {
t.Errorf(`%s was *not* found in isExportClientList metrics but expected`, tst.in)
}
}
}

func TestExportClientListResp(t *testing.T) {
redisSevenAddr := os.Getenv("TEST_VALKEY7_URI")
e := getTestExporterWithAddrAndOptions(redisSevenAddr, Options{
Namespace: "test", Registry: prometheus.NewRegistry(),
ExportClientList: true,
})

chM := make(chan prometheus.Metric)
go func() {
e.Collect(chM)
close(chM)
}()

found := false
for m := range chM {
desc := m.Desc().String()
if strings.Contains(desc, "connected_client_info") {
if strings.Contains(desc, "resp") {
found = true
}
}
}

if !found {
t.Errorf(`connected_client_info did *not* include "resp" in isExportClientList metrics but was expected`)
}
}

0 comments on commit 49c8302

Please sign in to comment.