integration

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExampleCCInitB    = "200"
	ExampleCCUpgradeB = "400"
	AdminUser         = "Admin"
	OrdererOrgName    = "OrdererOrg"
)

Initial B values for ExampleCC

View Source
const (

	//ConfigPathSingleOrg single org version of 'configPath' for testing discovery
	ConfigPathSingleOrg = "${FABRIC_SDK_GO_PROJECT_PATH}/test/fixtures/config/config_e2e_single_org.yaml"
)

Variables

View Source
var ConfigBackend = fetchConfigBackend(configPath, entityMatcherLocal)

ConfigBackend contains config backend for integration tests

Functions

func AddLocalEntityMapping

func AddLocalEntityMapping(configProvider core.ConfigProvider) core.ConfigProvider

AddLocalEntityMapping adds local test entity mapping to config backend and returns updated config provider

func ApproveExampleChaincode

func ApproveExampleChaincode(orgs []*OrgContext, channelID, ccID, ccVersion, packageID, ccPolicyStr string, sequence int64, collConfigs ...*pb.CollectionConfig) error

ApproveExampleChaincode approve the example CC on the given channel

func CheckCCCommitReadiness

func CheckCCCommitReadiness(mc []*OrgContext, packageID string, ccName, ccVersion string, sequence int64, channelID string, ccPolicyStr string, collConfigs ...*pb.CollectionConfig) error

CheckCCCommitReadiness checkcommit the example CC on the given channel

func CleanupTestPath

func CleanupTestPath(t *testing.T, storePath string)

CleanupTestPath removes the contents of a state store.

func CleanupUserData

func CleanupUserData(t *testing.T, sdk *fabsdk.FabricSDK)

CleanupUserData removes user data.

func CommitExampleChaincode

func CommitExampleChaincode(orgs []*OrgContext, channelID, ccID, ccVersion, ccPolicyStr string, sequence int64, collConfigs ...*pb.CollectionConfig) error

CommitExampleChaincode approve the example CC on the given channel

func CreateChannelAndUpdateAnchorPeers

func CreateChannelAndUpdateAnchorPeers(t *testing.T, sdk *fabsdk.FabricSDK, channelID string, channelConfigFile string, orgsContext []*OrgContext) error

CreateChannelAndUpdateAnchorPeers creates the channel and updates all of the anchor peers for all orgs

func DiscoverLocalPeers

func DiscoverLocalPeers(ctxProvider contextAPI.ClientProvider, expectedPeers int) ([]fabAPI.Peer, error)

DiscoverLocalPeers queries the local peers for the given MSP context and returns all of the peers. If the number of peers does not match the expected number then an error is returned.

func EnsureChannelCreatedAndPeersJoined

func EnsureChannelCreatedAndPeersJoined(t *testing.T, sdk *fabsdk.FabricSDK, channelID string, channelTxFile string, orgsContext []*OrgContext) error

EnsureChannelCreatedAndPeersJoined creates a channel, joins all peers in the given orgs to the channel and updates the anchor peers of each org.

func ExampleCCDefaultQueryArgs

func ExampleCCDefaultQueryArgs() [][]byte

ExampleCCDefaultQueryArgs returns example cc query args

func ExampleCCDefaultTxArgs

func ExampleCCDefaultTxArgs() [][]byte

ExampleCCDefaultTxArgs returns example cc move funds args

func ExampleCCInitArgs

func ExampleCCInitArgs() [][]byte

ExampleCCInitArgs returns example cc initialization args

func ExampleCCInitArgsLc

func ExampleCCInitArgsLc() [][]byte

ExampleCCInitArgsLc returns example cc initialization args

func ExampleCCQueryArgs

func ExampleCCQueryArgs(key string) [][]byte

ExampleCCQueryArgs returns example cc query args

func ExampleCCTxArgs

func ExampleCCTxArgs(from, to, val string) [][]byte

ExampleCCTxArgs returns example cc query args

func ExampleCCTxRandomSetArgs

func ExampleCCTxRandomSetArgs() [][]byte

ExampleCCTxRandomSetArgs returns example cc set args with random key-value pairs

func ExampleCCTxSetArgs

func ExampleCCTxSetArgs(key, value string) [][]byte

ExampleCCTxSetArgs sets the given key value in examplecc

func ExampleCCUpgradeArgs

func ExampleCCUpgradeArgs() [][]byte

ExampleCCUpgradeArgs returns example cc upgrade args

func ExampleCCUpgradeArgsLc

func ExampleCCUpgradeArgsLc() [][]byte

ExampleCCUpgradeArgsLc returns example cc upgrade args

