testframework

package
v0.0.0-...-035b7fa Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: GPL-3.0 Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

* Copyright (C) 2020 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.

* Copyright (C) 2020 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.

* Copyright (C) 2020 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var TFramework = NewTestFramework()

Default TestFramework instance

Functions

func MonitorBtc

func MonitorBtc(ctx *TestFrameworkContext)

func MonitorCosmos

func MonitorCosmos(ctx *TestFrameworkContext)

func MonitorEthLikeChain

func MonitorEthLikeChain(ctx *TestFrameworkContext, chainID uint64)

func MonitorKai

func MonitorKai(ctx *TestFrameworkContext)

func MonitorNeo

func MonitorNeo(ctx *TestFrameworkContext)

func MonitorOnt

func MonitorOnt(ctx *TestFrameworkContext)

func MonitorRChain

func MonitorRChain(ctx *TestFrameworkContext)

func ReportPending

func ReportPending(ctx *TestFrameworkContext)

Types

type CaseStatus

type CaseStatus struct {
	CaseIdx int
	// contains filtered or unexported fields
}

func NewCaseStatus

func NewCaseStatus(idx int) *CaseStatus

func (*CaseStatus) AddTx

func (cs *CaseStatus) AddTx(k string, v *TxInfo)

func (*CaseStatus) BatchDel

func (cs *CaseStatus) BatchDel(keys []string)

func (*CaseStatus) Del

func (cs *CaseStatus) Del(k string)

func (*CaseStatus) GetMapCopy

func (cs *CaseStatus) GetMapCopy() map[string]*TxInfo

func (*CaseStatus) Has

func (cs *CaseStatus) Has(k string) bool

func (*CaseStatus) Info

func (cs *CaseStatus) Info() string

func (*CaseStatus) Len

func (cs *CaseStatus) Len() int

func (*CaseStatus) SetItSuccess

func (cs *CaseStatus) SetItSuccess(status int)

type CtxStatus

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

func NewCtxStatus

func NewCtxStatus(ctx *TestFrameworkContext) *CtxStatus

func (*CtxStatus) AddCase

func (status *CtxStatus) AddCase(idx int) *CaseStatus

func (*CtxStatus) Del

func (status *CtxStatus) Del(tx string)

func (*CtxStatus) DelWithIndex

func (status *CtxStatus) DelWithIndex(tx string, idx int)

func (*CtxStatus) GetCaseMap

func (status *CtxStatus) GetCaseMap() map[int]*CaseStatus

func (*CtxStatus) GetCaseStatus

func (status *CtxStatus) GetCaseStatus(idx int) *CaseStatus

func (*CtxStatus) Info

func (status *CtxStatus) Info() map[int]string

func (*CtxStatus) IsTxPending

func (status *CtxStatus) IsTxPending(tx string) (bool, int)

type TestCase

type TestCase func(ctx *TestFrameworkContext, status *CaseStatus) bool

TestCase type

type TestFramework

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

TestFramework manage test case and run test case

func NewTestFramework

func NewTestFramework() *TestFramework

NewTestFramework return a TestFramework instance

func (*TestFramework) RegTestCase

func (this *TestFramework) RegTestCase(name string, testCase TestCase)

RegTestCase register a test case to framework

func (*TestFramework) Run

func (this *TestFramework) Run(testCases []string, loopNum int)

func (*TestFramework) RunOnce

func (this *TestFramework) RunOnce(testCases []string)

func (*TestFramework) SeBorInvoker

func (this *TestFramework) SeBorInvoker(invoker *eth.EInvoker)

func (*TestFramework) SeKaiInvoker

func (this *TestFramework) SeKaiInvoker(invoker *eth.EInvoker)

SetO3Invoker instance to test framework

func (*TestFramework) SetBSCInvoker

func (this *TestFramework) SetBSCInvoker(invoker *eth.EInvoker)

SetBSC instance to test framework

func (*TestFramework) SetBtcInvoker

func (this *TestFramework) SetBtcInvoker(invoker *btc.BtcInvoker)

SetBtcCli instance to test framework

func (*TestFramework) SetCosmosInvoker

func (this *TestFramework) SetCosmosInvoker(cmInvoker *cosmos.CosmosInvoker)

func (*TestFramework) SetEthInvoker

func (this *TestFramework) SetEthInvoker(invoker *eth.EInvoker)

SetETH instance to test framework

func (*TestFramework) SetMSCInvoker

func (this *TestFramework) SetMSCInvoker(invoker *eth.EInvoker)

SetMSCInvoker instance to test framework

func (*TestFramework) SetNeoInvoker

func (this *TestFramework) SetNeoInvoker(neoInvoker *neo.NeoInvoker)

func (*TestFramework) SetO3Invoker

func (this *TestFramework) SetO3Invoker(invoker *eth.EInvoker)

SetO3Invoker instance to test framework

func (*TestFramework) SetOntInvoker

func (this *TestFramework) SetOntInvoker(invoker *ont.OntInvoker)

func (*TestFramework) SetRcSdk

func (this *TestFramework) SetRcSdk(rcSdk *poly_go_sdk.PolySdk)

SetRcSdk relaye chain sdk instance to test framework

func (*TestFramework) Start

func (this *TestFramework) Start(testCases []string, loopNumber int)

Start run test case

type TestFrameworkContext

type TestFrameworkContext struct {
	Framework *TestFramework
	Cases     []TestCase
	RcSdk     *poly_go_sdk.PolySdk
	Status    *CtxStatus
	// invokers
	EthInvoker *eth.EInvoker
	BscInvoker *eth.EInvoker
	MscInvoker *eth.EInvoker
	O3Invoker  *eth.EInvoker
	BtcInvoker *btc.BtcInvoker
	OntInvoker *ont.OntInvoker
	CMInvoker  *cosmos.CosmosInvoker
	NeoInvoker *neo.NeoInvoker
	KaiInvoker *eth.EInvoker
	BorInvoker *eth.EInvoker
}

TestFrameworkContext is the context for test case

func NewTestFrameworkContext

func NewTestFrameworkContext(fw *TestFramework, caseArr []TestCase, rcSdk *poly_go_sdk.PolySdk, eInvkr, bscInvkr, mscInvkr, o3Invkr *eth.EInvoker,
	btcInvkr *btc.BtcInvoker, ontInvkr *ont.OntInvoker, cmInvoker *cosmos.CosmosInvoker, neoInvoker *neo.NeoInvoker, kaiInvoker, borInvoker *eth.EInvoker) *TestFrameworkContext

NewTestFrameworkContext return a TestFrameworkContext instance

type TxInfo

type TxInfo struct {
	Ty        string
	StartTime time.Time
}

Jump to

Keyboard shortcuts

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