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

Function TestStat_EncodeSumKey

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

Source from the content-addressed store, hash-verified

35}
36
37func TestStat_EncodeSumKey(t *testing.T) {
38 var a = assert.NewAssertion(t)
39
40 var stat = &metrics.Stat{
41 ServerId: 1,
42 Keys: []string{"${remoteAddr}"},
43 Hash: "123456",
44 Value: 123,
45 Time: "20240101",
46 }
47 var sumKey = stat.EncodeSumKey(100)
48 t.Log(sumKey)
49
50 serverId, timeString, version, err := metrics.DecodeSumKey(sumKey)
51 if err != nil {
52 t.Fatal(err)
53 }
54 t.Log(serverId, timeString, version)
55 a.IsTrue(serverId == 1)
56 a.IsTrue(timeString == "20240101")
57 a.IsTrue(version == 100)
58}
59
60func TestStat_EncodeSumValue(t *testing.T) {
61 var a = assert.NewAssertion(t)

Callers

nothing calls this directly

Calls 3

DecodeSumKeyFunction · 0.92
EncodeSumKeyMethod · 0.80
LogMethod · 0.80

Tested by

no test coverage detected