Documentation ¶
Index ¶
- func ConstructBlock(t *testing.T, blockNum uint64, previousHash []byte, simulationResults [][]byte, ...) *cached.Block
- func ConstructBlockFromBlockDetails(t *testing.T, blockDetails *BlockDetails, sign bool) *cached.Block
- func ConstructBlockWithTxid(t *testing.T, blockNum uint64, previousHash []byte, simulationResults [][]byte, ...) *cached.Block
- func ConstructBytesProposalResponsePayload(version string, simulationResults []byte) ([]byte, error)
- func ConstructRandomBytes(t testing.TB, size int) []byte
- func ConstructTestBlock(t *testing.T, blockNum uint64, numTx int, txSize int) *cached.Block
- func ConstructTestBlocks(t *testing.T, numBlocks int) []*cached.Block
- func ConstructTransaction(_ *testing.T, simulationResults []byte, txid string, sign bool) (*common.Envelope, string, error)
- func ConstructTransactionFromTxDetails(txDetails *TxDetails, sign bool) (*common.Envelope, string, error)
- func CopyDir(srcroot, destroot string) error
- func CreateTarBytesForTest(testFiles []*TarFileEntry) []byte
- func NewBlock(env []*common.Envelope, blockNum uint64, previousHash []byte) *cached.Block
- type BlockDetails
- type BlockGenerator
- func (bg *BlockGenerator) NextBlock(simulationResults [][]byte) *cached.Block
- func (bg *BlockGenerator) NextBlockWithTxid(simulationResults [][]byte, txids []string) *cached.Block
- func (bg *BlockGenerator) NextTestBlock(numTx int, txSize int) *cached.Block
- func (bg *BlockGenerator) NextTestBlocks(numBlocks int) []*cached.Block
- type TarFileEntry
- type TxDetails
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) *cached.Block
ConstructBlock constructs a single block
func ConstructBlockWithTxid ¶
func ConstructBytesProposalResponsePayload ¶
func ConstructBytesProposalResponsePayload(version string, simulationResults []byte) ([]byte, error)
ConstructBytesProposalResponsePayload constructs a ProposalResponse byte with given chaincode version and simulationResults for testing
func ConstructRandomBytes ¶
ConstructRandomBytes constructs random bytes of given size
func ConstructTestBlock ¶
ConstructTestBlock constructs a single block with random contents
func ConstructTestBlocks ¶
ConstructTestBlocks returns a series of blocks starting with blockNum=0. The first block in the returned array is a config tx block that represents a genesis block
func ConstructTransaction ¶
func ConstructTransaction(_ *testing.T, simulationResults []byte, txid string, sign bool) (*common.Envelope, string, error)
ConstructTransaction constructs a transaction for testing
func CreateTarBytesForTest ¶
func CreateTarBytesForTest(testFiles []*TarFileEntry) []byte
CreateTarBytesForTest creates a tar byte array for unit testing
Types ¶
type BlockDetails ¶
type BlockGenerator ¶
type BlockGenerator struct {
// contains filtered or unexported fields
}
BlockGenerator generates a series of blocks for testing
func NewBlockGenerator ¶
func NewBlockGenerator(t *testing.T, ledgerID string, signTxs bool) (*BlockGenerator, *common.Block)
NewBlockGenerator instantiates new BlockGenerator for testing
func (*BlockGenerator) NextBlock ¶
func (bg *BlockGenerator) NextBlock(simulationResults [][]byte) *cached.Block
NextBlock constructs next block in sequence that includes a number of transactions - one per simulationResults
func (*BlockGenerator) NextBlockWithTxid ¶
func (bg *BlockGenerator) NextBlockWithTxid(simulationResults [][]byte, txids []string) *cached.Block
NextBlockWithTxid constructs next block in sequence that includes a number of transactions - one per simulationResults
func (*BlockGenerator) NextTestBlock ¶
func (bg *BlockGenerator) NextTestBlock(numTx int, txSize int) *cached.Block
NextTestBlock constructs next block in sequence block with 'numTx' number of transactions for testing
func (*BlockGenerator) NextTestBlocks ¶
func (bg *BlockGenerator) NextTestBlocks(numBlocks int) []*cached.Block
NextTestBlocks constructs 'numBlocks' number of blocks for testing
type TarFileEntry ¶
type TarFileEntry struct {
Name, Body string
}
TarFileEntry is a structure for adding test index files to an tar