Running Sensu plugins test locally


#1

Hi all,

I am trying to setup (development env. for) one of the sensu plugins (opsgenie). When I run rake default, I am getting the following error:

LoadError:

cannot load such file – spec_helper

./test/integration/helpers/serverspec/check-heartbeat-shared_spec.rb:3:in `require’

./test/integration/helpers/serverspec/check-heartbeat-shared_spec.rb:3:in `<top (required)>’

Also, the link to build and release in documentation is broken. Any kind of help is highly appreciated.


#2

Regarding the B&R docs we are not maintining the sensu-plugins.io site anymore, it was a community maintained project and the resources that have access are no longer active on the project. You can find documentation in:

You can can see the list of rake tasks we create by running:

$ bundle exec rake -T
rake build                      # Build sensu-plugins-opsgenie-4.3.0.g...
rake check_binstubs             # Test for binstubs
rake clean                      # Remove any temporary products
rake clobber                    # Remove any generated files
rake install                    # Build and install sensu-plugins-opsg...
rake install:local              # Build and install sensu-plugins-opsg...
rake integration                # Alias for kitchen:all
rake kitchen:all                # Run all test instances
rake kitchen:converge:all       # Run all converge instances
rake kitchen:create:all         # Run all create instances
rake kitchen:destroy:all        # Run all destroy instances
rake kitchen:ruby-21-debian-8   # Run ruby-21-debian-8 test instance
rake kitchen:ruby-22-debian-8   # Run ruby-22-debian-8 test instance
rake kitchen:ruby-230-debian-8  # Run ruby-230-debian-8 test instance
rake kitchen:ruby-241-debian-8  # Run ruby-241-debian-8 test instance
rake kitchen:setup:all          # Run all setup instances
rake kitchen:verify:all         # Run all verify instances
rake make_bin_executable        # Make all plugins executable
rake release[remote]            # Create tag v4.3.0 and build and push...
rake rubocop                    # Run RuboCop
rake rubocop:auto_correct       # Auto-correct RuboCop offenses
rake spec                       # Run RSpec code examples
rake yard                       # Generate YARD Documentation

I will have to look into why it fails when you run the tests via the default task but I verified that when you run the tests via bundle exec rake kitchen:ruby-241-debian-8 or similar they work as expected. This spins up a docker container based on debian jessie with a “slim” ruby environment.

If you are more interested about learning about testing plugins I have written the following posts that walk through it in more detail: