Skip to content

Commit

Permalink
countstore: a bit more mem test coverage (defensive)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnewbold committed Dec 15, 2023
1 parent 90ffed8 commit d349d3e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions automod/countstore/countstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ func TestMemCountStoreBasics(t *testing.T) {
assert.Equal(0, c)
assert.NoError(cs.Increment(ctx, "test1", "val1"))
assert.NoError(cs.Increment(ctx, "test1", "val1"))
c, err = cs.GetCount(ctx, "test1", "val1", PeriodTotal)
assert.NoError(err)
assert.Equal(2, c)

for _, period := range []string{PeriodTotal, PeriodDay, PeriodHour} {
c, err = cs.GetCount(ctx, "test1", "val1", period)
assert.NoError(err)
assert.Equal(2, c)
}

c, err = cs.GetCountDistinct(ctx, "test2", "val2", PeriodTotal)
assert.NoError(err)
Expand All @@ -36,9 +39,12 @@ func TestMemCountStoreBasics(t *testing.T) {

assert.NoError(cs.IncrementDistinct(ctx, "test2", "val2", "two"))
assert.NoError(cs.IncrementDistinct(ctx, "test2", "val2", "three"))
c, err = cs.GetCountDistinct(ctx, "test2", "val2", PeriodTotal)
assert.NoError(err)
assert.Equal(3, c)

for _, period := range []string{PeriodTotal, PeriodDay, PeriodHour} {
c, err = cs.GetCountDistinct(ctx, "test2", "val2", period)
assert.NoError(err)
assert.Equal(3, c)
}
}

func TestMemCountStoreConcurrent(t *testing.T) {
Expand Down

0 comments on commit d349d3e

Please sign in to comment.