Skip to content

Setup for Dev and Test

Alex edited this page Jan 8, 2017 · 25 revisions

Prerequisites

Install all necessary components. Please follow this instructions.

Download the project repo

Clone the repository to your src tree of your $GOPATH

  mkdir -p $GOPATH/src/github.com
  cd $GOPATH/src/github.com
  git clone https://github.com/eywa.git

Build the project

  go build -a

Set EYWA_HOME environment variable

  export EYWA_HOME=$GOPATH/src/github.com/eywa

Note that EYWA_HOME should be absolute path. And you may want to add this environment variable to your bash profile.

Run migration for sqlite db

  ./eywa migrate && ./eywa setup_es

If you don't have a config file present in /etc/eywa, by default, Eywa creates db file under at $EYWA_HOME/db/eywa_development.db for development mode and $EYWA_HOME/db/eywa_test.db for test mode.

You can change the default db location in configs/eywa_development.yml and configs/eywa_test.yml. We will refer to these two files as configuration files from going onwards.

Start Eywa

Now that you have most of dependencies ready, you can start Eywa by doing:

  ./eywa serve &

Now Eywa should be listening to your port 8080 for http requests and 8081 for websocket. Hoo-Yah!

Run the tests

There are two parts of the tests, unit tests and api tests. You can use the normal way to start unit tests:

  go test -v ./...

Running the integration test requires to run the Eywa server first. So we recommend to run all the test via the auto_test.sh script.

For example:

  ./auto_test.sh -v -n 4

Run all the unit tests for 4 times in verbose mode. All log outputs will be generated into auto_test.log, and will be overridden next time you run the tests.

  ./auto_test.sh -vi -n 4

Run both unit tests and integration tests for 4 times in verbose mode.

There are a bunch of tests for testing race conditions. If you are interested in running the tests util it fails, you can do:

  ./auto_test.sh -vif -n 1000

It will run the tests for no more than 1000 times or util it fails. Or if you are more aggressive to run it endlessly util something fails. Do:

  ./auto_test.sh -vif -n 0

You can read ./auto_test.sh -h for more details.

Clone this wiki locally