How do I run the core rspec unit tests for logstash from rake without this error?

I am building logstash 1.5.3-1 from source. When I run the core unit tests using rspec, they all pass, but when I run them using rake, a bunch fail.

My environment is an ubuntu trusty docker container on Docker for Mac.

Here are some of my setup actions and configuration settings:

cd /root/source
git clone -b 'v1.5.3.snapshot1' --single-branch --depth 1 https://github.com/elastic/logstash

edit Gemfile and add lines:
  gem "tins", "<1.7"
  gem "backports", "3.6.8"

export JRUBY_OPTS=--1.9
export GEM_HOME=/root/source/logstash/vendor/bundle/jruby/1.9
export GEM_PATH=/root/source/logstash/vendor/bundle/jruby/1.9/gems
export PATH=/root/source/logstash/vendor/bundle/jruby/1.9/bin:$PATH
export PATH=/root/source/logstash/vendor/jruby/bin:/root/source/logstash/vendor/bundle/jruby/1.9/bin:$PATH
export PATH=/root/source/logstash/bin:$PATH
export RUBYLIB=/root/source/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.3.snapshot1-java/lib
bundle install
rake bootstrap
rake plugin:install-default
rake test:install-core
rake test:core

The following runs the tests just fine:

rspec spec/**/*_spec.rb

When I run rake test:core as above, I get many errors that all look the same. Here is the first:

Failures:

  1) truncating unicode strings correctly randomized testing should be near the boundary of requested size
     Failure/Error: subject { LogStash::Util::UnicodeTrimmer }
     NameError:
       uninitialized constant LogStash::Util::UnicodeTrimmer
     # ./spec/util/unicode_trimmer_spec.rb:12:in `subject'
     # ./spec/util/unicode_trimmer_spec.rb:52:in `(root)'
     # ./vendor/bundle/jruby/1.9/gems/rspec-wait-0.0.9/lib/rspec/wait.rb:46:in `(root)'
     # ./rakelib/test.rake:32:in `(root)'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/task.rb:248:in `execute'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/task.rb:243:in `execute'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/task.rb:180:in `invoke_with_call_chain'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/task.rb:173:in `invoke'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/application.rb:152:in `invoke_task'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/application.rb:108:in `top_level'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/application.rb:108:in `top_level'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/application.rb:117:in `run_with_threads'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/application.rb:102:in `top_level'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/application.rb:80:in `run'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/lib/rake/application.rb:77:in `run'
     # ./vendor/bundle/jruby/1.9/gems/rake-11.3.0/exe/rake:27:in `(root)'

Of course, attempts to add a -r switch to the rake file for this file fail:

/root/source/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.3.snapshot1-java/lib/logstash/util/unicode_trimmer.rb

The file is there, but can't be found. I do not know where to make the change that will cause this file to be found. Environment variable? Change to rake file? Elsewhere? I am a novice at ruby and rake.

logstash uses jruby and a custom rake, rspec:

jruby 1.7.20 (1.9.3p551) 2015-05-04 3086e6a on OpenJDK 64-Bit Server VM 1.7.0_121-b00 +jit [linux-amd64]
rake, version 11.3.0
rspec, version 3.1.5

Here is my Dockerfile, in case it helps:

FROM ubuntu:trusty
# Example command to build an image with this Dockerfile:
#   docker build -t "ubuntu:trusty-logstash" -f Dockerfile .
# Example command to run image and name the container "logstash"
#   docker run --name logstash -it ubuntu:trusty-logstash
LABEL fpm="1.4.0" java="7" ruby1="1.9.3" ruby2="2.1.5" logstash="1.5.3-1"
SHELL ["/bin/bash", "-c"]

# Install curl, wget, rake and java 7 (needed by logstash for jruby)
RUN apt-get update && apt-get --yes --force-yes install \
    curl \
    wget \
    rake \
    openjdk-7-jre \
 && rm -rf /var/lib/apt/lists/*

# Install rvm
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN \curl -O https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer
RUN \curl -O https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer.asc
RUN gpg --verify rvm-installer.asc && bash rvm-installer stable
#   NOTE: echo command will not translate \n into newline in Dockerfile,
#         but printf will.
RUN printf " \\n\
if [ -f /etc/profile.d/rvm.sh ]; then \\n\
   source /etc/profile.d/rvm.sh \\n\
fi \\n\
" >> ~/.bashrc

# Install ruby versions
#   NOTE: Shell needs --login option so that .bashrc is executed, to setup rvm
SHELL ["/bin/bash", "--login", "-c"]
RUN rvm install 2.1.5
RUN rvm install 1.9.3
RUN rvm use 2.1.5
RUN rvm list

# Install fpm
RUN gem install fpm -v 1.4.0 --no-ri --no-rdoc

# Install logstash 1.5.3-1 as a package
# Get Elastic's signing key and add repository definition to the system
RUN wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
RUN echo "deb http://packages.elastic.co/logstash/1.5/debian stable main" | sudo tee -a /etc/apt/sources.list.d/logstash-1.x.list
RUN apt-get update && apt-get --yes --force-yes install \
    logstash=1:1.5.3-1 \
 && rm -rf /var/lib/apt/lists/*

# Create .exrc and append commands that permit arrow keys and backspace to work in vi.
RUN printf " \\n\
set nocompatible\\n\
set backspace=2\\n\
" >> ~/.exrc

# After all installs, run interactive bash shell
CMD ["/bin/bash", "-i"]

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.