pezinventory

command module
v0.0.0-...-5601fd7 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2015 License: Apache-2.0, GPL-2.0 Imports: 3 Imported by: 0

README

wercker status

Pez Inventory Service

The inventory capability of Pez.

Configure for local development

Clone this repo and navigate to the project root.

$ cd $GOPATH/src/github.com/pivotal-pez
$ git clone https://github.com/pivotal-pez/pezinventory.git && cd pezinventory

Run the init_developer_environment script to copy the files from the samples directory into a local_wercker_configs directory in your project root.

$ ./init_developer_environment

Configure and start a local docker environment. If you already have docker configured locally, you can safely ignore these next steps. The following steps show how to install and configure docker-machine. All subsequent instructions will assume you are using docker-machine for your local docker environment.

$ brew update
$ brew install docker-machine
$ docker-machine create --driver virtualbox dev
$ eval "$(docker-machine env dev)"
$ docker-machine ip dev
192.168.99.100

Update local_wercker_configs/myenv with the IP address of your docker host.

...

# Local DOCKER IP Address
X_DOCKER_IP=192.168.99.100

The environment should now be configured sufficiently to execute locally.

To run the wercker pipeline locally:

$ ./testrunner

This will execute the wercker pipeline and then exit. You should see the results of unit tests, integration tests, linting, and coverage analysis.

Example:
--> Running step: wercker-init
--> Running step: setup-go-workspace
package-dir option not set, will use default: /gopath/src/github.com/pivotal-pez/pezinventory
$WERCKER_SOURCE_DIR now points to: /gopath/src/github.com/pivotal-pez/pezinventory
Go workspace setup finished
--> Running step: golint
service/inventory.go:45:3: can probably use "var items []RedactedInventoryItem" instead
service/inventory.go:130:50: func parameter leaseId should be leaseID
--> Running step: go get
go version go1.4 linux/amd64
--> Running step: go unit tests
?   	github.com/pivotal-pez/pezinventory	[no test files]
=== RUN TestInventory
Running Suite: Pez Inventory Suite
==================================
Random Seed: 1442329508
Will run 5 of 5 specs

•••••
Ran 5 of 5 Specs in 0.009 seconds
SUCCESS! -- 5 Passed | 0 Failed | 0 Pending | 0 Skipped --- PASS: TestInventory (0.01s)
PASS
ok  	github.com/pivotal-pez/pezinventory/service	0.045s
?   	github.com/pivotal-pez/pezinventory/service/fakes	[no test files]
?   	github.com/pivotal-pez/pezinventory/service/integrations	[no test files]
--> Running step: go integration test
=== RUN TestOsutils
Running Suite: Pez Dispenser Suite
==================================
Random Seed: 1442329511
Will run 6 of 6 specs

[negroni] Started GET /v1/inventory
[negroni] Completed 200 OK in 652.924µs
•[negroni] Started POST /v1/inventory
[negroni] Completed 200 OK in 24.057341ms
•[negroni] Started GET /v1/inventory
[negroni] Completed 200 OK in 1.057174ms
•[negroni] Started POST /v1/leases
[negroni] Completed 200 OK in 2.931449ms
•[negroni] Started GET /v1/leases/55f833a759d11100b0000002
[negroni] Completed 200 OK in 710.381µs
•[negroni] Started POST /v1/leases
[negroni] Completed 404 Not Found in 1.784894ms
•
Ran 6 of 6 Specs in 0.061 seconds
SUCCESS! -- 6 Passed | 0 Failed | 0 Pending | 0 Skipped --- PASS: TestOsutils (0.06s)
PASS
ok  	github.com/pivotal-pez/pezinventory/service/_tests	0.124s
--> Running step: go test cover
? github.com/pivotal-pez/pezinventory [no test files]
ok github.com/pivotal-pez/pezinventory/service 0.012s coverage: 22.3% of statements
22.3
Coverage - 22%
Watermark- %
? github.com/pivotal-pez/pezinventory/service/fakes [no test files]
? github.com/pivotal-pez/pezinventory/service/integrations [no test files]
--> Running step: build the server binary
--> Running step: add repo to artifact
--> Steps passed
--> Pipeline finished

Note: The initial run will take some time as the docker containers will be downloaded from dockerhub. Subsequent calls will execute more quickly.

To deploy the application locally

$ ./runlocaldeploy local_wercker_configs/myenv

This will run a different wercker pipeline, governed by the files in local_wercker_configs. As it is configured by default, this, too, will run the unit & integration tests, linting, and coverage analysis. However, this can be easily changed by editing wercker_local_deploy.yml.

The runlocaldeploy command differs from testrunner in that it will start the server and leave it running so that you can interact with it. It publishes the server on the docker host IP address on port 80.

...

--> Step passed: build the server binary
--> Running step: watch
set +e
PORT=80 ./main

[negroni] listening on :80

With the server now running you can interact with it using your docker host IP.

$ docker-machine ip dev
192.168.99.100
$ curl http://192.168.99.100/v1/inventory
{
  "status": "success",
  "data": []
}

Documentation

Overview

