MCPcopy Create free account
hub / github.com/allegro/bigcache / TestGetKey

Function TestGetKey

server/server_test.go:63–82  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

61}
62
63func TestGetKey(t *testing.T) {
64 t.Parallel()
65 req := httptest.NewRequest("GET", testBaseString+"/api/v1/cache/getKey", nil)
66 rr := httptest.NewRecorder()
67
68 // set something.
69 cache.Set("getKey", []byte("123"))
70
71 getCacheHandler(rr, req)
72 resp := rr.Result()
73
74 body, err := ioutil.ReadAll(resp.Body)
75 if err != nil {
76 t.Errorf("cannot deserialise test response: %s", err)
77 }
78
79 if string(body) != "123" {
80 t.Errorf("want: 123; got: %s.\n\tcan't get existing key getKey.", string(body))
81 }
82}
83
84func TestPutKey(t *testing.T) {
85 t.Parallel()

Callers

nothing calls this directly

Calls 2

getCacheHandlerFunction · 0.85
SetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…