Skip to content

Commit

Permalink
Update description about executing unit test with Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
sakama committed Dec 14, 2018
1 parent 2f13ea8 commit 88865e8
Showing 1 changed file with 11 additions and 41 deletions.
52 changes: 11 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,48 +95,18 @@ $ ./gradlew bintrayUpload # release embulk-output-elasticsearch to Bintray maven

## Test

```
$ ./gradlew test # -t to watch change of files and rebuild continuously
```

To run unit tests, we need to configure the following environment variables.
Firstly install Docker and Docker compose then `docker-compose up -d`,
so that an MongoDB server will be locally launched then you can run tests with `./gradlew test`.

When environment variables are not set, skip almost test cases.
```sh
$ docker-compose up -d
Creating network "embulk-output-elasticsearch_default" with the default driver
Creating embulk-output-elasticsearch_server ... done

```
ES_HOST
ES_PORT(optional, if needed, default: 9300)
ES_INDEX
ES_INDEX_TYPE
```
$ docker-compose ps
Name Command State Ports
------------------------------------------------------------------------------------------------------------------------------
embulk-output-elasticsearch_server /docker-entrypoint.sh elas ... Up 0.0.0.0:19200->9200/tcp, 0.0.0.0:19300->9300/tcp

If you're using Mac OS X El Capitan and GUI Applications(IDE), like as follows.
```
$ vi ~/Library/LaunchAgents/environment.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>my.startup</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>
launchctl setenv ES_HOST example.com
launchctl setenv ES_PORT 9300
launchctl setenv ES_INDEX embulk
launchctl setenv ES_INDEX_TYPE embulk
</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
$ launchctl load ~/Library/LaunchAgents/environment.plist
$ launchctl getenv ES_INDEX //try to get value.
Then start your applications.
$ ./gradlew test # -t to watch change of files and rebuild continuously
```

0 comments on commit 88865e8

Please sign in to comment.