util

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackupDir = "testdata/backup"
)

Variables

This section is empty.

Functions

func BuildNamingService

func BuildNamingService(namespace string, service string, token string) *namingpb.Service

创建一个namingpb service

func CopyDir

func CopyDir(src string, dst string) error

将src文件夹中的文件复制到dst文件夹中,不包括子目录

func DeleteDir

func DeleteDir(path string) error

删除目录

func DirExist

func DirExist(path string) bool

目录是否存在

func FileExist

func FileExist(path string) bool

文件是否存在

func GetGrpcServer

func GetGrpcServer() *grpc.Server

返回一个默认的grpc server

func InsertLog

func InsertLog(s NamingTestSuite, logContent string)

将测试结果的日志存入logmap

func SameInstances

func SameInstances(origInst, newInst []model.Instance) bool

比较两个实例数组内容是否一致

func SelectInstanceSpecificNum

func SelectInstanceSpecificNum(c *check.C, consumerAPI api.ConsumerAPI, targetIns model.Instance, selectNum, maxTimes int)

获取某个特定的实例一定的次数

func SetupMockDiscover

func SetupMockDiscover(host string, port int) (*grpc.Server, net.Listener, mock.NamingServer)

初始化mock namingServer

func SetupMonitor

func SetupMonitor(mockServer mock.NamingServer, svcKey model.ServiceKey, instances RegisteredInstance) (mock.MonitorServer, *grpc.Server, string, error)

注册并启动一个mock monitor

func StartGrpcServer

func StartGrpcServer(svr *grpc.Server, listener net.Listener)

启动grpc server监听

Types

type NamingTestSuite

type NamingTestSuite interface {
	GetName() string
}

测试套件接口

type RegisteredInstance

type RegisteredInstance struct {
	IP      string
	Port    int
	Listen  bool
	Healthy bool
}

要注册的实例

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL