Developing

Testing

Gollum provides unit-, integrations- and a couple of linter tests which also runs regulary on travis-ci.

You can run the test by:

# run tests
make test

# run unit-test only
make unit

# run integration-test only
make integration

Here an overview of all provided tests by the Makefile:

make test:Run go vet, golint, gofmt and go test
make unit:Run go test -tags unit
make integration:
 Run go test -tags integration
make vet:Run go vet
make lint:Run golint
make fmt-check:Run gofmt -l
make ineffassign:
 Install and run ineffassign

Debugging

If you want to use Delve for debugging you need to build gollum with some additional flags. You can use the predefined make command make debug:

# build for current OS with debug compiler flags
make debug

# or go build
# go build -ldflags='-s -linkmode=internal' -gcflags='-N -l'

With this debug build you are able to start a Delve remote debugger:

# for the gollum arguments pls use this format: ./gollum -- -c my/config.conf
dlv --listen=:2345 --headless=true --api-version=2 --log exec ./gollum -- -c testing/configs/test_router.conf -ll 3

Profiling

To test Gollum you can use the internal profiler consumer and the benchmark producer.

By some optional parameters you can get further additional information:

-ps:Profile the processed message per second.
-ll 3:Set the log level to debug
-m 8080:Activate metrics endpoint on port 8080

Here a simple config example how you can setup a profiler consumer with a benchmark producer. By default this test profiles the theoretic maximum throughput of 256 Byte messages:

Profiler:
    Type: consumer.Profiler
    Runs: 100000
    Batches: 100
    Message: "%256s"
    Streams: profile
    KeepRunning: true

Benchmark:
    Type: producer.Benchmark
    Streams: profile
# start Gollum for profiling
gollum -ps -ll 3 -m 8080 -c config/profile.conf

# get metrics
nc -d 127.0.0.1 8080 | python -m json.tool

You can enable different producers in that config to test the write performance of these producers, too.

Dependencies

To handle external go-packages and -libraries Gollum use dep. Like in other go projects the vendor is also checked in on github.com. All dependencies can be found in the Gopkg.toml file.

To update the external dependencies we provide also a make command:

# update external dependencies
make update-vendor