@APIVersion 1.0.0 @APITitle Pez Inventory @APIDescription Inventory capability for Pez @SubApi Inventory [/v1/inventory] @SubApi Lease [/v1/leases]

Directories

Path Synopsis
Godeps
_workspace/src/github.com/cloudfoundry-community/go-cfenv
Package cfenv provides information about the current app deployed on Cloud Foundry, including any bound service(s).
Package cfenv provides information about the current app deployed on Cloud Foundry, including any bound service(s).
_workspace/src/github.com/codegangsta/negroni
Package negroni is an idiomatic approach to web middleware in Go.
Package negroni is an idiomatic approach to web middleware in Go.
_workspace/src/github.com/gorilla/context
Package context stores values shared during a request lifetime.
Package context stores values shared during a request lifetime.
_workspace/src/github.com/gorilla/mux
Package gorilla/mux implements a request router and dispatcher.
Package gorilla/mux implements a request router and dispatcher.
_workspace/src/github.com/mitchellh/mapstructure
The mapstructure package exposes functionality to convert an abitrary map[string]interface{} into a native Go structure.
The mapstructure package exposes functionality to convert an abitrary map[string]interface{} into a native Go structure.
_workspace/src/github.com/onsi/ginkgo
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
_workspace/src/github.com/onsi/ginkgo/config
Ginkgo accepts a number of configuration options.
Ginkgo accepts a number of configuration options.
_workspace/src/github.com/onsi/ginkgo/ginkgo
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
_workspace/src/github.com/onsi/ginkgo/internal/remote
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
_workspace/src/github.com/onsi/ginkgo/reporters
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
_workspace/src/github.com/onsi/gomega
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
_workspace/src/github.com/onsi/gomega/format
Gomega's format package pretty-prints objects.
Gomega's format package pretty-prints objects.
_workspace/src/github.com/onsi/gomega/gbytes
Package gbytes provides a buffer that supports incrementally detecting input.
Package gbytes provides a buffer that supports incrementally detecting input.
_workspace/src/github.com/onsi/gomega/gexec
Package gexec provides support for testing external processes.
Package gexec provides support for testing external processes.
_workspace/src/github.com/onsi/gomega/ghttp
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
_workspace/src/github.com/onsi/gomega/matchers
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
_workspace/src/github.com/pivotal-pez/cfmgo
A MongoDB integration package for Cloud Foundry.
A MongoDB integration package for Cloud Foundry.
_workspace/src/github.com/pivotal-pez/cfmgo/params
Params will extract query parameters from the query string of a request into a RequestParams object.
Params will extract query parameters from the query string of a request into a RequestParams object.
_workspace/src/github.com/pivotal-pez/cfmgo/wrap
Wrap is a simple helper to wrap API response data and errors in a consistent structure.
Wrap is a simple helper to wrap API response data and errors in a consistent structure.
_workspace/src/github.com/rs/cors
Package cors is net/http handler to handle CORS related requests as defined by http://www.w3.org/TR/cors/ You can configure it by passing an option struct to cors.New: c := cors.New(cors.Options{ AllowedOrigins: []string{"foo.com"}, AllowedMethods: []string{"GET", "POST", "DELETE"}, AllowCredentials: true, }) Then insert the handler in the chain: handler = c.Handler(handler) See Options documentation for more options.
Package cors is net/http handler to handle CORS related requests as defined by http://www.w3.org/TR/cors/ You can configure it by passing an option struct to cors.New: c := cors.New(cors.Options{ AllowedOrigins: []string{"foo.com"}, AllowedMethods: []string{"GET", "POST", "DELETE"}, AllowCredentials: true, }) Then insert the handler in the chain: handler = c.Handler(handler) See Options documentation for more options.
_workspace/src/github.com/unrolled/render
Package render is a package that provides functionality for easily rendering JSON, XML, binary data, and HTML templates.
Package render is a package that provides functionality for easily rendering JSON, XML, binary data, and HTML templates.
_workspace/src/gopkg.in/mgo.v2
Package mgo offers a rich MongoDB driver for Go.
Package mgo offers a rich MongoDB driver for Go.
_workspace/src/gopkg.in/mgo.v2/bson
Package bson is an implementation of the BSON specification for Go: http://bsonspec.org It was created as part of the mgo MongoDB driver for Go, but is standalone and may be used on its own without the driver.
Package bson is an implementation of the BSON specification for Go: http://bsonspec.org It was created as part of the mgo MongoDB driver for Go, but is standalone and may be used on its own without the driver.
_workspace/src/gopkg.in/mgo.v2/internal/scram
Pacakage scram implements a SCRAM-{SHA-1,etc} client per RFC5802.
Pacakage scram implements a SCRAM-{SHA-1,etc} client per RFC5802.
_workspace/src/gopkg.in/mgo.v2/testserver
WARNING: This package was replaced by mgo.v2/dbtest.
WARNING: This package was replaced by mgo.v2/dbtest.
_workspace/src/gopkg.in/mgo.v2/txn
The txn package implements support for multi-document transactions.
The txn package implements support for multi-document transactions.

Jump to

Keyboard shortcuts

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