Giter Site home page Giter Site logo

cloudfoundry-attic / cf-swagger Goto Github PK

View Code? Open in Web Editor NEW
21.0 6.0 8.0 5.52 MB

Collection of Swagger descriptions and applications for CloudFoundry BOSH

License: Apache License 2.0

CSS 0.17% HTML 5.78% Shell 5.29% Go 88.77%
cloudfoundry cf-extensions swagger

cf-swagger's Introduction

CF-Swagger Build Status Join the chat at https://gitter.im/cloudfoundry-incubator/cf-swagger

Collection of Swagger descriptions and applications for CloudFoundry APIs.

This tool is licensed under the Apache 2.0 OSS license. We'd love to hear from you if you are using, attempting to use, or planning to use this tool.

Two additional ways, besides Gitter or Slack chat above, to contact us:

  1. Feel free to open an issue (good or bad) here on Github.
  2. Send email to cloudfoundry.swagger at the Gmail domain.

Getting Started


Overview Presentations, Talks, Blogs


  • Overview presentation on September 16th, 2015. Slides (PDF and PPTX), video

Getting Started


Assuming you have a valid Golang 1.4.2 or later installed for your system, you can quickly get the version that we are using for go-swagger. This version is on Github. This is an extension of go-swagger. You can use the bin/build file to generate the binary or directly use our swagger binary from out folder.

The tests that we are generating are tested on Go Service Broker. You need to follow the steps indicated in the README.md of the project to build the broker and then run it.

Cloning and Building


Clone this repo and build it. Using the following commands on a Linux or Mac OS X system:

$ mkdir -p cf-swagger/src/github.com/maximilien
$ export GOPATH=$(pwd)/cf-swagger:$GOPATH
$ cd cf-swagger/src/github.com/maximilien
$ git clone https://github.com/maximilien/cf-swagger.git
$ cd cf-swagger
$ ./bin/build

NOTE: if you get any dependency errors, then use go get path/to/dependency to get it, e.g., go get github.com/onsi/ginkgo and go get github.com/onsi/gomega

Generating and Running Tests


You should generate the tests using the last API specification JSON file. You can do this with: $ ./bin/generate_service_broker_test in your cloned repository. This assumes that you already cloned and built go-swagger.

The output should be similar to:

$ ./bin/generate_service_broker_test
Swagger generating code
======>  Adding TCK To TEST
2015/09/17 17:30:03 rendered tck template: operationstck_reporter
2015/09/17 17:30:03 rendered suite test template: operationsServiceBroker_suite_test
2015/09/17 17:30:03 rendered test template: createServiceInstance
2015/09/17 17:30:03 rendered test template: serviceBind
2015/09/17 17:30:03 rendered test template: updateServiceInstance
2015/09/17 17:30:03 rendered test template: deprovisionServiceInstance
2015/09/17 17:30:04 rendered test template: serviceUnbind
2015/09/17 17:30:04 rendered test template: catalog
/Users/mohamed/Documents/git/swagger-bosh/src/github.com/maximilien/cf-swagger

 Formatting packages...

Running TCK


You should run the tests against a service broker (we used Go Service Broker), do this with: $ ./bin/run_service_broker_test in your cloned repository.

The end of the output should be similar to:

$ ./bin/run_service_broker_test

...

Tck Compliance v2.6: 100.00 %!
(MISSING)Cause(s) of the failure

Tck Compliance v2.5: 100.00 %!
(MISSING)PASS | FOCUSED

Ginkgo ran 1 suite in 2m31.720074275s
Test Suite Passed

You can modify the go_service_broker code to make it non compliant with v2.6 for testing purpose (making app_id required in bind method for example). You should build the broker again and restart it. Running the same test again will give the following output:

$ ./bin/run_service_broker_test

...

Tck Compliance v2.6: 97.14 %!
(MISSING)Cause(s) of the failure
#serviceBind when service...

Tck Compliance v2.5: 100.00 %!
(MISSING)PASS | FOCUSED

