Fix: fake pool test

This commit is contained in:
gVisor bot 2019-12-28 00:19:40 +08:00
parent 7c17184745
commit 7fd4645237

View file

@ -9,7 +9,7 @@ import (
func TestPool_Basic(t *testing.T) { func TestPool_Basic(t *testing.T) {
_, ipnet, _ := net.ParseCIDR("192.168.0.1/29") _, ipnet, _ := net.ParseCIDR("192.168.0.1/29")
pool, _ := New(ipnet, 10) pool, _ := New(ipnet, 10, nil)
first := pool.Lookup("foo.com") first := pool.Lookup("foo.com")
last := pool.Lookup("bar.com") last := pool.Lookup("bar.com")
@ -23,7 +23,7 @@ func TestPool_Basic(t *testing.T) {
func TestPool_Cycle(t *testing.T) { func TestPool_Cycle(t *testing.T) {
_, ipnet, _ := net.ParseCIDR("192.168.0.1/30") _, ipnet, _ := net.ParseCIDR("192.168.0.1/30")
pool, _ := New(ipnet, 10) pool, _ := New(ipnet, 10, nil)
first := pool.Lookup("foo.com") first := pool.Lookup("foo.com")
same := pool.Lookup("baz.com") same := pool.Lookup("baz.com")
@ -33,7 +33,7 @@ func TestPool_Cycle(t *testing.T) {
func TestPool_MaxCacheSize(t *testing.T) { func TestPool_MaxCacheSize(t *testing.T) {
_, ipnet, _ := net.ParseCIDR("192.168.0.1/24") _, ipnet, _ := net.ParseCIDR("192.168.0.1/24")
pool, _ := New(ipnet, 2) pool, _ := New(ipnet, 2, nil)
first := pool.Lookup("foo.com") first := pool.Lookup("foo.com")
pool.Lookup("bar.com") pool.Lookup("bar.com")
@ -45,7 +45,7 @@ func TestPool_MaxCacheSize(t *testing.T) {
func TestPool_DoubleMapping(t *testing.T) { func TestPool_DoubleMapping(t *testing.T) {
_, ipnet, _ := net.ParseCIDR("192.168.0.1/24") _, ipnet, _ := net.ParseCIDR("192.168.0.1/24")
pool, _ := New(ipnet, 2) pool, _ := New(ipnet, 2, nil)
// fill cache // fill cache
fooIP := pool.Lookup("foo.com") fooIP := pool.Lookup("foo.com")
@ -72,7 +72,7 @@ func TestPool_DoubleMapping(t *testing.T) {
func TestPool_Error(t *testing.T) { func TestPool_Error(t *testing.T) {
_, ipnet, _ := net.ParseCIDR("192.168.0.1/31") _, ipnet, _ := net.ParseCIDR("192.168.0.1/31")
_, err := New(ipnet, 10) _, err := New(ipnet, 10, nil)
assert.Error(t, err) assert.Error(t, err)
} }