@@ -21,13 +21,16 @@ import (
2121)
2222
2323const (
24- testCacheName = "test"
24+ testCacheName = "test"
25+ testCacheShardings = 16
2526)
2627
2728func newTestReportableCache () (* reportableCache , * Reporter ) {
2829 conf := newDefaultConfig ()
2930 conf .cacheName = testCacheName
31+ conf .shardings = testCacheShardings
3032 conf .maxEntries = maxTestEntries
33+
3134 cache , reporter := report (conf , newStandardCache (conf ))
3235 return cache .(* reportableCache ), reporter
3336}
@@ -203,11 +206,27 @@ func TestReportableCacheReportLoad(t *testing.T) {
203206// go test -v -cover -run=^TestReporterCacheName$
204207func TestReporterCacheName (t * testing.T ) {
205208 _ , reporter := newTestReportableCache ()
209+ if reporter .CacheName () != reporter .conf .cacheName {
210+ t .Errorf ("CacheName %s is wrong compared with conf" , reporter .CacheName ())
211+ }
212+
206213 if reporter .CacheName () != testCacheName {
207214 t .Errorf ("CacheName %s is wrong" , reporter .CacheName ())
208215 }
209216}
210217
218+ // go test -v -cover -run=^TestReporterCacheShardings$
219+ func TestReporterCacheShardings (t * testing.T ) {
220+ _ , reporter := newTestReportableCache ()
221+ if reporter .CacheShardings () != reporter .conf .shardings {
222+ t .Errorf ("CacheShardings %d is wrong compared with conf" , reporter .CacheShardings ())
223+ }
224+
225+ if reporter .CacheShardings () != testCacheShardings {
226+ t .Errorf ("CacheShardings %d is wrong" , reporter .CacheShardings ())
227+ }
228+ }
229+
211230// go test -v -cover -run=^TestReporterCacheSize$
212231func TestReporterCacheSize (t * testing.T ) {
213232 cache , reporter := newTestReportableCache ()
0 commit comments