Ginkgo ran 1 suite in 1m31.720074275s
Test Suite Failed

In order to quickly have the test pass, you can start by focusing on createService test, then bind service test. Other parts are being enhanced.

Troubleshooting / FAQs


None for now. Submit questions/comments as issues and we will update here

Filing Bugs


For simple bugs (eg: text formatting, help messages, etc), please provide
  • the command options you ran
  • what occurred
  • what you expected to occur
For panics and other crashes, please provide
  • the command you ran
  • the stack trace generated (if any)
  • any other relevant information

Cloning the repository


  1. Install Go
  2. Clone (Forking beforehand for development).
  3. Ensure your $GOPATH is set correctly

Building


  1. Run ./bin/build
  2. The binary will be built into the ./out directory

Optionally, you can use bin/run to compile and run the executable in one step.

Developing


  1. Run go get golang.org/x/tools/cmd/vet
  2. Run go get github.com/xxx ... to install test dependencies (as you see errors)
  3. Write a Ginkgo test
  4. Run bin/test and watch the test fail
  5. Make the test pass
  6. Submit a pull request

Contributing


  • We gratefully acknowledge and thank the current contributors
  • We welcome any and all contributions as Pull Requests (PR)
  • We also welcome issues and bug report and new feature request. We will address as time permits
  • Follow the steps above in Developing to get your system setup correctly
  • Please make sure your PR is passing Travis before submitting
  • Feel free to email me or the current collaborators if you have additional questions about contributions
  • Before submitting your first PR, please read and follow steps in CONTRIBUTING.md

Managing dependencies


Short godep Guide

  • If you ever import a new package foo/bar (after you go get foo/bar, so that foo/bar is in $GOPATH), you can type godep save ./... to add it to the Godeps directory.
  • To restore dependencies from the Godeps directory, simply use godep restore. restore is the opposite of save.
  • If you ever remove a dependency or a link becomes deprecated, the easiest way is probably to remove your entire Godeps directory and run godep save ./... again, after making sure all your dependencies are in your $GOPATH. Don't manually edit Godeps.json!
  • To update an existing dependency, you can use godep update foo/bar or godep update foo/... (where ... is a wildcard)
  • The godep project readme is a pretty good resource: https://github.com/tools/godep

Current conventions


  • Basic Go conventions
  • Strict TDD for any code added or changed
  • Go fakes when needing to mock objects

(*) these items are in the works, we will remove the * once they are available

cf-swagger's People

Contributors

avade avatar christopherclark avatar maximilien avatar midoblgsm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cf-swagger's Issues

CF API V3

Now that we have CF API V3, is there a swagger description for it?

outdated cf service broker api 2.5

Latest cf service broker api is 2.8, introducing important feature as async sevice provisionning. This lag defaet the purpose of broker tck.
Any plan for update ?

Moving SB API Swagger definition to OSBAPI repo?

How would y'all feel about the OSBAPI [1] community owning the swagger definition for the Service Broker API? This would allow it to be easily kept up to date with the latest spec changes.

The proposal would be to move this definition to the OSBAPI repo. We discussed on our working group call today and the consensus amongst those on the call was this would be a good addition to the project.

Before we share this idea with the wider OSBAPI group, I thought I would check to see if this is of interest.

cc @maximilien @duglin

[1] https://github.com/openservicebrokerapi/servicebroker

Two limitations found during use of generating acceptance test for our service broker

Thanks for your contribution to this great project. We are really interested in using it for writing automatic acceptance and integration test.

After a preliminary use of cf-swagger for generating acceptance test for our cloud foundry service broker, we have found some limitations as follows:

  • Our service broker requires authorization for access which is currently not easy to be specified.
    Maybe it could be enabled by add request.SetBasicAuth("username", "password") in utils/server_utils.go which could take the username and password from configure json file.
  • The broker server url and port is hardcoded instead of being taken from the json file of service broker

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.