MCPcopy Index your code
hub / github.com/go-dev-frame/sponge / Test_userExampleCache_MultiGet

Function Test_userExampleCache_MultiGet

internal/cache/userExample_test.go:70–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68}
69
70func Test_userExampleCache_MultiGet(t *testing.T) {
71 c := newUserExampleCache()
72 defer c.Close()
73
74 var testData []*model.UserExample
75 for _, data := range c.TestDataSlice {
76 testData = append(testData, data.(*model.UserExample))
77 }
78
79 err := c.ICache.(UserExampleCache).MultiSet(c.Ctx, testData, time.Hour)
80 if err != nil {
81 t.Fatal(err)
82 }
83
84 got, err := c.ICache.(UserExampleCache).MultiGet(c.Ctx, c.GetIDs())
85 if err != nil {
86 t.Fatal(err)
87 }
88
89 expected := c.GetTestData()
90 for k, v := range expected {
91 assert.Equal(t, got[utils.StrToUint64(k)], v.(*model.UserExample))
92 }
93}
94
95func Test_userExampleCache_MultiSet(t *testing.T) {
96 c := newUserExampleCache()

Callers

nothing calls this directly

Calls 8

StrToUint64Function · 0.92
newUserExampleCacheFunction · 0.85
CloseMethod · 0.65
MultiSetMethod · 0.65
MultiGetMethod · 0.65
FatalMethod · 0.45
GetIDsMethod · 0.45
GetTestDataMethod · 0.45

Tested by

no test coverage detected