The goal of this project is to create a super-simple load generation testing framework for quickly and easily running load against Cloud Foundry.
Ensure your Cloud Foundry version is current and running
-
Clone the project
git clone https://github.com/julz/pat
-
Push the project to Cloud Foundry with the 'go' buildpack
cf push -b https://github.com/jberkhahn/cloudfoundry-buildpack-go pat
-
Open the browser and go to the provided URL
To setup this project, a number of requires need to be met for GO.
-
Ensure that GO1.2 (64bit version) has been installed on the system.
-
Setup the GOPATH
export GOPATH=~/go (or any other workspace repository for all your go code) export PATH=$GOPATH/bin:$PATH
-
Install [gocart] (https://github.com/vito/gocart)
go get github.com/vito/gocart
-
Clone the project to the correct location
mkdir -p $GOPATH/src/github.com/julz cd $GOPATH/src/github.com/julz git clone https://github.com/julz/pat cd pat gocart
-
Install [gcf] (https://github.com/cloudfoundry/cli)
To develop for this project, you will first need to go through the "Setting up PATs" section. This project will be maintained through the use of standard pull requests. When issuing a pull request, make sure to include sufficient testing through the ginkgo package (see below) to go along with any code changes. The tests should document functionality and provide an example of how to use it.
-
Go through the "Setting up GO" section
-
Install [ginkgo] (http://onsi.github.io/ginkgo/#getting_ginkgo)
go install github.com/onsi/ginkgo/ginkgo
-
Write and test your code following the ginkgo standards
-
Run all tests within the repository
If you wish to run PATs as a Cloud Foundry app, please refer to the section in the beginning of this guide.
To run this project, you will first need to go the "Setting up PATs" section. Afterwards, you can change into the pat directory and run:
-
Go through the "Setting up Go" section
-
Make sure that you have targeted a cloud foundry environment from the gcf tool (# gcf login)
There are 3 options to run PATs locally:
- Run the source code directly. 2) Compile and run an executable. 3) Run PATs with a web user interface.
- Option 1
change into the top level of this project
cd $GOPATH/src/github.com/julz/pat
execute the command line
go run main.go -workload gcf:push
- Option 2
Change into the main directory
cd $GOPATH/src/github.com/julz/pat/
go install
Run PATs executable from the command line
pat
- Option 3
Run PATs as an HTTP server with web user interface
go run main.go -server
(open browser and goto http://localhost:8080)
Example calls:
pat -h # will output all of the command line options if installed the recommended way
pat -concurrency=5 -iterations=5 # This will start 5 concurrent threads all pushing 1 application
pat -concurrency=5 -iterations=1 # This will only spawn a single concurrent thread instead of the 5 you requested because you are only pushing a single application
pat -silent # if you don't want all the fancy output use the silent flag
pat -workload=gcf:push,gcf:push,... #list the gcf operations you want to run
pat -workload=dummy # run the tool with dummy operations (not against a CF environment)
pat -config=config/template.yml # include a configuration template specifying any number of command line arguments. The template file provides a basic format.
## Using the REST api:
go run pat/main.go -rest:target http://api.xyz.abc.net \
-rest:username=ibmtestuser1@us.ibm.com \
-rest:password=PASSWORD \
-workload rest:login,rest:push,rest:push,rest:push \
-concurrency=10 -iterations=50
PATs currently accepts the ability to configure any command line argument via a configuration script. There is an example script at the root of this projects directory called config-template.yml and it details the current operations. To run a custom yaml configuration file, provide the full path to the configuration file. Also, if a user so wishes they can overwrite a seeting in the script by using the command line argument.
example:
# pat -config=config-template.yml
# pat -config=config-template.yml -iterations=2 //set iterations to 2 even if the script has something else.