func FilterTargetsJoinedChannel

func FilterTargetsJoinedChannel(sdk *fabsdk.FabricSDK, orgID string, channelID string, targets []string) ([]string, error)

FilterTargetsJoinedChannel filters targets to those that have joined the named channel.

func GenerateExampleID

func GenerateExampleID(randomize bool) string

GenerateExampleID supplies a chaincode name for example_cc

func GenerateExampleJavaID

func GenerateExampleJavaID(randomize bool) string

GenerateExampleJavaID supplies a java chaincode name for example_cc

func GenerateExampleNodeID

func GenerateExampleNodeID(randomize bool) string

GenerateExampleNodeID supplies a node chaincode name for example_cc

func GenerateExamplePvtID

func GenerateExamplePvtID(randomize bool) string

GenerateExamplePvtID supplies a chaincode name for example_pvt_cc

func GenerateRandomID

func GenerateRandomID() string

GenerateRandomID generates random ID

func GetChannelConfigTxPath

func GetChannelConfigTxPath(filename string) string

GetChannelConfigTxPath returns the path to the named channel config file

func GetConfigOverridesPath

func GetConfigOverridesPath(filename string) string

GetConfigOverridesPath returns the path to the named config override fixture file

func GetConfigPath

func GetConfigPath(filename string) string

GetConfigPath returns the path to the named config fixture file

func GetCryptoConfigPath

func GetCryptoConfigPath(filename string) string

GetCryptoConfigPath returns the path to the named crypto-config override fixture file

func GetDeployPath

func GetDeployPath() string

GetDeployPath returns the path to the chaincode fixtures

func GetJavaDeployPath

func GetJavaDeployPath() string

GetJavaDeployPath returns the path to the java chaincode fixtrues

func GetKeyName

func GetKeyName(t *testing.T) string

GetKeyName creates random key name based on test name

func GetLcDeployPath

func GetLcDeployPath() string

GetLcDeployPath returns the path to the chaincode fixtures

func GetLcPvtDeployPath

func GetLcPvtDeployPath() string

GetLcPvtDeployPath returns the path to the chaincode fixtures

func GetNodeDeployPath

func GetNodeDeployPath() string

GetNodeDeployPath returns the path to the node chaincode fixtrues

func HasPeerJoinedChannel

func HasPeerJoinedChannel(client *resmgmt.Client, target string, channel string) (bool, error)

HasPeerJoinedChannel checks whether the peer has already joined the channel. It returns true if it has, false otherwise, or an error

func InitExampleChaincode

func InitExampleChaincode(sdk *fabsdk.FabricSDK, channelID, ccID string, orgName string) error

InitExampleChaincode init the example CC on the given channel

func InitializeChannel

func InitializeChannel(sdk *fabsdk.FabricSDK, orgID string, req resmgmt.SaveChannelRequest, targets []string) error

InitializeChannel ...

func InstallChaincode

func InstallChaincode(resMgmt *resmgmt.Client, ccPkg *resource.CCPackage, ccPath, ccName, ccVersion string, localPeers []fabAPI.Peer) error

InstallChaincode installs the given chaincode to the given peers

func InstallChaincodeWithOrgContexts

func InstallChaincodeWithOrgContexts(orgs []*OrgContext, ccPkg *resource.CCPackage, ccPath, ccID, ccVersion string) error

InstallChaincodeWithOrgContexts installs the given chaincode to orgs

func InstallExampleChaincode

func InstallExampleChaincode(orgs []*OrgContext, ccID string) error

InstallExampleChaincode installs the example chaincode to all peers in the given orgs

func InstallExampleChaincodeLc

func InstallExampleChaincodeLc(orgs []*OrgContext, ccID, ccVersion string) (string, error)

InstallExampleChaincodeLc installs the example chaincode to all peers in the given orgs

func InstallExampleJavaChaincode

func InstallExampleJavaChaincode(orgs []*OrgContext, ccID string) error

InstallExampleJavaChaincode installs the example java chaincode to all peers in the given orgs

func InstallExampleNodeChaincode

func InstallExampleNodeChaincode(orgs []*OrgContext, ccID string) error

InstallExampleNodeChaincode installs the example node chaincode to all peers in the given orgs

func InstallExamplePvtChaincode

func InstallExamplePvtChaincode(orgs []*OrgContext, ccID string) error

InstallExamplePvtChaincode installs the example pvt chaincode to all peers in the given orgs

func InstallExamplePvtChaincodeLc

func InstallExamplePvtChaincodeLc(orgs []*OrgContext, ccID, ccVersion string) (string, error)

