-
Notifications
You must be signed in to change notification settings - Fork 150
/
config_test.go
45 lines (37 loc) · 1.33 KB
/
config_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package pool
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestPoolConfig(t *testing.T) {
t.Parallel()
config := NewDefaultPoolConfig()
if debugTest {
fmt.Println(config)
}
assert.NotNil(t, config)
}
func TestGetEvictionPolicy(t *testing.T) {
t.Parallel()
policy := GetEvictionPolicy(DefaultEvictionPolicyName)
assert.NotNil(t, policy)
}
func TestDefaultConfig(t *testing.T) {
t.Parallel()
config := NewDefaultPoolConfig()
assert.Equal(t, DefaultBlockWhenExhausted, config.BlockWhenExhausted)
assert.Equal(t, DefaultEvictionPolicyName, config.EvictionPolicyName)
assert.Equal(t, DefaultLIFO, config.LIFO)
assert.Equal(t, DefaultMaxIdle, config.MaxIdle)
assert.Equal(t, DefaultMaxTotal, config.MaxTotal)
assert.Equal(t, DefaultMinEvictableIdleTime, config.MinEvictableIdleTime)
assert.Equal(t, DefaultMinIdle, config.MinIdle)
assert.Equal(t, DefaultNumTestsPerEvictionRun, config.NumTestsPerEvictionRun)
assert.Equal(t, DefaultSoftMinEvictableIdleTime, config.SoftMinEvictableIdleTime)
assert.Equal(t, DefaultTestOnBorrow, config.TestOnBorrow)
assert.Equal(t, DefaultTestOnCreate, config.TestOnCreate)
assert.Equal(t, DefaultTestOnReturn, config.TestOnReturn)
assert.Equal(t, DefaultTestWhileIdle, config.TestWhileIdle)
assert.Equal(t, DefaultTimeBetweenEvictionRuns, config.TimeBetweenEvictionRuns)
}