mirror of https://github.com/velour/catbase.git
countdown: HA figured the race out
This commit is contained in:
parent
3cbbc4a08a
commit
4e16c8f464
|
@ -21,10 +21,14 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func setup() (*bot.MockBot, *CountdownPlugin, func()) {
|
func setup() (*bot.MockBot, *CountdownPlugin, func()) {
|
||||||
|
// ensure the scheduled NYE doesn't happen and cause a race
|
||||||
|
nextYear = time.Now().Add(24 * 365 * time.Hour)
|
||||||
mb := bot.NewMockBot()
|
mb := bot.NewMockBot()
|
||||||
cd := New(mb)
|
cd := New(mb)
|
||||||
return mb, cd, func() {
|
return mb, cd, func() {
|
||||||
mb.TearDown()
|
if err := mb.TearDown(); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,16 +93,16 @@ func TestArchiveCounters(t *testing.T) {
|
||||||
}
|
}
|
||||||
count, err := mb.Store().Count(counter.Item{}, &bh.Query{})
|
count, err := mb.Store().Count(counter.Item{}, &bh.Query{})
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, count, 3)
|
assert.Equal(t, 3, count)
|
||||||
|
|
||||||
err = cd.archiveCounters()
|
err = cd.archiveCounters()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
count, err = mb.Store().Count(counter.Item{}, &bh.Query{})
|
count, err = mb.Store().Count(counter.Item{}, &bh.Query{})
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, count, 0)
|
assert.Equal(t, 0, count)
|
||||||
|
|
||||||
count, err = mb.Store().Count(counterArchive{}, &bh.Query{})
|
count, err = mb.Store().Count(counterArchive{}, &bh.Query{})
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, count, 3)
|
assert.Equal(t, 3, count)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue