MCPcopy
hub / github.com/grafana/dskit / TestList

Function TestList

kv/kv_test.go:266–283  ·  view source on GitHub ↗

TestList makes sure stored keys are listed back.

(t *testing.T)

Source from the content-addressed store, hash-verified

264
265// TestList makes sure stored keys are listed back.
266func TestList(t *testing.T) {
267 keysToCreate := []string{"a", "b", "c"}
268
269 withFixtures(t, func(t *testing.T, client Client) {
270 for _, key := range keysToCreate {
271 err := client.CAS(context.Background(), key, func(interface{}) (out interface{}, retry bool, err error) {
272 return key, false, nil
273 })
274 require.NoError(t, err)
275 }
276
277 storedKeys, err := client.List(context.Background(), "")
278 require.NoError(t, err)
279 sort.Strings(storedKeys)
280
281 require.Equal(t, keysToCreate, storedKeys)
282 })
283}

Callers

nothing calls this directly

Calls 4

withFixturesFunction · 0.70
CASMethod · 0.65
ListMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected