Skip to content

Hacking Guide

lni edited this page Jan 5, 2019 · 2 revisions

Hacking Guide

Running tests

To run a selected test say in internal/raft

TEST_TO_RUN=TestObserverWillNotVoteInElection make test-raft

Run tests with race detector enabled

RACE=1 TEST_TO_RUN=TestObserverWillNotVoteInElection make test-raft

Running monkey tests

We use 22 cores 2.8GHz Xeon servers each with 64G memory for running monkey tests. See doc/test.md for more details on our monkey tests.

On a Linux machine, first create a 14G RAMDISK using tmpfs

sudo mount -t tmpfs -o size=14000M tmpfs /media/drummermt-ramdisk-test

Deploy the monkey test binaries to the RAMDISK and start running tests.

cd $GOPATH/github.com/lni/dragonboat/scripts/ramdisk_mt
./monkey_testing.sh deploy 64
./monkey_testing.sh start 64

The commands above will start 64 instances each hosting 128 raft groups. Each iteration takes about 30 minutes and by default 100 iterations are scheduled.

When running monkey tests, you can check its progress -

cd /media/drummermt-ramdisk-test/
./rdttools.sh progress

and unexpected error in there is any

./rdttools.sh error

Reduce the number of monkey tests instances when there is less core count or memory on your server.

When testing your changes

  • please add tests to cover your changes
  • make sure your changes doesn't break any existing tests, fix them if you believe they are no longer valid.
  • run monkey tests
Clone this wiki locally