style: extract the remaining eviction test variant keys as constants (goconst)
This commit is contained in:
@@ -20,12 +20,14 @@ import (
|
|||||||
// implementation writes.
|
// implementation writes.
|
||||||
const sqliteTimestampFormat = "2006-01-02 15:04:05"
|
const sqliteTimestampFormat = "2006-01-02 15:04:05"
|
||||||
|
|
||||||
// testVariantKeyOne and testVariantKeyTwo are the variant cache keys
|
// testVariantKeyOne through testVariantKeyFour are the variant cache
|
||||||
// reused across the eviction tests as the first and second stored
|
// keys reused across the eviction tests, in the order the tests store
|
||||||
// variants.
|
// them.
|
||||||
const (
|
const (
|
||||||
testVariantKeyOne VariantKey = "aabbccdd0001"
|
testVariantKeyOne VariantKey = "aabbccdd0001"
|
||||||
testVariantKeyTwo VariantKey = "aabbccdd0002"
|
testVariantKeyTwo VariantKey = "aabbccdd0002"
|
||||||
|
testVariantKeyThree VariantKey = "aabbccdd0003"
|
||||||
|
testVariantKeyFour VariantKey = "aabbccdd0004"
|
||||||
)
|
)
|
||||||
|
|
||||||
// evictionTestDB creates an in-memory SQLite database with the real
|
// evictionTestDB creates an in-memory SQLite database with the real
|
||||||
@@ -340,7 +342,8 @@ func TestEvictToLimitEvictsLeastRecentlyUsedFirst(t *testing.T) {
|
|||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
keys := []VariantKey{
|
keys := []VariantKey{
|
||||||
testVariantKeyOne, testVariantKeyTwo, "aabbccdd0003", "aabbccdd0004",
|
testVariantKeyOne, testVariantKeyTwo,
|
||||||
|
testVariantKeyThree, testVariantKeyFour,
|
||||||
}
|
}
|
||||||
fills := []byte{0x01, 0x02, 0x03, 0x04}
|
fills := []byte{0x01, 0x02, 0x03, 0x04}
|
||||||
ages := []time.Duration{4 * time.Hour, 3 * time.Hour, 2 * time.Hour, 1 * time.Hour}
|
ages := []time.Duration{4 * time.Hour, 3 * time.Hour, 2 * time.Hour, 1 * time.Hour}
|
||||||
@@ -656,7 +659,9 @@ func TestEvictionRunsUnderWritePressure(t *testing.T) {
|
|||||||
cache.StartEviction(time.Hour)
|
cache.StartEviction(time.Hour)
|
||||||
defer cache.StopEviction()
|
defer cache.StopEviction()
|
||||||
|
|
||||||
keys := []VariantKey{testVariantKeyOne, testVariantKeyTwo, "aabbccdd0003"}
|
keys := []VariantKey{
|
||||||
|
testVariantKeyOne, testVariantKeyTwo, testVariantKeyThree,
|
||||||
|
}
|
||||||
fills := []byte{0x11, 0x12, 0x13}
|
fills := []byte{0x11, 0x12, 0x13}
|
||||||
|
|
||||||
for i, key := range keys {
|
for i, key := range keys {
|
||||||
@@ -687,7 +692,9 @@ func TestEvictionRunsOnPeriodicSchedule(t *testing.T) {
|
|||||||
cache.StartEviction(100 * time.Millisecond)
|
cache.StartEviction(100 * time.Millisecond)
|
||||||
defer cache.StopEviction()
|
defer cache.StopEviction()
|
||||||
|
|
||||||
keys := []VariantKey{testVariantKeyOne, testVariantKeyTwo, "aabbccdd0003"}
|
keys := []VariantKey{
|
||||||
|
testVariantKeyOne, testVariantKeyTwo, testVariantKeyThree,
|
||||||
|
}
|
||||||
fills := []byte{0x21, 0x22, 0x23}
|
fills := []byte{0x21, 0x22, 0x23}
|
||||||
|
|
||||||
for i, key := range keys {
|
for i, key := range keys {
|
||||||
|
|||||||
Reference in New Issue
Block a user