Documentation ¶
Index ¶
- Variables
- func ClearResponse()
- func ClearState()
- func FindPKCS11Lib(configuredLib string) string
- func GenerateRandomID() string
- func GetByteArgs(argsArray []string) [][]byte
- func GetChannelAnchorTxPath(channelID, orgName string) string
- func GetChannelTxPath(channelID string) string
- func GetResponse() string
- func GetVar(varName string) (string, bool)
- func HTTPGet(url string) ([]byte, int, http.Header, error)
- func HTTPPost(url string, content []byte, contentType string) ([]byte, int, http.Header, error)
- func HTTPPostFile(url, path string) ([]byte, int, http.Header, error)
- func HasPrimaryPeerJoinedChannel(channelID string, client *resmgmt.Client, orgUser mspApi.Identity, ...) (bool, error)
- func IsChaincodeInstalled(client *resmgmt.Client, peer fabApi.Peer, name string) (bool, error)
- func NewChaincodePolicy(bddCtx *BDDContext, ccPolicy, channelID string) (*fabricCommon.SignaturePolicyEnvelope, error)
- func PrintResponse(statusCode int, payload []byte, header http.Header)
- func Resolve(vars map[string]string, arg string) (string, error)
- func ResolveAll(vars map[string]string, args []string) ([]string, error)
- func ResolveAllVars(args string) ([]string, error)
- func ResolveVars(val interface{}) (interface{}, error)
- func ResolveVarsInExpression(expressions ...*string) error
- func SetAuthToken(path HTTPPath, method HTTPMethod, token AuthToken)
- func SetAuthTokenHeader(req *http.Request)
- func SetResponse(response string)
- func SetVar(varName, value string)
- type AuthToken
- type BDDContext
- func (b *BDDContext) AddPeerConfigToChannel(pconfig *PeerConfig, channelID string)
- func (b *BDDContext) AfterScenario(interface{}, error)
- func (b *BDDContext) BeforeScenario(scenarioOrScenarioOutline interface{})
- func (b *BDDContext) ChannelCreated(channelID string) bool
- func (b *BDDContext) ClientConfig() fabApi.EndpointConfig
- func (b *BDDContext) CollectionConfig(coll string) CollectionConfigCreator
- func (b *BDDContext) Composition() *Composition
- func (b *BDDContext) DefineCollectionConfig(id string, creator CollectionConfigCreator)
- func (b *BDDContext) OrdererOrgID() string
- func (b *BDDContext) OrgChannelClient(org, userType, channelID string) (*channel.Client, error)
- func (b *BDDContext) OrgIDForChannel(channelID string) (string, error)
- func (b *BDDContext) OrgUserContext(org, userType string) contextApi.Client
- func (b *BDDContext) Orgs() []string
- func (b *BDDContext) OrgsByChannel(channelID string) []string
- func (b *BDDContext) PeerConfigForChannel(channelID string) *PeerConfig
- func (b *BDDContext) PeerConfigForChannelAndMsp(channelID string, mspID string) *PeerConfig
- func (b *BDDContext) PeerConfigForID(id string) *PeerConfig
- func (b *BDDContext) PeerConfigForURL(url string) *PeerConfig
- func (b *BDDContext) PeersByChannel(channelID string) []*PeerConfig
- func (b *BDDContext) ResMgmtClient(org, userType string) *resmgmt.Client
- func (b *BDDContext) Sdk() *fabsdk.FabricSDK
- func (b *BDDContext) SetComposition(composition *Composition)
- func (b *BDDContext) SetServiceProviderFactory(factory sdkApi.ServiceProviderFactory)
- type CollectionConfigCreator
- type CollectionType
- type CommonSteps
- func (d *CommonSteps) DefineCollectionConfig(id, name, policy string, requiredPeerCount, maxPeerCount int32, ...)
- func (d *CommonSteps) InvokeCC(ccID, args, channelID string) error
- func (d *CommonSteps) InvokeCCWithArgs(ccID, channelID, clientOrgID string, targets []*PeerConfig, args []string, ...) (channel.Response, error)
- func (d *CommonSteps) InvokeCCWithArgsAsAdmin(ccID, channelID string, targets []*PeerConfig, args []string, ...) (channel.Response, error)
- func (d *CommonSteps) InvokeCConOrg(ccID, args, orgIDs, channelID string) error
- func (d *CommonSteps) OrgPeers(orgIDs, channelID string) Peers
- func (d *CommonSteps) Peers(peerIDs string) (Peers, error)
- func (d *CommonSteps) QueryCCWithArgs(systemCC bool, ccID, channelID, clientOrgID string, args []string, ...) (string, error)
- func (d *CommonSteps) QueryCCWithOpts(systemCC bool, ccID, channelID, clientOrgID string, args []string, ...) (string, error)
- func (d *CommonSteps) RegisterSteps(s *godog.Suite)
- type Composition
- func (c *Composition) Decompose() (string, error)
- func (c *Composition) GenerateLogs() error
- func (c *Composition) GetAPIContainerForComposeService(composeService string) (apiContainer *docker.APIContainers, err error)
- func (c *Composition) GetContainerIDs() (containerIDs []string, err error)
- func (c *Composition) GetIPAddressForComposeService(composeService string) (ipAddress string, err error)
- func (c *Composition) Up() error
- type CustomEndorsementHandler
- type DockerHelper
- type DockerSteps
- type FabCLI
- type HTTPClient
- type HTTPMethod
- type HTTPPath
- type PeerConfig
- type Peers
- type StaticSelectionProviderFactory
Constants ¶
This section is empty.
Variables ¶
var ADMIN = "admin"
ADMIN type
var USER = "user"
USER type
Functions ¶
func FindPKCS11Lib ¶
FindPKCS11Lib find lib based on configuration
func GetByteArgs ¶
GetByteArgs is a utility which converts []string to [][]bytes
func GetChannelAnchorTxPath ¶
GetChannelAnchorTxPath returns path to the channel anchor tx file for the given channel
func GetChannelTxPath ¶
GetChannelTxPath returns path to the channel tx file for the given channel
func GetVar ¶
GetVar gets the value for the given variable Returns true if the variable exists; false otherwise
func HTTPPostFile ¶ added in v0.1.3
HTTPPostFile posts the contents of the given file to the given URL
func HasPrimaryPeerJoinedChannel ¶
func HasPrimaryPeerJoinedChannel(channelID string, client *resmgmt.Client, orgUser mspApi.Identity, peer fabApi.Peer) (bool, error)
HasPrimaryPeerJoinedChannel checks whether the primary peer of a channel has already joined the channel. It returns true if it has, false otherwise, or an error
func IsChaincodeInstalled ¶
IsChaincodeInstalled Helper function to check if chaincode has been deployed
func NewChaincodePolicy ¶
func NewChaincodePolicy(bddCtx *BDDContext, ccPolicy, channelID string) (*fabricCommon.SignaturePolicyEnvelope, error)
NewChaincodePolicy parses the policy string and returns the chaincode policy
func PrintResponse ¶ added in v0.1.3
func Resolve ¶
Resolve resolves all variables within the given arg
Example 1: Simple variable
Given: vars = { "var1": "value1", "var2": "value2", } Then: "${var1}" = "value1" "X_${var1}_${var2} = "X_value1_value2
Example 2: Array variable
Given: vars = { "arr1": "value1,value2,value3", } Then: "${arr1[0]_arr1[1]_arr1[2]}" = "value1_value2_value3"
func ResolveAllVars ¶
ResolveAllVars returns a slice of strings from the given comma-separated string. Each string is resolved for variables. Resolve resolves all variables within the given arg
Example 1: Simple variable
Given: vars = { "var1": "value1", "var2": "value2", } Then: "${var1}" = "value1" "X_${var1}_${var2} = "X_value1_value2
Example 2: Array variable
Given: vars = { "arr1": "value1,value2,value3", } Then: "${arr1[0]_arr1[1]_arr1[2]}" = "value1_value2_value3"
func ResolveVars ¶ added in v0.1.3
func ResolveVars(val interface{}) (interface{}, error)
ResolveVars resolves all variables within the given value. The value may be one of the following types: - string - []interface{} - map[string]interface{} All other types will return with no resolution
func ResolveVarsInExpression ¶ added in v0.1.3
ResolveVars resolves all variables within the given expressions Example:
Given:
var1 = "variable1" var2 = "variable2"
value1 := "This is ${var1}" value2 := "This is ${var2}
err := ResolveVarsInExpression(&value1, &value2)
Result:
value1 = "This is variable1" value2 = "This is variable2"
func SetAuthToken ¶ added in v0.1.3
func SetAuthToken(path HTTPPath, method HTTPMethod, token AuthToken)
SetAuthToken sets the authorization bearer token for the given HTTP path and HTTP method
func SetAuthTokenHeader ¶ added in v0.1.3
SetAuthTokenHeader sets the bearer token in the Authorization header if one is defined for the given request path.
Types ¶
type AuthToken ¶ added in v0.1.3
type AuthToken = string
func GetAuthToken ¶ added in v0.1.3
func GetAuthToken(path HTTPPath, method HTTPMethod) AuthToken
GetAuthToken returns the authorization bearer token for the given HTTP path and HTTP method
type BDDContext ¶
type BDDContext struct {
// contains filtered or unexported fields
}
BDDContext ...
func NewBDDContext ¶
func NewBDDContext(orgs []string, ordererOrgID string, clientConfigFilePath string, clientConfigFileName string, peersMspID map[string]string, systemCCPath, testCCPath string) (*BDDContext, error)
NewBDDContext create new BDDContext
func (*BDDContext) AddPeerConfigToChannel ¶
func (b *BDDContext) AddPeerConfigToChannel(pconfig *PeerConfig, channelID string)
AddPeerConfigToChannel adds a peer to a channel
func (*BDDContext) AfterScenario ¶
func (b *BDDContext) AfterScenario(interface{}, error)
AfterScenario execute code after bdd scenario
func (*BDDContext) BeforeScenario ¶
func (b *BDDContext) BeforeScenario(scenarioOrScenarioOutline interface{})
BeforeScenario execute code before bdd scenario
func (*BDDContext) ChannelCreated ¶
func (b *BDDContext) ChannelCreated(channelID string) bool
ChannelCreated returns true if channel already created
func (*BDDContext) ClientConfig ¶
func (b *BDDContext) ClientConfig() fabApi.EndpointConfig
ClientConfig returns client config
func (*BDDContext) CollectionConfig ¶
func (b *BDDContext) CollectionConfig(coll string) CollectionConfigCreator
CollectionConfig returns the private data collection configuration creator for the given collection name. If the collection configuration does not exist then nil is returned.
func (*BDDContext) Composition ¶
func (b *BDDContext) Composition() *Composition
Composition returns the Docker composition
func (*BDDContext) DefineCollectionConfig ¶
func (b *BDDContext) DefineCollectionConfig(id string, creator CollectionConfigCreator)
DefineCollectionConfig defines a new collection configuration
func (*BDDContext) OrdererOrgID ¶
func (b *BDDContext) OrdererOrgID() string
OrdererOrgID returns orderer org id
func (*BDDContext) OrgChannelClient ¶
func (b *BDDContext) OrgChannelClient(org, userType, channelID string) (*channel.Client, error)
OrgChannelClient returns the org channel client
func (*BDDContext) OrgIDForChannel ¶
func (b *BDDContext) OrgIDForChannel(channelID string) (string, error)
OrgIDForChannel returns a single org ID for the given channel or an error if no orgs are configured for the channel
func (*BDDContext) OrgUserContext ¶
func (b *BDDContext) OrgUserContext(org, userType string) contextApi.Client
OrgUserContext returns the org user context
func (*BDDContext) OrgsByChannel ¶
func (b *BDDContext) OrgsByChannel(channelID string) []string
OrgsByChannel returns the orgs for the given channel
func (*BDDContext) PeerConfigForChannel ¶
func (b *BDDContext) PeerConfigForChannel(channelID string) *PeerConfig
PeerConfigForChannel returns a single peer for the given channel or nil if no peers are configured for the channel
func (*BDDContext) PeerConfigForChannelAndMsp ¶
func (b *BDDContext) PeerConfigForChannelAndMsp(channelID string, mspID string) *PeerConfig
PeerConfigForChannelAndMsp returns a single peer for the given channel and msp or nil if no peers are configured for the channel and msp
func (*BDDContext) PeerConfigForID ¶
func (b *BDDContext) PeerConfigForID(id string) *PeerConfig
PeerConfigForID returns the peer config for the given peer ID or nil if not found
func (*BDDContext) PeerConfigForURL ¶
func (b *BDDContext) PeerConfigForURL(url string) *PeerConfig
PeerConfigForURL returns the peer config for the given URL or nil if not found
func (*BDDContext) PeersByChannel ¶
func (b *BDDContext) PeersByChannel(channelID string) []*PeerConfig
PeersByChannel returns the peers for the given channel
func (*BDDContext) ResMgmtClient ¶
func (b *BDDContext) ResMgmtClient(org, userType string) *resmgmt.Client
ResMgmtClient returns the res mgmt client
func (*BDDContext) SetComposition ¶
func (b *BDDContext) SetComposition(composition *Composition)
SetComposition sets the Docker composition in the context
func (*BDDContext) SetServiceProviderFactory ¶
func (b *BDDContext) SetServiceProviderFactory(factory sdkApi.ServiceProviderFactory)
SetServiceProviderFactory sets the service provider factory for the test
type CollectionConfigCreator ¶
type CollectionConfigCreator func(channelID string) (*pb.CollectionConfig, error)
CollectionConfigCreator creates a collection config for the given channel
type CollectionType ¶
type CollectionType string
type CommonSteps ¶
type CommonSteps struct {
BDDContext *BDDContext
}
CommonSteps contain BDDContext
func NewCommonSteps ¶
func NewCommonSteps(context *BDDContext) *CommonSteps
NewCommonSteps create new CommonSteps struct
func (*CommonSteps) DefineCollectionConfig ¶
func (d *CommonSteps) DefineCollectionConfig(id, name, policy string, requiredPeerCount, maxPeerCount int32, blocksToLive uint64)
DefineCollectionConfig defines a new private data collection configuration
func (*CommonSteps) InvokeCC ¶
func (d *CommonSteps) InvokeCC(ccID, args, channelID string) error
InvokeCC invoke cc
func (*CommonSteps) InvokeCCWithArgs ¶
func (d *CommonSteps) InvokeCCWithArgs(ccID, channelID, clientOrgID string, targets []*PeerConfig, args []string, transientData map[string][]byte) (channel.Response, error)
InvokeCCWithArgs invoke cc with args as regular user
func (*CommonSteps) InvokeCCWithArgsAsAdmin ¶
func (d *CommonSteps) InvokeCCWithArgsAsAdmin(ccID, channelID string, targets []*PeerConfig, args []string, transientData map[string][]byte) (channel.Response, error)
InvokeCCWithArgsAsAdmin invoke cc with args as admin user type
func (*CommonSteps) InvokeCConOrg ¶
func (d *CommonSteps) InvokeCConOrg(ccID, args, orgIDs, channelID string) error
InvokeCConOrg invoke cc on org
func (*CommonSteps) OrgPeers ¶
func (d *CommonSteps) OrgPeers(orgIDs, channelID string) Peers
OrgPeers return array of PeerConfig
func (*CommonSteps) Peers ¶
func (d *CommonSteps) Peers(peerIDs string) (Peers, error)
Peers returns the PeerConfigs for the given peer IDs
func (*CommonSteps) QueryCCWithArgs ¶
func (d *CommonSteps) QueryCCWithArgs(systemCC bool, ccID, channelID, clientOrgID string, args []string, transientData map[string][]byte, targets ...*PeerConfig) (string, error)
QueryCCWithArgs ...
func (*CommonSteps) QueryCCWithOpts ¶
func (d *CommonSteps) QueryCCWithOpts(systemCC bool, ccID, channelID, clientOrgID string, args []string, timeout time.Duration, concurrent bool, interval time.Duration, transientData map[string][]byte, targets ...*PeerConfig) (string, error)
QueryCCWithOpts ...
func (*CommonSteps) RegisterSteps ¶
func (d *CommonSteps) RegisterSteps(s *godog.Suite)
RegisterSteps register steps
type Composition ¶
type Composition struct {
// contains filtered or unexported fields
}
Composition represents a docker-compose execution and management
func NewComposition ¶
func NewComposition(projectName string, composeFilesYaml string, dir string) (*Composition, error)
NewComposition create a new Composition specifying the project name (for isolation) and the compose files, and brings up all containers.
func NewDockerCompose ¶
func NewDockerCompose(projectName, composeFilesYaml string, dir string) (*Composition, error)
NewDockerCompose create a new Composition specifying the project name (for isolation) and the compose files.
func (*Composition) Decompose ¶
func (c *Composition) Decompose() (string, error)
Decompose decompose the composition. Will also remove any containers with the same projectName prefix (eg. chaincode containers)
func (*Composition) GetAPIContainerForComposeService ¶
func (c *Composition) GetAPIContainerForComposeService(composeService string) (apiContainer *docker.APIContainers, err error)
GetAPIContainerForComposeService return the docker.APIContainers with the supplied composeService name.
func (*Composition) GetContainerIDs ¶
func (c *Composition) GetContainerIDs() (containerIDs []string, err error)
GetContainerIDs returns the container IDs for the composition (NOTE: does NOT include those defined outside composition, eg. chaincode containers)
func (*Composition) GetIPAddressForComposeService ¶
func (c *Composition) GetIPAddressForComposeService(composeService string) (ipAddress string, err error)
GetIPAddressForComposeService returns the IPAddress of the container with the supplied composeService name.
type CustomEndorsementHandler ¶
type CustomEndorsementHandler struct {
// contains filtered or unexported fields
}
CustomEndorsementHandler ignores the channel in the ClientContext and instead sends the proposal to the given channel
func NewCustomEndorsementHandler ¶
func NewCustomEndorsementHandler(context contextApi.Client, next invoke.Handler) *CustomEndorsementHandler
NewCustomEndorsementHandler creates a new instance of CustomEndorsementHandler
func (*CustomEndorsementHandler) Handle ¶
func (h *CustomEndorsementHandler) Handle(requestContext *invoke.RequestContext, clientContext *invoke.ClientContext)
Handle handles an endorsement proposal
type DockerHelper ¶
type DockerHelper interface { GetIPAddress(containerID string) (string, error) RemoveContainersWithNamePrefix(namePrefix string) error }
DockerHelper helper for docker specific functions
func NewDockerCmdlineHelper ¶
func NewDockerCmdlineHelper() (DockerHelper, error)
NewDockerCmdlineHelper returns a new command line DockerHelper instance
type DockerSteps ¶
type DockerSteps struct {
BDDContext *BDDContext
}
DockerSteps manages Docker BDD steps
func NewDockerSteps ¶
func NewDockerSteps(context *BDDContext) *DockerSteps
NewDockerSteps returns the Docker steps
func (*DockerSteps) RegisterSteps ¶
func (d *DockerSteps) RegisterSteps(s *godog.Suite)
RegisterSteps register steps
type FabCLI ¶
type FabCLI struct { }
FabCLI is used to invoke the Fabric CLI command-line tool
type HTTPClient ¶ added in v0.1.4
type HTTPClient struct { }
type HTTPMethod ¶ added in v0.1.3
type HTTPMethod = string
type PeerConfig ¶
type PeerConfig struct { OrgID string Config fabApi.PeerConfig MspID string PeerID string }
PeerConfig holds the peer configuration and org ID
type StaticSelectionProviderFactory ¶
type StaticSelectionProviderFactory struct {
defsvc.ProviderFactory
}
StaticSelectionProviderFactory uses a static selection service that doesn't use CC policies. (Required for System CC invocations.)
func (*StaticSelectionProviderFactory) CreateChannelProvider ¶
func (f *StaticSelectionProviderFactory) CreateChannelProvider(config fabApi.EndpointConfig) (fabApi.ChannelProvider, error)
CreateChannelProvider creates a mock ChannelProvider