diff --git a/src/stats/manager.go b/src/stats/manager.go index 2043a146..a96753b7 100644 --- a/src/stats/manager.go +++ b/src/stats/manager.go @@ -52,9 +52,6 @@ type ShouldRateLimitLegacyStats struct { } // Stats for an individual rate limit config entry. -// todo: Ideally the gostats package fields should be unexported -// the inner value could be interacted with via getters such as rlStats.TotalHits() uint64 -// This ensures that setters such as Inc() and Add() can only be managed by RateLimitStats. type RateLimitStats struct { Key string TotalHits gostats.Counter diff --git a/test/memcached/cache_impl_test.go b/test/memcached/cache_impl_test.go index 0244d3bf..c9173e20 100644 --- a/test/memcached/cache_impl_test.go +++ b/test/memcached/cache_impl_test.go @@ -605,7 +605,7 @@ func TestNewRateLimitCacheImplFromSettingsWhenSrvCannotBeResolved(t *testing.T) s.ExpirationJitterMaxSeconds = 300 s.MemcacheSrv = "_something._tcp.example.invalid" - assert.Panics(func() { memcached.NewRateLimitCacheImplFromSettings(s, timeSource, nil, nil, statsStore) }) + assert.Panics(func() { memcached.NewRateLimitCacheImplFromSettings(s, timeSource, nil, nil, statsStore, mockstats.NewMockStatManager(statsStore)) }) } func TestNewRateLimitCacheImplFromSettingsWhenHostAndPortAndSrvAreBothSet(t *testing.T) { @@ -623,7 +623,7 @@ func TestNewRateLimitCacheImplFromSettingsWhenHostAndPortAndSrvAreBothSet(t *tes s.MemcacheSrv = "_something._tcp.example.invalid" s.MemcacheHostPort = []string{"example.org:11211"} - assert.Panics(func() { memcached.NewRateLimitCacheImplFromSettings(s, timeSource, nil, nil, statsStore) }) + assert.Panics(func() { memcached.NewRateLimitCacheImplFromSettings(s, timeSource, nil, nil, statsStore, mockstats.NewMockStatManager(statsStore)) }) } func getMultiResult(vals map[string]int) map[string]*memcache.Item { diff --git a/test/mocks/stats/manager.go b/test/mocks/stats/manager.go index f4d5e9ee..52282e72 100644 --- a/test/mocks/stats/manager.go +++ b/test/mocks/stats/manager.go @@ -39,7 +39,6 @@ func (m *MockStatManager) NewShouldRateLimitLegacyStats() stats.ShouldRateLimitL } } -//todo: review mock implementation func (m *MockStatManager) NewStats(key string) stats.RateLimitStats { ret := stats.RateLimitStats{} logger.Debugf("outputing test gostats %s", key)