README.md in logstash-output-charrington-0.2.2 vs README.md in logstash-output-charrington-0.3.0

- old
+ new

@@ -47,10 +47,47 @@ } } ``` ## Build & Publish + +**TLDR** ```bash +bundle exec rake build # build gem +gem push logstash-output-charrington-x.x.x.gem # publish +``` + +Everything in the [vendor](./vendor) directory (including `test-jars` if it exists) will be packaged with the generated gem. +Avoid including unnecessary dependencies, by removing the vendor directory and regenerating it with the rake task. +See the first command below: + +```bash +rm -r vendor && bundle exec rake install_jars # clean vendor directory and re-install runtime jar dependencies gem build logstash-output-charrington.gemspec # build gem push logstash-output-charrington-x.x.x.gem # publish gem owner --add <email> logstash-output-charrington # add another authorized publisher -``` \ No newline at end of file +``` + +## Testing +**NOTE:** Downloading test_jars requires maven and Java. You can set them up with asdf: [asdf-java](https://github.com/skotchpine/asdf-java), [asdf-maven](https://github.com/skotchpine/asdf-maven) +* There is currently an [open bug](https://github.com/skotchpine/asdf-maven/pull/17) with how `asdf-maven` sets `$JAVA_HOME` on a mac. Edit your `~/.asdf/plugins/maven/bin/exec-env` file to fix the bug + +```bash +bundle exec rake install_test_jars # install test runtime jar dependencies +bundle exec rspec +``` + +#### Dangling Embedded Postgres +**TLDR** +```bash +lsof -PiTCP -sTCP:LISTEN | grep postgres | awk '{print $2}' | xargs kill +``` +Sometimes the embedded postgres JAR can leave dangling open processes. This is obvious when you have `export TEST_DEBUG=true` +and the test output contains a stacktrace that starts with `[2019-06-21T15:18:06,734][ERROR][ru.yandex.qatools.embed.postgresql.PostgresProcess] Failed to read PID file (File '/var/folders/...`. +To resolve this issue, check for dangling processes using `lsof -PiTCP -sTCP:LISTEN | grep postgres`, then you can kill the process ids + +#### Resources +* [logstash-devutils](https://rubygems.org/gems/logstash-devutils) gem with logstash helper methods and tools + * [spec_helper.rb source](https://github.com/elastic/logstash-devutils/blob/master/lib/logstash/devutils/rspec/spec_helper.rb) + * [logstash_helpers.rb source](https://github.com/elastic/logstash-devutils/blob/master/lib/logstash/devutils/rspec/logstash_helpers.rb) +* [logstash-output-file spec test](https://github.com/logstash-plugins/logstash-output-file/blob/master/spec/outputs/file_spec.rb) +