Documentation ¶
Index ¶
- Constants
- Variables
- func AddLocalEntityMapping(configProvider core.ConfigProvider, configOverridePath string) core.ConfigProvider
- func CleanupTestPath(t *testing.T, storePath string)
- func CleanupUserData(t *testing.T, sdk *fabsdk.FabricSDK)
- func CreateChannel(sdk *fabsdk.FabricSDK, req resmgmt.SaveChannelRequest) (bool, error)
- func CreateChannelAndUpdateAnchorPeers(sdk *fabsdk.FabricSDK, channelID string, channelConfigFile string, ...) error
- func DiscoverLocalPeers(ctxProvider contextAPI.ClientProvider, expectedPeers int) ([]fabAPI.Peer, error)
- func ExampleCCInitArgs() [][]byte
- func ExampleCCQueryArgs() [][]byte
- func ExampleCCTxArgs() [][]byte
- func ExampleCCUpgradeArgs() [][]byte
- func FilterTargetsJoinedChannel(sdk *fabsdk.FabricSDK, orgID string, channelID string, targets []string) ([]string, error)
- func GenerateRandomID() string
- func GetDeployPath() string
- func HasPeerJoinedChannel(client *resmgmt.Client, target string, channel string) (bool, error)
- func InitializeChannel(sdk *fabsdk.FabricSDK, orgID string, req resmgmt.SaveChannelRequest, ...) error
- func InstallAndInstantiateCC(sdk *fabsdk.FabricSDK, user fabsdk.ContextOption, orgName string, ...) (resmgmt.InstantiateCCResponse, error)
- func InstallAndInstantiateChaincode(channelID string, ccPkg *resource.CCPackage, ccID, ccVersion, ccPolicy string, ...) error
- func InstallAndInstantiateExampleCC(sdk *fabsdk.FabricSDK, user fabsdk.ContextOption, orgName string, ...) (resmgmt.InstantiateCCResponse, error)
- func InstallChaincode(resMgmt *resmgmt.Client, ctxProvider contextAPI.ClientProvider, ...) error
- func InstantiateChaincode(resMgmt *resmgmt.Client, channelID, ccName, ccVersion string, ...) (resmgmt.InstantiateCCResponse, error)
- func IsJoinedChannel(channelID string, resMgmtClient *resmgmt.Client, peer fabAPI.Peer) (bool, error)
- func IsLocal() bool
- func JoinChannel(sdk *fabsdk.FabricSDK, name, orgID string) (bool, error)
- func JoinPeersToChannel(channelID string, orgsContext []*OrgContext) error
- func OrgTargetPeers(orgs []string, configBackend ...core.ConfigBackend) ([]string, error)
- type BaseSetupImpl
- type OrgContext
Constants ¶
const ( ExampleCCInitB = "200" ExampleCCUpgradeB = "400" AdminUser = "Admin" OrdererOrgName = "ordererorg" )
Initial B values for ExampleCC
const ( //LocalOrdererPeersCAsConfig config file to override on local test having only peers, orderers and CA entity entries LocalOrdererPeersCAsConfig = "${GOPATH}/src/github.com/hyperledger/fabric-sdk-go/test/fixtures/config/overrides/local_orderers_peers_ca.yaml" //LocalOrdererPeersConfig config file to override on local test having only peers and orderers entity entries LocalOrdererPeersConfig = "${GOPATH}/src/github.com/hyperledger/fabric-sdk-go/test/fixtures/config/overrides/local_orderers_peers.yaml" )
Variables ¶
var ConfigBackend = fetchConfigBackend(configPath, LocalOrdererPeersCAsConfig)
ConfigBackend contains config backend for integration tests
Functions ¶
func AddLocalEntityMapping ¶
func AddLocalEntityMapping(configProvider core.ConfigProvider, configOverridePath string) core.ConfigProvider
AddLocalEntityMapping adds local test entity mapping to config backend and returns updated config provider
func CleanupTestPath ¶
CleanupTestPath removes the contents of a state store.
func CleanupUserData ¶
CleanupUserData removes user data.
func CreateChannel ¶
CreateChannel attempts to save the named channel.
func CreateChannelAndUpdateAnchorPeers ¶
func CreateChannelAndUpdateAnchorPeers(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 ExampleCCInitArgs ¶
func ExampleCCInitArgs() [][]byte
ExampleCCInitArgs returns example cc initialization args
func ExampleCCQueryArgs ¶
func ExampleCCQueryArgs() [][]byte
ExampleCCQueryArgs returns example cc query args
func ExampleCCTxArgs ¶
func ExampleCCTxArgs() [][]byte
ExampleCCTxArgs returns example cc move funds args
func ExampleCCUpgradeArgs ¶
func ExampleCCUpgradeArgs() [][]byte
ExampleCCUpgradeArgs 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 HasPeerJoinedChannel ¶
HasPeerJoinedChannel checks whether the peer has already joined the channel. It returns true if it has, false otherwise, or an error
func InitializeChannel ¶
func InitializeChannel(sdk *fabsdk.FabricSDK, orgID string, req resmgmt.SaveChannelRequest, targets []string) error
InitializeChannel ...
func InstallAndInstantiateCC ¶
func InstallAndInstantiateCC(sdk *fabsdk.FabricSDK, user fabsdk.ContextOption, orgName string, ccName, ccPath, ccVersion, goPath string, ccArgs [][]byte) (resmgmt.InstantiateCCResponse, error)
InstallAndInstantiateCC install and instantiate using resource management client
func InstallAndInstantiateChaincode ¶
func InstallAndInstantiateChaincode(channelID string, ccPkg *resource.CCPackage, ccID, ccVersion, ccPolicy string, orgs []*OrgContext, collConfigs ...*cb.CollectionConfig) error
InstallAndInstantiateChaincode installs the given chaincode to all peers in the given orgs and instantiates it on the given channel
func InstallAndInstantiateExampleCC ¶
func InstallAndInstantiateExampleCC(sdk *fabsdk.FabricSDK, user fabsdk.ContextOption, orgName string, chainCodeID string) (resmgmt.InstantiateCCResponse, error)
InstallAndInstantiateExampleCC install and instantiate using resource management client
func InstallChaincode ¶
func InstallChaincode(resMgmt *resmgmt.Client, ctxProvider contextAPI.ClientProvider, ccPkg *resource.CCPackage, ccName, ccVersion string, localPeers []fabAPI.Peer) error
InstallChaincode installs the given chaincode to the given peers
func InstantiateChaincode ¶
func InstantiateChaincode(resMgmt *resmgmt.Client, channelID, ccName, ccVersion string, ccPolicyStr string, collConfigs ...*cb.CollectionConfig) (resmgmt.InstantiateCCResponse, error)
InstantiateChaincode instantiates the given chaincode to the given channel
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 ¶
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
Types ¶
type BaseSetupImpl ¶
type BaseSetupImpl struct { Identity msp.Identity Targets []string ConfigFile string OrgID string ChannelID string ChannelConfigFile 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, channel and event hub
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