この全ては既に世界の選択だ!

pull/345/head
felixhao 5 years ago
parent 1a5b846cbc
commit 529cbc5245
  1. 17
      pkg/cache/memcache/main_test.go
  2. 9
      pkg/cache/memcache/test/docker-compose.yaml

@ -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)
}

@ -0,0 +1,9 @@
version: "3.7"
services:
mc:
image: memcached:1
ports:
- 11211:11211
Loading…
Cancel
Save