(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func TestKVList(t *testing.T) { |
| 27 | testKVs(t, func(t *testing.T, client kv.Client, reg *prometheus.Registry) { |
| 28 | // Create keys to list back |
| 29 | keysToCreate := []string{"key-a", "key-b", "key-c"} |
| 30 | for _, key := range keysToCreate { |
| 31 | err := client.CAS(context.Background(), key, func(in interface{}) (out interface{}, retry bool, err error) { |
| 32 | return key, false, nil |
| 33 | }) |
| 34 | require.NoError(t, err, "could not create key") |
| 35 | } |
| 36 | |
| 37 | // Get list of keys and sort them |
| 38 | keys, err := client.List(context.Background(), "") |
| 39 | require.NoError(t, err, "could not list keys") |
| 40 | sort.Strings(keys) |
| 41 | require.Equal(t, keysToCreate, keys, "returned key paths did not match created paths") |
| 42 | |
| 43 | verifyClientMetricsHistogram(t, reg, "cortex_kv_request_duration_seconds", map[string]uint64{ |
| 44 | "List": 1, |
| 45 | "CAS": 3, |
| 46 | }) |
| 47 | }) |
| 48 | } |
| 49 | |
| 50 | func TestKVDelete(t *testing.T) { |
| 51 | testKVs(t, func(t *testing.T, client kv.Client, reg *prometheus.Registry) { |
nothing calls this directly
no test coverage detected