testutil

package
v0.0.0-...-9750751 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortRedist

func AbortRedist(t *testing.T, hostip string)

func AddProxyConfig

func AddProxyConfig(file string, config string) error

func AddRemoveProxyConfigValue

func AddRemoveProxyConfigValue(file string, config string, parentConfig string, adflag bool, hostip string) error

*********************************************************************

  • Function to add dedicated config value in proxy config file if the
  • setting is not there due to it's in default list *********************************************************************

func ApproxEqual

func ApproxEqual(v1 uint32, v2 uint32, epsilon uint32) bool

func CheckLog

func CheckLog(t *testing.T, hostip string, grepstr string, inProxy bool) error

func CopyCtlMgr

func CopyCtlMgr(hostip string)

func CreateAndValidate

func CreateAndValidate(c client.IClient, key []byte,
	inputData []byte, lifetime uint32, expect_err error) error

func DestroyAndValidate

func DestroyAndValidate(c client.IClient, key []byte, expect_err error) error

func ETCDSSDeleteRecord

func ETCDSSDeleteRecord(ssNodes []server.SSNode, ns string, key []byte)

*************************************************

  • Function to delete record in old sharding node *************************************************

func ETCDSSGetRecord

func ETCDSSGetRecord(ssNodes []server.SSNode, ns string, key []byte, inputData []byte,
	lifetime uint32, version uint32, creationTime uint32) (err error, noNode bool)

******************************************************************

  • Function to get record, this is similar as GetRecord. It added
  • one parameter create time so the lifetime calculation could be
  • more accurate. Ideally all the GetRecord should be like this but
  • we do this particularlly for ETCD as ETCD test runs with multiple
  • records operation and time would be a necessary parameter. *******************************************************************

func EtcdStartSecondHost

func EtcdStartSecondHost(t *testing.T, start int)

**********************************************************

  • Second host means the host snapshot will be forwarded to **********************************************************

func FinalizeConfig

func FinalizeConfig(t *testing.T, hostip string)

commit the new change

func FinishForwardCheck

func FinishForwardCheck(t *testing.T, hostip string)

temporally check forward finish, all zones are snapshot_finish

func GenerateRandomKey

func GenerateRandomKey(n int) []byte

***********************************

  • Function to generate a random key ***********************************

func GetProxyConfigValue

func GetProxyConfigValue(file string, config string, parentConfig string, hostip string) (string, error)

*************************************************************************

  • Function to get dedicated config value in proxy config file, this value
  • will be used for later recovery, if config doesn't exist, return error *************************************************************************

func GetRecord

func GetRecord(c client.IClient, key []byte, inputData []byte,
	lifetime uint32, version uint32, expect_err error, creationTime uint32) error

*************************************************

  • Function to get record and do needed validation *************************************************

func GetRecordUpdateTTL

func GetRecordUpdateTTL(c client.IClient, key []byte, inputData []byte,
	newLifetime uint32, version uint32) error

*************************************************

  • Function to get record and do needed validation *************************************************

func GetUpdatedShardNodes

func GetUpdatedShardNodes(oldNodes []server.SSNode, newNodes []server.SSNode) ([]server.SSNode, []server.SSNode)

***********************************************************************

  • Function to get new sharding SS node as well as old sharding SS node.
  • All updated node info will be used to check record update after
  • sharding redistribution done. After ETCD redistribution done, old
  • sharding node won't get record update while new sharding node will. ***********************************************************************

func HaveSameOriginator

func HaveSameOriginator(ctx1 client.IContext, ctx2 client.IContext) bool

func LoadInitConfig

func LoadInitConfig(hostip string)

func NewTimeKeeper

func NewTimeKeeper() *timeKeeper

func PrintStatus

func PrintStatus(funcname string, params *mock.MockParams, err error)

func ReInitializeCluster

func ReInitializeCluster(config server.ClusterConfig) (c *server.Cluster)

func RemoveLog

func RemoveLog(t *testing.T, hostip string, inProxy bool) error

func RemoveProxyConfig

func RemoveProxyConfig(file string, config string) error

func ResolveHostIp

func ResolveHostIp() string

func RestartETCD

func RestartETCD(t *testing.T, hostip string)

func ResumeAbortedReq

func ResumeAbortedReq(t *testing.T, hostip string)

resume the aborted redistribution

func RunlimitsConfig

func RunlimitsConfig(t *testing.T, hostip string)

func SSRestart

func SSRestart(hostip string, secondhost bool)

func SSShutdown

func SSShutdown(hostip string, secondhost bool)

This definitely will be deleted as it's a temporally workaround for shutdown issue

func SetAndValidate

func SetAndValidate(c client.IClient, key []byte,
	inputData []byte, lifetime uint32, expect_err error) error

**********************************************************

  • Function to set and get record to do needed validation **********************************************************

func ShutdownETCD

func ShutdownETCD(t *testing.T, hostip string)

func StartAutoRedistConfig

func StartAutoRedistConfig(t *testing.T, hostip string, markdown string)

start auto redistribution

func StartRedistConfig

func StartRedistConfig(t *testing.T, hostip string, markdown string)

start redist

func TempEtcdStartFirstHost

func TempEtcdStartFirstHost(t *testing.T, hostip string, start bool)

**********************************************************

  • This is a temporally function to make shutdown easier **********************************************************

func UpdateAndValidate

func UpdateAndValidate(c client.IClient, key []byte,
	inputData []byte, lifetime uint32, expect_err error) error

***********************************************************

  • Function to update and get record to do needed validation ***********************************************************

func UpdateProxyConfig

func UpdateProxyConfig(file string, old string, new string, parentConfig string, hostip string) error

****************************************************************

  • Function to update dedicated config value in proxy config file ****************************************************************

func UpdateRedistConfig

func UpdateRedistConfig(t *testing.T, hostip string, connNo string, configFile string)

temporally create redist info

func VerifyRecordInfo

func VerifyRecordInfo(recInfo client.IContext, ver uint32, ttl uint32, creationTime uint32) error

This function has to be called right after getting RecordInfo

func ZoneMarkup

func ZoneMarkup(t *testing.T, hostip string)

Types

type KVMap

type KVMap map[string]string

type TestConfig

type TestConfig struct {
	// contains filtered or unexported fields
}

func NewTestConfig

func NewTestConfig() *TestConfig

*************************************************************

  • Note: add/remove host test case depends on sharding info
  • which depends on host/port config, please keep host number
  • and port assign sequence same if you change host/port *************************************************************

func (*TestConfig) AddConfig

func (tc *TestConfig) AddConfig(section string, name string, value string)

func (*TestConfig) CreateTomlFile

func (tc *TestConfig) CreateTomlFile(fname string) error

func (*TestConfig) DeleteTomlFile

func (tc *TestConfig) DeleteTomlFile(fname string) error

func (*TestConfig) Dump

func (tc *TestConfig) Dump()

func (*TestConfig) Reset

func (tc *TestConfig) Reset()

type TestServer

type TestServer struct {
	// contains filtered or unexported fields
}

func NewTestServer

func NewTestServer(config_file_name string, ss string, proxy_port string) *TestServer

func NewTestServerWithConnectInfo

func NewTestServerWithConnectInfo(config_file_name string, ss string, proxy_port string, conn_info string, num_zones string) *TestServer

func (*TestServer) AddConfig

func (ts *TestServer) AddConfig(section string, name string, value string)

Directories

Path Synopsis
log

Jump to

Keyboard shortcuts

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