(t *testing.T)
| 20 | } |
| 21 | |
| 22 | func TestCacheCaches(t *testing.T) { |
| 23 | expected := &tempopb.SearchTagsResponse{ |
| 24 | TagNames: []string{"foo", "bar"}, |
| 25 | } |
| 26 | |
| 27 | // marshal mesage to bytes |
| 28 | buf := bytes.NewBuffer([]byte{}) |
| 29 | err := (&jsonpb.Marshaler{}).Marshal(buf, expected) |
| 30 | require.NoError(t, err) |
| 31 | |
| 32 | testKey := "key" |
| 33 | testData := buf.Bytes() |
| 34 | |
| 35 | p := test.NewMockProvider() |
| 36 | c := newFrontendCache(p, cache.RoleBloom, log.NewNopLogger()) |
| 37 | require.NotNil(t, c) |
| 38 | |
| 39 | // create response |
| 40 | c.store(context.Background(), testKey, testData) |
| 41 | |
| 42 | actual := &tempopb.SearchTagsResponse{} |
| 43 | buffer := c.fetchBytes(context.Background(), testKey) |
| 44 | err = (&jsonpb.Unmarshaler{AllowUnknownFields: true}).Unmarshal(bytes.NewReader(buffer), actual) |
| 45 | |
| 46 | require.NoError(t, err) |
| 47 | require.Equal(t, expected, actual) |
| 48 | } |
| 49 | |
| 50 | func TestDetermineContentType(t *testing.T) { |
| 51 | // Create and marshal a real protobuf message |
nothing calls this directly
no test coverage detected