testutil

package
v0.0.0-...-523a819 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructBlock

func ConstructBlock(t *testing.T, blockNum uint64, previousHash []byte, simulationResults [][]byte, sign bool) *common.Block

func ConstructBlockFromBlockDetails

func ConstructBlockFromBlockDetails(t *testing.T, blockDetails *BlockDetails, sign bool) *common.Block

func ConstructBlockWithTxid

func ConstructBlockWithTxid(t *testing.T, blockNum uint64, previousHash []byte, simulationResults [][]byte, txids []string, sign bool) *common.Block

func ConstructBytesProposalResponsePayload

func ConstructBytesProposalResponsePayload(version string, simulationResults []byte) ([]byte, error)

constructBytesProposalResponsePayLoad使用给定的链码版本和模拟结果构造一个ProposalResponse字节用于测试

func ConstructRandomBytes

func ConstructRandomBytes(t testing.TB, size int) []byte

func ConstructTestBlock

func ConstructTestBlock(t *testing.T, blockNum uint64, numTx int, txSize int) *common.Block

func ConstructTestBlocks

func ConstructTestBlocks(t *testing.T, numBlocks int) []*common.Block

func ConstructTransaction

func ConstructTransaction(_ *testing.T, simulationResults []byte, txid string, sign bool) (*common.Envelope, string, error)

func ConstructTransactionFromTxDetails

func ConstructTransactionFromTxDetails(txDetails *TxDetails, sign bool) (*common.Envelope, string, error)

func CopyDir

func CopyDir(srcroot, destroot string) error

func CreateTarBytesForTest

func CreateTarBytesForTest(testFiles []*TarFileEntry) []byte

func NewBlock

func NewBlock(env []*common.Envelope, blockNum uint64, previousHash []byte) *common.Block

Types

type BlockDetails

type BlockDetails struct {
	BlockNum     uint64
	PreviousHash []byte
	Txs          []*TxDetails
}

type BlockGenerator

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

BlockGenerator生成一系列用于测试的块

func NewBlockGenerator

func NewBlockGenerator(t *testing.T, ledgerID string, signTxs bool) (*BlockGenerator, *common.Block)

func (*BlockGenerator) NextBlock

func (bg *BlockGenerator) NextBlock(simulationResults [][]byte) *common.Block

func (*BlockGenerator) NextBlockWithTxid

func (bg *BlockGenerator) NextBlockWithTxid(simulationResults [][]byte, txids []string) *common.Block

nextBlockWithTxID按顺序构造下一个块,其中包含许多事务-每个模拟结果一个

func (*BlockGenerator) NextTestBlock

func (bg *BlockGenerator) NextTestBlock(numTx int, txSize int) *common.Block

func (*BlockGenerator) NextTestBlocks

func (bg *BlockGenerator) NextTestBlocks(numBlocks int) []*common.Block

type TarFileEntry

type TarFileEntry struct {
	Name, Body string
}

type TxDetails

type TxDetails struct {
	TxID                            string
	ChaincodeName, ChaincodeVersion string
	SimulationResults               []byte
}

Jump to

Keyboard shortcuts

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