From 11f6e78a74d353b351d0e69e4d1f5c1d9c0f04b0 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 28 Oct 2024 20:09:07 -0700 Subject: [PATCH] TestKeyspaceStringParser --- exporter/info_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/exporter/info_test.go b/exporter/info_test.go index 4654276c..35c8af0a 100644 --- a/exporter/info_test.go +++ b/exporter/info_test.go @@ -35,8 +35,15 @@ func TestKeyspaceStringParser(t *testing.T) { {db: "db0", stats: "keys=1,expires=0,avg_ttl=0", keysTotal: 1, keysEx: 0, avgTTL: 0, keysCached: -1, ok: true}, {db: "db0", stats: "keys=1,expires=0,avg_ttl=0,cached_keys=0", keysTotal: 1, keysEx: 0, avgTTL: 0, keysCached: 0, ok: true}, + + { + db: "db0", stats: "keys=25714011,expires=25091314,avg_ttl=685620459,subexpiry=0", + keysTotal: 25714011, keysEx: 25091314, keysCached: 0, avgTTL: 685620.459000, + ok: true, + }, } + log.SetLevel(log.DebugLevel) for _, tst := range tsts { if kt, kx, ttl, kc, ok := parseDBKeyspaceString(tst.db, tst.stats); true { @@ -46,7 +53,12 @@ func TestKeyspaceStringParser(t *testing.T) { } if ok && (kt != tst.keysTotal || kx != tst.keysEx || kc != tst.keysCached || ttl != tst.avgTTL) { - t.Errorf("values not matching, db:%s stats:%s %f %f %f %f", tst.db, tst.stats, kt, kx, kc, ttl) + t.Errorf("values not matching, db:%s stats:%s %f != %f %f != %f %f != %f %f != %f", + tst.db, tst.stats, + kt, tst.keysTotal, + kx, tst.keysEx, + kc, tst.keysCached, + ttl, tst.avgTTL) } } }