bddtests

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

README

Welcome to the Behavioral Driven Development (BDD) subsytem for Fabric

Developers will find these mechanisms useful for both exploratory and verification purposes.

Getting started

Installation
Setup python virtual environment wrapper usage
    sudo pip install virtualenv
    sudo pip install virtualenvwrapper
    export WORKON_HOME=~/Envs
    source /usr/local/bin/virtualenvwrapper.sh
Setup your virtual environment for behave

Virtual Environment Guide

    mkvirtualenv -p /usr/bin/python2.7 behave_venv

This will automaticall switch you to the new environment if successful. In the future, you can switch to the virtual environment using the workon command as shown below.

    workon behave_venv
Now install required modules into the virtual environment

NOTE: If you have issues installing the modules below, and you are running the vagrant environment, consider performing a vagrant destroy followed by a vagrant up.

    pip install behave
    pip install grpcio-tools
    pip install "pysha3==1.0b1"
    pip install b3j0f.aop
    pip install jinja2
    # The pyopenssl install gives errors, but installs succeeds
    pip install pyopenssl
    pip install ecdsa
    pip install python-slugify
    pip install pyyaml
Running behave
Peer Executable and Docker containers

Behave requires the peer executable for packaging deployments. To make the peer execute the following command.

#Change to the root fabric folder to perform the following commands.
cd ..

# Optionally perform the following clean if you are unsure of your environments state.
make clean
make peer

The peer executable will be located in the build/bin folder. Make sure that your PATH enviroment variable contains the location. Execute the following command if necessary.

    export PATH=$PATH:$GOPATH/src/github.com/hyperledger/fabric/build/bin

The behave system also uses several docker containers. Execute the following commands to create the required docker containers.

    make peer-docker
    make orderer-docker

Change back to the bddtests folder (Where this readme is located) to execute subsequent behave commands.

    cd bddtests
Running all of the behave features and suppressing skipped steps (-k)

The following behave commands should be executed from within this folder.

    behave -k -D cache-deployment-spec
Running a specific feature
    behave -k -D cache-deployment-spec features/bootstrap.feature
Deactivating your behave virtual environment

Once you are done using behave and you wish to switch back to your normal python environment, issue the following command.

    deactivate

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FeatureContextBootstrap

func FeatureContextBootstrap(bddCtx *BDDContext, s *godog.Suite)

FeatureContextBootstrap setup the FeatureContext for bootstrap steps

func NewGrpcClient

func NewGrpcClient(peerAddress string) (*grpc.ClientConn, error)

NewGrpcClient return a new GRPC client connection for the specified peer address

Types

type BDDContext

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

BDDContext represents the current context for the executing scenario. Commensurate concept of 'context' from behave testing.

func (*BDDContext) GetArgsForUser

func (b *BDDContext) GetArgsForUser(cells []*gherkin.TableCell, userRegistration *UserRegistration) (args []string, err error)

GetArgsForUser will return an arg slice of string allowing for replacement of parameterized values based upon tags for userRegistration

func (*BDDContext) GetUserRegistration

func (b *BDDContext) GetUserRegistration(enrollID string) (*UserRegistration, error)

GetUserRegistration return the UserRegistration for a given enrollID

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) (composition *Composition, err error)

NewComposition create a new Composition specifying the project name (for isolation) and the compose files.

func (*Composition) Decompose

func (c *Composition) Decompose() (output string, err 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 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 KeyedProposalResponse

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

KeyedProposalResponse the response for an endorsement for internal usage in maps

type KeyedProposalResponseMap

type KeyedProposalResponseMap map[string]*KeyedProposalResponse

KeyedProposalResponseMap map of composeServices to KeyedProposalResponse

type UserRegistration

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

UserRegistration represents a user in the peer network

func (*UserRegistration) GetChaincodeDeploymentSpec

func (u *UserRegistration) GetChaincodeDeploymentSpec(tagName string) (spec *pb.ChaincodeDeploymentSpec, err error)

GetChaincodeDeploymentSpec returns a ChaincodeDeploymentSpec for the supplied tag name (uses type assertion). Fails if not of expected type.

func (*UserRegistration) GetChaincodeSpec

func (u *UserRegistration) GetChaincodeSpec(tagName string) (ccSpec *pb.ChaincodeSpec, err error)

GetChaincodeSpec returns a chaincode spec for the supplied tag name (uses type assertion). Fails if not of expected type.

func (*UserRegistration) GetKeyedProposalResponseDict

func (u *UserRegistration) GetKeyedProposalResponseDict(tagName string) (result KeyedProposalResponseMap, err error)

GetKeyedProposalResponseDict returns a KeyedProposalResponseMap for the supplied tag name (uses type assertion). Fails if not of expected type.

func (*UserRegistration) GetProposal

func (u *UserRegistration) GetProposal(tagName string) (result *pb.Proposal, err error)

GetProposal returns a Proposal for the supplied tag name (uses type assertion). Fails if not of expected type.

func (*UserRegistration) GetTagValue

func (u *UserRegistration) GetTagValue(tagName string) (interface{}, error)

GetTagValue returns a tag value for the user given the supplied tag name

func (*UserRegistration) SetTagValue

func (u *UserRegistration) SetTagValue(tagName string, tagValue interface{}) (interface{}, error)

SetTagValue sets the tag value for the user given the supplied tag name. Fails if tag name already used.

Directories

Path Synopsis
regression

Jump to

Keyboard shortcuts

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