MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestKVDelete

Function TestKVDelete

integration/kv_test.go:50–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestKVDelete(t *testing.T) {
51 testKVs(t, func(t *testing.T, client kv.Client, reg *prometheus.Registry) {
52 // Create a key
53 err := client.CAS(context.Background(), "key-to-delete", func(in interface{}) (out interface{}, retry bool, err error) {
54 return "key-to-delete", false, nil
55 })
56 require.NoError(t, err, "object could not be created")
57
58 // Now delete it
59 err = client.Delete(context.Background(), "key-to-delete")
60 require.NoError(t, err)
61
62 // Get it back
63 v, err := client.Get(context.Background(), "key-to-delete")
64 require.NoError(t, err, "unexpected error")
65 require.Nil(t, v, "object was not deleted")
66
67 verifyClientMetricsHistogram(t, reg, "cortex_kv_request_duration_seconds", map[string]uint64{
68 "Delete": 1,
69 "CAS": 1,
70 "GET": 1,
71 })
72 })
73}
74
75func TestKVWatchAndDelete(t *testing.T) {
76 testKVs(t, func(t *testing.T, client kv.Client, reg *prometheus.Registry) {

Callers

nothing calls this directly

Calls 5

testKVsFunction · 0.85
CASMethod · 0.65
DeleteMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected