How to run rspec tests in Logstash 5.0.0


(Raymond Canzanese) #1

In Logstash 2.4.0, I had ran rpspec tests by installing the development plugins:

./bin/logstash-plugin install --development

And then running rspec:

./bin/rspec

In Logstash 5.0.0 installing the development plugins does not create a ./bin/rspec. Instead I see ./vendor/bundle/jruby/1.9/bin/rspec, but running this gives me

env: jruby: No such file or directory

How do I run my rspec tests in Logstash 5.0.0


(dennis) #2

May be elastic folks can comment but I didn't find an easy way to install rspec and dependency on top of 5.x deployment. Possible workaround would be (the way we did) is to build logstash from sources. It required minimal changes to our test suite.

Here is an example docker file which wraps everything:

FROM debian

RUN apt-get -y update
RUN apt-get -y install oracle-java8-set-default ruby-full git
RUN git clone -b 5.2 https://github.com/elastic/logstash.git
WORKDIR /logstash
RUN gem install rake
RUN gem install bundler
RUN rake bootstrap
RUN rake test:install-core
RUN bin/logstash-plugin install --development

COPY /pattern /etc/logstash/pattern
COPY /filter project_spec/filter
COPY /test project_spec/test
COPY /suite_runner.rb project_spec

CMD ["/logstash/bin/rspec", "/logstash/project_spec/suite_runner.rb"]


(Raymond Canzanese) #3

Thanks @tvid this looks a reasonable approach that we will give a shot in our environment.