diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2018-01-31 22:21:00 +0100 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2018-01-31 22:21:00 +0100 |
| commit | cd525f8ab11068a16b93035599887d8a8e4146d6 (patch) | |
| tree | f87617dab51afc193509001841d33f315f793476 /CONTRIBUTING.md | |
| parent | 447267b24f921f9640eea14a59997fda37e271b0 (diff) | |
| download | go-schwift-cd525f8ab11068a16b93035599887d8a8e4146d6.tar.gz | |
add testing scripts based on github.com/bouncestorage/docker-swift
Diffstat (limited to 'CONTRIBUTING.md')
| -rw-r--r-- | CONTRIBUTING.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..96ae415 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Coding style + +Before submitting a pull request: + +- Please format your code with `gofmt` or `goimports`. +- Please fix warnings generated by `golint` and `go vet`. +- When changing the API, run `godoc -http=:6060`, point your browser to + http://localhost:6060/pkg/github.com/majewsky/schwift and check how your documentation looks. + +As a general rule of thumb, we prefer idiomatic Go code as described in: + +- [Effective Go](https://golang.org/doc/effective_go.html) +- [Collected Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments) + +# Running the unit tests + +The unit tests require a Swift server (duh). + +## Using a Swift cluster + +The preferred option is a regular Swift deployment: Run `go test` with the same authentication variables that you give +to the official `swift` client: + +- for Swift inside an OpenStack cluster: `OS_AUTH_URL`, `OS_USERNAME`, `OS_PASSWORD`, etc. +- for Swift using its builtin authentication: `ST_AUTH`, `ST_USER`, `ST_KEY` + +## Using a Swift All-in-One container + +If you don't have a Swift deployment at your disposal where you're running the unit tests, you can use the scripts in +the [`testing` subdirectory](./testing/) to run a Swift all-in-one (SAIO) [development setup in a Docker +container](https://github.com/bouncestorage/docker-swift). + +1. Run `./testing/start-saio.sh` to start the SAIO container (possibly with `sudo` if your user is not in the `docker` + group). Once that has come up successfully, press Ctrl-C to get back to your terminal prompt; the SAIO container will + continue running. + +2. Run the tests with `./testing/with-saio.sh go test`. The script will find how to access the Swift API inside the + container, and configure the auth environment variables accordingly. You can use this with any command that requires + Swift credentials, e.g. `./testing/with-saio.sh swift stat`. |
