(t *testing.T)
| 83 | } |
| 84 | |
| 85 | func TestMemcachedClient_Add(t *testing.T) { |
| 86 | t.Run("item does not exist", func(t *testing.T) { |
| 87 | ctx := context.Background() |
| 88 | client, _, err := setupDefaultMemcachedClient() |
| 89 | require.NoError(t, err) |
| 90 | require.NoError(t, client.Add(ctx, "foo", []byte("bar"), time.Minute)) |
| 91 | }) |
| 92 | |
| 93 | t.Run("item already exists", func(t *testing.T) { |
| 94 | ctx := context.Background() |
| 95 | client, mock, err := setupDefaultMemcachedClient() |
| 96 | require.NoError(t, err) |
| 97 | |
| 98 | require.NoError(t, mock.Set(&memcache.Item{ |
| 99 | Key: "foo", |
| 100 | Value: []byte("baz"), |
| 101 | Expiration: 60, |
| 102 | })) |
| 103 | |
| 104 | err = client.Add(ctx, "foo", []byte("bar"), time.Minute) |
| 105 | require.ErrorIs(t, err, ErrNotStored) |
| 106 | }) |
| 107 | } |
| 108 | |
| 109 | func TestMemcachedClient_GetMulti(t *testing.T) { |
| 110 | t.Run("no allocator", func(t *testing.T) { |
nothing calls this directly
no test coverage detected