InstallExamplePvtChaincodeLc installs the example chaincode to all peers in the given orgs

func InstantiateChaincode

func InstantiateChaincode(resMgmt *resmgmt.Client, channelID, ccName, ccPath, ccVersion string, ccPolicyStr string, args [][]byte, collConfigs ...*pb.CollectionConfig) (resmgmt.InstantiateCCResponse, error)

InstantiateChaincode instantiates the given chaincode to the given channel

func InstantiateExampleChaincode

func InstantiateExampleChaincode(orgs []*OrgContext, channelID, ccID, ccPolicy string, collConfigs ...*pb.CollectionConfig) error

InstantiateExampleChaincode instantiates the example CC on the given channel

func InstantiateExampleChaincodeLc

func InstantiateExampleChaincodeLc(sdk *fabsdk.FabricSDK, orgs []*OrgContext, channelID, ccID, ccPolicy string, collConfigs ...*pb.CollectionConfig) error

InstantiateExampleChaincodeLc install and instantiate using resource management client

func InstantiateExampleJavaChaincode

func InstantiateExampleJavaChaincode(orgs []*OrgContext, channelID, ccID, ccPolicy string, collConfigs ...*pb.CollectionConfig) error

InstantiateExampleJavaChaincode instantiates the example CC on the given channel

func InstantiateExampleNodeChaincode

func InstantiateExampleNodeChaincode(orgs []*OrgContext, channelID, ccID, ccPolicy string, collConfigs ...*pb.CollectionConfig) error

InstantiateExampleNodeChaincode instantiates the example CC on the given channel

func InstantiateExamplePvtChaincode

func InstantiateExamplePvtChaincode(orgs []*OrgContext, channelID, ccID, ccPolicy string, collConfigs ...*pb.CollectionConfig) error

InstantiateExamplePvtChaincode instantiates the example pvt CC on the given channel

func InstantiateJavaChaincode

func InstantiateJavaChaincode(resMgmt *resmgmt.Client, channelID, ccName, ccPath, ccVersion string, ccPolicyStr string, args [][]byte, collConfigs ...*pb.CollectionConfig) (resmgmt.InstantiateCCResponse, error)

InstantiateJavaChaincode instantiates the given java chaincode to the given channel

func InstantiateNodeChaincode

func InstantiateNodeChaincode(resMgmt *resmgmt.Client, channelID, ccName, ccPath, ccVersion string, ccPolicyStr string, args [][]byte, collConfigs ...*pb.CollectionConfig) (resmgmt.InstantiateCCResponse, error)

InstantiateNodeChaincode instantiates the given node chaincode to the given channel

func InstantiatePvtExampleChaincodeLc

func InstantiatePvtExampleChaincodeLc(sdk *fabsdk.FabricSDK, orgs []*OrgContext, channelID, ccID, ccPolicy string, collConfigs ...*pb.CollectionConfig) error

InstantiatePvtExampleChaincodeLc install and instantiate using resource management client

func IsDynamicDiscoverySupported

func IsDynamicDiscoverySupported() bool

IsDynamicDiscoverySupported returns if fabric version on which tests are running supports dynamic discovery any version greater than v1.1 supports dynamic discovery

func IsJoinedChannel

func IsJoinedChannel(channelID string, resMgmtClient *resmgmt.Client, peer fabAPI.Peer) (bool, error)

IsJoinedChannel returns true if the given peer has joined the given channel

func IsLocal

func IsLocal() bool

IsLocal checks os argument and returns true if 'testLocal=true' argument found

func JoinChannel

func JoinChannel(sdk *fabsdk.FabricSDK, name, orgID string, targets []string) (bool, error)

JoinChannel attempts to save the named channel.

func JoinPeersToChannel

func JoinPeersToChannel(channelID string, orgsContext []*OrgContext) error

JoinPeersToChannel joins all peers in all of the given orgs to the given channel

func OrgTargetPeers

func OrgTargetPeers(orgs []string, configBackend ...core.ConfigBackend) ([]string, error)

OrgTargetPeers determines peer endpoints for orgs

func PrepareExampleCC

func PrepareExampleCC(sdk *fabsdk.FabricSDK, user fabsdk.ContextOption, orgName string, chaincodeID string) error

PrepareExampleCC install and instantiate using resource management client

func PrepareExampleCCLc

func PrepareExampleCCLc(sdk *fabsdk.FabricSDK, user fabsdk.ContextOption, orgName string, chaincodeID string) error

PrepareExampleCCLc install and instantiate using resource management client

func QueryApprovedCC

func QueryApprovedCC(mc []*OrgContext, ccName string, sequence int64, channelID string) error

