Documentation
¶
Overview ¶
Package testutil 提供进程内嵌 etcd 服务端(embed),供各包单元测试使用, 不进入公共 API(internal)。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Server ¶ added in v0.2.8
type Server struct {
// contains filtered or unexported fields
}
Server 是一个可重启的内嵌 etcd 测试服务端:同一数据目录 + 同一端口重启 (模拟 etcd-server 重启/抖动),MVCC 数据与压缩点跨重启保留,客户端自动 重连。
func NewServer ¶ added in v0.2.8
NewServer 启动一个内嵌 etcd 实例并返回服务端句柄;测试结束时自动关停。 端口由内核随机分配,数据目录为 t.TempDir()(自动清理)。
func (*Server) ClientURL ¶ added in v0.3.2
ClientURL 返回服务端 client endpoint 地址(127.0.0.1:port),供测试自建 带拦截器等定制项的 clientv3 客户端(如 registry #147 的故障注入探针)。
Click to show internal directories.
Click to hide internal directories.