Skip to content

Commit

Permalink
Use Lando when running spec tests, gh-256
Browse files Browse the repository at this point in the history
  • Loading branch information
stkenny committed Sep 19, 2023
1 parent 7389610 commit b052e79
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ RSpec/PredicateMatcher:
Exclude:
- spec/**/*.rb

Rails/RakeEnvironment:
Exclude:
- 'tasks/dev.rake'

RSpec/ReturnFromStub:
Exclude:
- spec/processors/jpeg2k_spec.rb
Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,23 @@ Instead, each directive may contain these arguments:

## Running Tests

1. Run tests with `RAILS_ENV=test bundle exec rake ci`
For ease of development we use Lando to abstract away some complications of
using Docker containers for development.

## Running specific tests
1. Install the latest released > 3.0 version of Lando from [here](https://github.com/lando/lando/releases).
2. `bundle install`(Ruby 2.6+ required)
3. `bundle exec rake server:start`
4. `bundle exec rspec spec`

If you don't want to run the whole suite all at once like CI, do the following:
### Cleaning Data

1. Run the test servers with `rake derivatives:test_server`
2. Run the tests.
1. `bundle exec rake server:clean`

### Stopping Servers

1. `bundle exec rake server:stop`

You can also run `lando poweroff` from anywhere.

# Acknowledgments

Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require 'solr_wrapper/rake_task'
require 'fcrepo_wrapper'
require 'active_fedora/rake_support'
require 'rubocop/rake_task'
load 'tasks/dev.rake'

namespace :derivatives do
desc 'Run style checker'
Expand Down
23 changes: 23 additions & 0 deletions tasks/dev.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

namespace :server do
desc "Start solr and fedora servers for testing"
task :start do
require 'rails'
`lando start`
puts "Started Solr/Fedora"
end

desc "Cleanup test servers"
task :clean do
require 'rails'
`lando destroy -y`
`lando start`
puts "Cleaned/Started Solr/Fedora"
end

desc "Stop test servers"
task :stop do
`lando stop -y`
end
end

0 comments on commit b052e79

Please sign in to comment.