QueryApprovedCC query approve of the example CC on the given channel

func QueryCommittedCC

func QueryCommittedCC(mc []*OrgContext, ccName string, channelID string, sequence int64) error

QueryCommittedCC query commit of the example CC on the given channel

func ResetKeys

func ResetKeys(t *testing.T, ctx contextAPI.ChannelProvider, chaincodeID, value string, keys ...string)

ResetKeys resets given set of keys in example cc to given value

func SaveChannel

func SaveChannel(sdk *fabsdk.FabricSDK, req resmgmt.SaveChannelRequest) (bool, error)

SaveChannel attempts to save (create or update) the named channel.

func UpgradeChaincode

func UpgradeChaincode(resMgmt *resmgmt.Client, channelID, ccName, ccPath, ccVersion string, ccPolicyStr string, args [][]byte, collConfigs ...*pb.CollectionConfig) (resmgmt.UpgradeCCResponse, error)

UpgradeChaincode upgrades the given chaincode on the given channel

func UpgradeExampleJavaChaincode

func UpgradeExampleJavaChaincode(orgs []*OrgContext, channelID, ccID, ccPolicy string, collConfigs ...*pb.CollectionConfig) error

UpgradeExampleJavaChaincode upgrades the instantiated example java CC on the given channel

func UpgradeExampleNodeChaincode

func UpgradeExampleNodeChaincode(orgs []*OrgContext, channelID, ccID, ccPolicy string, collConfigs ...*pb.CollectionConfig) error

UpgradeExampleNodeChaincode upgrades the instantiated example java CC on the given channel

func UpgradeExamplePvtChaincode

func UpgradeExamplePvtChaincode(orgs []*OrgContext, channelID, ccID, ccPolicy string, collConfigs ...*pb.CollectionConfig) error

UpgradeExamplePvtChaincode upgrades the instantiated example pvt CC on the given channel

func UpgradeExamplePvtChaincodeLc

func UpgradeExamplePvtChaincodeLc(sdk *fabsdk.FabricSDK, orgs []*OrgContext, channelID, ccID, ccPolicy string, collConfigs ...*pb.CollectionConfig) error

UpgradeExamplePvtChaincodeLc upgrades the instantiated example pvt CC on the given channel

func UpgradeJavaChaincode

func UpgradeJavaChaincode(resMgmt *resmgmt.Client, channelID, ccName, ccPath, ccVersion string, ccPolicyStr string, args [][]byte, collConfigs ...*pb.CollectionConfig) (resmgmt.UpgradeCCResponse, error)

UpgradeJavaChaincode upgrades the given java chaincode on the given channel

func UpgradeNodeChaincode

func UpgradeNodeChaincode(resMgmt *resmgmt.Client, channelID, ccName, ccPath, ccVersion string, ccPolicyStr string, args [][]byte, collConfigs ...*pb.CollectionConfig) (resmgmt.UpgradeCCResponse, error)

UpgradeNodeChaincode upgrades the given node chaincode on the given channel

func WaitForOrdererConfigUpdate

func WaitForOrdererConfigUpdate(t *testing.T, client *resmgmt.Client, channelID string, genesis bool, lastConfigBlock uint64) uint64

WaitForOrdererConfigUpdate waits until the config block update has been committed. In Fabric 1.0 there is a bug that panics the orderer if more than one config update is added to the same block. This function may be invoked after each config update as a workaround.

Types

type BaseSetupImpl

type BaseSetupImpl struct {
	Identity            msp.Identity
	Targets             []string
	ConfigFile          string
	OrgID               string
	ChannelID           string
	ChannelConfigTxFile string
}

BaseSetupImpl implementation of BaseTestSetup

func (*BaseSetupImpl) Initialize

func (setup *BaseSetupImpl) Initialize(sdk *fabsdk.FabricSDK) error

Initialize reads configuration from file and sets up client and channel

type OrgContext

type OrgContext struct {
	OrgID                string
	CtxProvider          contextAPI.ClientProvider
	SigningIdentity      msp.SigningIdentity
	ResMgmt              *resmgmt.Client
	Peers                []fabAPI.Peer
	AnchorPeerConfigFile string
}

OrgContext provides SDK client context for a given org

func SetupMultiOrgContext

func SetupMultiOrgContext(sdk *fabsdk.FabricSDK, org1Name string, org2Name string, org1AdminUser string, org2AdminUser string) ([]*OrgContext, error)

SetupMultiOrgContext creates an OrgContext for two organizations in the org channel.

Directories

Path Synopsis
e2e
pkg
util

Jump to

Keyboard shortcuts

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