|
|
|
@ -1,13 +1,15 @@ |
|
|
|
|
package memcache |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"flag" |
|
|
|
|
"log" |
|
|
|
|
"os" |
|
|
|
|
"testing" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
"github.com/bilibili/kratos/pkg/container/pool" |
|
|
|
|
xtime "github.com/bilibili/kratos/pkg/time" |
|
|
|
|
"go-common/library/container/pool" |
|
|
|
|
"go-common/library/testing/lich" |
|
|
|
|
xtime "go-common/library/time" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
var testConnASCII Conn |
|
|
|
@ -68,12 +70,12 @@ func setupTestPool(addr string) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestMain(m *testing.M) { |
|
|
|
|
testMemcacheAddr = os.Getenv("TEST_MEMCACHE_ADDR") |
|
|
|
|
if testExampleAddr == "" { |
|
|
|
|
log.Print("TEST_MEMCACHE_ADDR not provide skip test.") |
|
|
|
|
// ignored test.
|
|
|
|
|
os.Exit(0) |
|
|
|
|
flag.Set("f", "./test/docker-compose.yaml") |
|
|
|
|
flag.Parse() |
|
|
|
|
if err := lich.Setup(); err != nil { |
|
|
|
|
panic(err) |
|
|
|
|
} |
|
|
|
|
testMemcacheAddr = "127.0.0.1:11211" |
|
|
|
|
setupTestConnASCII(testMemcacheAddr) |
|
|
|
|
setupTestMemcache(testMemcacheAddr) |
|
|
|
|
setupTestPool(testMemcacheAddr) |
|
|
|
@ -81,5 +83,6 @@ func TestMain(m *testing.M) { |
|
|
|
|
testExampleAddr = testMemcacheAddr |
|
|
|
|
|
|
|
|
|
ret := m.Run() |
|
|
|
|
lich.Teardown() |
|
|
|
|
os.Exit(ret) |
|
|
|
|
} |
|
|
|
|