TestLoaderMismatchInCV: - Get doc that is not in cache by CV to trigger a load from bucket - Ensure the CV passed into the GET operation won't match the doc in the bucket - Assert we get error and the value is not loaded into the cache
(t *testing.T)
| 1912 | // - Ensure the CV passed into the GET operation won't match the doc in the bucket |
| 1913 | // - Assert we get error and the value is not loaded into the cache |
| 1914 | func TestLoaderMismatchInCV(t *testing.T) { |
| 1915 | cacheHitCounter, cacheMissCounter, cacheNumItems, memoryBytesCounted, getDocumentCounter, getRevisionCounter := base.SgwIntStat{}, base.SgwIntStat{}, base.SgwIntStat{}, base.SgwIntStat{}, base.SgwIntStat{}, base.SgwIntStat{} |
| 1916 | cacheOptions := &RevisionCacheOptions{ |
| 1917 | MaxItemCount: 10, |
| 1918 | MaxBytes: 0, |
| 1919 | } |
| 1920 | cache := NewLRURevisionCache(cacheOptions, CreateTestSingleBackingStoreMap(&testBackingStore{[]string{"test_doc"}, &getDocumentCounter, &getRevisionCounter}, testCollectionID), &cacheHitCounter, &cacheMissCounter, &cacheNumItems, &memoryBytesCounted) |
| 1921 | |
| 1922 | // create cv with incorrect version to the one stored in backing store |
| 1923 | cv := Version{SourceID: "test", Value: 1234} |
| 1924 | |
| 1925 | _, err := cache.GetWithCV(base.TestCtx(t), "doc1", &cv, testCollectionID, RevCacheOmitDelta, false) |
| 1926 | require.Error(t, err) |
| 1927 | require.Error(t, err, base.ErrNotFound) |
| 1928 | assert.Equal(t, int64(0), cacheHitCounter.Value()) |
| 1929 | assert.Equal(t, int64(1), cacheMissCounter.Value()) |
| 1930 | assert.Equal(t, 0, cache.lruList.Len()) |
| 1931 | assert.Equal(t, 0, len(cache.hlvCache)) |
| 1932 | assert.Equal(t, 0, len(cache.cache)) |
| 1933 | } |
| 1934 | |
| 1935 | // TestConcurrentLoadByCVAndRevOnCache: |
| 1936 | // - Create cache |
nothing calls this directly
no test coverage detected