testutil

package
v0.0.0-...-95b87ed Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 21 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 ConstructBlockWithTxidHeaderType

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

func ConstructBytesProposalResponsePayload

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

func ConstructRandomBytes

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

func ConstructSignedTxEnv

func ConstructSignedTxEnv(
	channelID string,
	ccid *pb.ChaincodeID,
	pResponse *pb.Response,
	simulationResults []byte,
	txid string,
	events []byte,
	visibility []byte,
	signer msp.SigningIdentity,
	headerType common.HeaderType,
) (*common.Envelope, string, error)

func ConstructSignedTxEnvWithDefaultSigner

func ConstructSignedTxEnvWithDefaultSigner(
	chainID string,
	ccid *pb.ChaincodeID,
	response *pb.Response,
	simulationResults []byte,
	txid string,
	events []byte,
	visibility []byte,
	headerType common.HeaderType,
) (*common.Envelope, string, error)

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(
	t *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 ConstructTransactionWithHeaderType

func ConstructTransactionWithHeaderType(
	t *testing.T,
	simulationResults []byte,
	txid string,
	sign bool,
	headerType common.HeaderType,
) (*common.Envelope, string, error)

func ConstructUnsignedTxEnv

func ConstructUnsignedTxEnv(
	chainID string,
	ccid *pb.ChaincodeID,
	response *pb.Response,
	simulationResults []byte,
	txid string,
	events []byte,
	visibility []byte,
	headerType common.HeaderType,
) (*common.Envelope, string, error)

func CopyDir

func CopyDir(srcroot, destroot string, copyOnlySubdirs bool) error

func CreateTarBytesForTest

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

func NewBlock

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

func SetTxID

func SetTxID(t *testing.T, block *common.Block, txNum int, txID string)

Types

type BlockDetails

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

type BlockGenerator

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

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

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
	Type                            common.HeaderType
}

Jump to

Keyboard shortcuts

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