MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestStat_EncodeValueKey

Function TestStat_EncodeValueKey

internal/metrics/stat_test.go:11–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestStat_EncodeValueKey(t *testing.T) {
12 var a = assert.NewAssertion(t)
13
14 var stat = &metrics.Stat{
15 ServerId: 1,
16 Keys: []string{"${remoteAddr}"},
17 Hash: "123456",
18 Value: 123,
19 Time: "20240101",
20 }
21
22 var valueKey = stat.EncodeValueKey(100)
23 t.Log(valueKey)
24
25 serverId, timeString, version, value, hash, err := metrics.DecodeValueKey(valueKey)
26 if err != nil {
27 t.Fatal(err)
28 }
29 t.Log(serverId, timeString, value, version, hash)
30 a.IsTrue(serverId == 1)
31 a.IsTrue(timeString == "20240101")
32 a.IsTrue(value == 123)
33 a.IsTrue(version == 100)
34 a.IsTrue(hash == "123456")
35}
36
37func TestStat_EncodeSumKey(t *testing.T) {
38 var a = assert.NewAssertion(t)

Callers

nothing calls this directly

Calls 3

DecodeValueKeyFunction · 0.92
EncodeValueKeyMethod · 0.80
LogMethod · 0.80

Tested by

no test coverage detected