From cd525f8ab11068a16b93035599887d8a8e4146d6 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Wed, 31 Jan 2018 22:21:00 +0100 Subject: add testing scripts based on github.com/bouncestorage/docker-swift --- CONTRIBUTING.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 CONTRIBUTING.md (limited to 'CONTRIBUTING.md') 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`. -- cgit v1.2.3