lab is fundamentally a workflow tool; we don't add features just to cover the API. Instead, we add them to support and improve our cli workflows, which we want to flow seamlessly and feel intuitive and natural.
lab runs integration tests in addition to unit tests. The integration tests run against gitlab.com. We are willing to trade some test autonomy and speed in exchange for 100% guarantees that features work against a live GitLab API. Integration tests are largely identified as tests which execute the ./lab.test
binary. There are two primary projects used for these integration tests: zaquestion/test and lab-testing/test.
New to Go? Check out the Go docs on How to Write Go Code for some background on Go coding conventions, many of which are used by lab.
To run the lab tests, you will need:
go
andgit
must be installed (optionallymake
)- A gitlab.com account configured with an SSH key. If you can push and pull from gitlab.com remotes, you're probably all set.
- The
GOPATH
environment variable needs to be explicitly set. (egexport GOPATH=$(go env GOPATH)
) - Add
$GOPATH/bin
to your$PATH
. - The
GO111MODULE
environment variable needs to be set toon
. (egexport GO111MODULE=on
) - The tests assume that the lab source repo is located in
$GOPATH/src/github.com/zaquestion/lab
Tests can be run via make test
:
$ cd $GOPATH/src/github.com/zaquestion/lab
# run all tests
$ make test
# run only tests matching "pattern"
$ make test run=pattern
or with go test
:
$ cd $GOPATH/src/github.com/zaquestion/lab
$ GO111MODULE=on go test ./cmd ./internal/...