-
Notifications
You must be signed in to change notification settings - Fork 17
Setup for Dev and Test
-
Download and start Elasticsearch 2.1
We use default ES settings locally, which means you should start your ES at port 9200
-
Install go1.5.1
We suggest to use gvm to manage the golang versions and your GOPATH.
There is a known issue during installing go1.5.1 with GOROOT setting. Following is the solution. Please refer to this issue for more details.
gvm install go1.4
gvm use go1.4
export GOROOT_BOOTSTRAP=$GOROOT
gvm install go1.5.1
gvm use go1.5.1
Clone the repository to your src tree of your $GOPATH
mkdir -p $GOPATH/src/github.com/vivowares
git clone [email protected]:vivowares/octopus.git $GOPATH/src/github.com/vivowares/octopus
cd $GOPATH/src/github.com/vivowares/octopus
go build -a
export OCTOPUS_HOME=$GOPATH/src/github.com/vivowares/octopus
You may want to add this environment variable to your bash profile.
cd tasks
go run migration.go
By default, Octopus creates db file under at $OCTOPUS_HOME/db/octopus_development.db
for development mode and $OCTOPUS_HOME/db/octopus_test.db
for test mode.
You can change the default db location in configs/octopus_development.yml
and configs/octopus_test.yml
and then build the entire project again. We will refer to these two files as configuration files from going onwards.
cd tasks
go run setup_es.go
If you ran into the problem connecting to Elasticsearch, check if your ES server is running at port 9200. If not you can modify the ES host and port in the configuration files.
Now that you have most of dependencies ready, you can start Octopus by doing:
./octopus
And Octopus should be listening to your port 8080 for http requests and 8081 for websocket requests by default. Hoo-Yah!
There are two parts of the tests, unit tests and integration tests. You can use the normal way to start unit tests:
go test -v ./...
Ignore anything outputted from tasks directory, they are not part of the tests.
Running the integration test requires to run the Octopus 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 if fails, you can do:
./auto_test.sh -vif -n 1000
It will run the tests for no more than 1000 times or util if 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.