util

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BackupDir is the backup directory for test
	BackupDir = "testdata/backup"
)

Variables

This section is empty.

Functions

func BuildNamingService

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

BuildNamingService 创建一个namingpb service

func CopyDir

func CopyDir(src string, dst string) error

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

func DeleteDir

func DeleteDir(path string) error

DeleteDir 删除目录

func DirExist

func DirExist(path string) bool

DirExist 目录是否存在

func FileExist

func FileExist(path string) bool

FileExist 文件是否存在

func GetGrpcServer

func GetGrpcServer() *grpc.Server

GetGrpcServer 返回一个默认的grpc server

func InsertLog

func InsertLog(s NamingTestSuite, logContent string)

InsertLog 将测试结果的日志存入logmap

func SameInstances

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

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

func SelectInstanceSpecificNum

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

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

func SetupMockDiscover

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

SetupMockDiscover 初始化mock namingServer

func StartGrpcServer

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

StartGrpcServer 启动grpc server监听

Types

type NamingTestSuite

type NamingTestSuite interface {
	GetName() string
}

NamingTestSuite test suite interface

type RegisteredInstance

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

RegisteredInstance 要注册的实例

Jump to

Keyboard shortcuts

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