mirror of
https://github.com/go-kratos/kratos.git
synced 2025-03-17 21:07:54 +02:00
この全ては既に世界の選択だ!
This commit is contained in:
parent
1a5b846cbc
commit
529cbc5245
17
pkg/cache/memcache/main_test.go
vendored
17
pkg/cache/memcache/main_test.go
vendored
@ -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)
|
||||
}
|
||||
|
9
pkg/cache/memcache/test/docker-compose.yaml
vendored
Executable file
9
pkg/cache/memcache/test/docker-compose.yaml
vendored
Executable file
@ -0,0 +1,9 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: memcached:1
|
||||
ports:
|
||||
- 11211:11211
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user