Skip to content

Commit

Permalink
Remove engine_cart
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotjordan committed Aug 31, 2023
1 parent dc39d80 commit b29f1c6
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 372 deletions.
3 changes: 0 additions & 3 deletions .engine_cart.yml

This file was deleted.

2 changes: 0 additions & 2 deletions CONTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ Let's break down the above command:

_**Note:**_ The `bundle exec rspec` portion of the command runs the whole test suite. See the [rspec command documentation](https://github.com/rspec/rspec-core#the-rspec-command) for how to refine your test runs.

_**Note**: The `/app/samvera/hyrax-webapp` is analogous to the `.internal_test_app` that we generate as part of the Hyrax engine Continuous Integration._

#### The Docker Container Named "app"

As a developer, you may need to run commands against the Hyrax-based application and/or the Hyrax engine. Examples
Expand Down
25 changes: 3 additions & 22 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@ group :development, :test do
gem "simplecov", require: false
end

test_app_path = ENV['RAILS_ROOT'] ||
ENV.fetch('ENGINE_CART_DESTINATION', File.expand_path('.internal_test_app', File.dirname(__FILE__)))
test_app_gemfile = File.expand_path('Gemfile', test_app_path)

# rubocop:disable Bundler/DuplicatedGem
if File.exist?(test_app_gemfile)
begin
Bundler.ui.info "[Hyrax] Including test application dependencies from #{test_app_gemfile}"
eval_gemfile test_app_gemfile
rescue Bundler::GemfileError => e
Bundler.ui.warn '[Hyrax] Skipping Rails application dependencies:'
Bundler.ui.warn e.message
end
elsif ENV['RAILS_VERSION'] == 'edge'
gem 'rails', github: 'rails/rails', source: 'https://rubygems.org'
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
elsif ENV['RAILS_VERSION']
gem 'rails', ENV['RAILS_VERSION'], source: 'https://rubygems.org'
else
Bundler.ui.warn '[Hyrax] Skipping all Rails dependency injection'
end
# rubocop:enable Bundler/DuplicatedGem
# Install gems from test app
test_app_path = File.expand_path('Gemfile', ".koppie")
eval_gemfile File.expand_path('Gemfile', ".koppie") if File.exist?(test_app_path)
11 changes: 0 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ end

Bundler::GemHelper.install_tasks

task :setup_test_server do
require 'engine_cart'
EngineCart.load_application!
end

Dir.glob('tasks/*.rake').each { |r| import r }

task default: :ci

# Load the test app's rake tasks so they can be run from the app namespace (e.g. app:db:migrate)
if File.exist?(File.expand_path(".internal_test_app/Rakefile", __dir__))
APP_RAKEFILE = File.expand_path(".internal_test_app/Rakefile", __dir__)
load 'rails/tasks/engine.rake'
end
1 change: 0 additions & 1 deletion bin/rails
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

ENGINE_ROOT = File.expand_path("..", __dir__)
ENGINE_PATH = File.expand_path("../lib/hyrax/engine", __dir__)
# APP_PATH = File.expand_path("../.internal_test_app/config/application", __dir__)

# Set up gems listed in the Gemfile.
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
Expand Down
2 changes: 0 additions & 2 deletions hyrax.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ SUMMARY
spec.add_development_dependency "capybara", '~> 3.29'
spec.add_development_dependency 'capybara-screenshot', '~> 1.0'
spec.add_development_dependency 'database_cleaner', '~> 1.3'
spec.add_development_dependency 'engine_cart', '~> 2.5'
spec.add_development_dependency "equivalent-xml", '~> 0.5'
spec.add_development_dependency "factory_bot", '~> 4.4'
spec.add_development_dependency 'fcrepo_wrapper', '~> 0.5', '>= 0.5.1'
Expand All @@ -108,6 +107,5 @@ SUMMARY
spec.add_development_dependency 'bixby', '~> 5.0', '>= 5.0.2' # bixby 5 briefly dropped Ruby 2.5
spec.add_development_dependency 'shoulda-callback-matchers', '~> 1.1.1'
spec.add_development_dependency 'shoulda-matchers', '~> 3.1'
spec.add_development_dependency 'webdrivers', '~> 4.4'
spec.add_development_dependency 'webmock'
end
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = function(config) {
},

// list of files / patterns to load in the browser
// uses dotenv to allow for .internal_test_app or .dassie as the Rails root
// uses dotenv to allow for .dassie as the Rails root

files: [
{pattern: 'spec/javascripts/fixtures/*.html', watched: true, included: false, served: true},
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/hyrax/templates/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
#
# To use this file, run the following command in the .internal_test_app:
# To use this file, run the following command in the test app:
# rails generate hyrax:sample_data
#
# To re-use this file, you will likely want to clean out the test app content
Expand Down
67 changes: 25 additions & 42 deletions lib/hyrax/specs/capybara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,57 +15,40 @@ def after_teardown
require 'capybara/rails'
require 'capybara-screenshot/rspec'
require 'selenium-webdriver'
require 'webdrivers' unless ENV['IN_DOCKER'].present? || ENV['HUB_URL'].present?

Capybara.save_path = ENV['CI'] ? "/tmp/test-results" : Rails.root.join('tmp', 'capybara')

if ENV['IN_DOCKER'].present? || ENV['HUB_URL'].present?
options = Selenium::WebDriver::Chrome::Options.new.tap do |opts|
opts.add_argument("--headless") if ENV["CHROME_HEADLESS_MODE"]
opts.add_argument("--disable-gpu") if Gem.win_platform?
# Workaround https://bugs.chromium.org/p/chromedriver/issues/detail?id=2650&q=load&sort=-id&colspec=ID%20Status%20Pri%20Owner%20Summary
opts.add_argument("--disable-site-isolation-trials")
opts.add_argument("--window-size=1440,1440")
opts.add_argument("--enable-features=NetworkService,NetworkServiceInProcess")
opts.add_argument("--disable-features=VizDisplayCompositor")
end

Capybara.register_driver :selenium_chrome_headless_sandboxless do |app|
driver = Capybara::Selenium::Driver.new(app,
browser: :remote,
capabilities: options,
url: ENV['HUB_URL'])
options = Selenium::WebDriver::Chrome::Options.new.tap do |opts|
opts.add_argument("--headless") if ENV["CHROME_HEADLESS_MODE"]
opts.add_argument("--disable-gpu") if Gem.win_platform?
# Workaround https://bugs.chromium.org/p/chromedriver/issues/detail?id=2650&q=load&sort=-id&colspec=ID%20Status%20Pri%20Owner%20Summary
opts.add_argument("--disable-site-isolation-trials")
opts.add_argument("--window-size=1440,1440")
opts.add_argument("--enable-features=NetworkService,NetworkServiceInProcess")
opts.add_argument("--disable-features=VizDisplayCompositor")
end

# Fix for capybara vs remote files. Selenium handles this for us
driver.browser.file_detector = lambda do |args|
str = args.first.to_s
str if File.exist?(str)
end
Capybara.register_driver :selenium_chrome_headless_sandboxless do |app|
driver = Capybara::Selenium::Driver.new(app,
browser: :remote,
capabilities: options,
url: ENV['HUB_URL'])

driver
# Fix for capybara vs remote files. Selenium handles this for us
driver.browser.file_detector = lambda do |args|
str = args.first.to_s
str if File.exist?(str)
end

Capybara.server_host = '0.0.0.0'
Capybara.server_port = 3010

ip = IPSocket.getaddress(Socket.gethostname)
Capybara.app_host = "http://#{ip}:#{Capybara.server_port}"
else
TEST_HOST = 'localhost:3000'.freeze
# @note In January 2018, TravisCI disabled Chrome sandboxing in its Linux
# container build environments to mitigate Meltdown/Spectre
# vulnerabilities, at which point Hyrax could no longer use the
# Capybara-provided :selenium_chrome_headless driver (which does not
# include the `--no-sandbox` argument).
Capybara.register_driver :selenium_chrome_headless_sandboxless do |app|
browser_options = ::Selenium::WebDriver::Chrome::Options.new
browser_options.args << '--headless'
browser_options.args << '--disable-gpu'
browser_options.args << '--no-sandbox'
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end
driver
end

Capybara.server_host = '0.0.0.0'
Capybara.server_port = 3010

ip = IPSocket.getaddress(Socket.gethostname)
Capybara.app_host = "http://#{ip}:#{Capybara.server_port}"

Capybara.default_driver = :rack_test # This is a faster driver
Capybara.javascript_driver = :selenium_chrome_headless_sandboxless # This is slower
Capybara.default_max_wait_time = ENV.fetch('CAPYBARA_WAIT_TIME', 10) # We may have a slow application, let's give it some time.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true
# This tests the Hyrax::WorksControllerBehavior module
# which is included into .internal_test_app/app/controllers/hyrax/generic_works_controller.rb
RSpec.describe Hyrax::GenericWorksController, :active_fedora do
routes { Rails.application.routes }

Expand Down
1 change: 0 additions & 1 deletion spec/controllers/hyrax/generic_works_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true
# This tests the Hyrax::WorksControllerBehavior module
# which is included into .internal_test_app/app/controllers/hyrax/generic_works_controller.rb
require 'hyrax/specs/spy_listener'

RSpec.describe Hyrax::GenericWorksController, :active_fedora do
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/hyrax/monographs_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true
# This tests the Hyrax::WorksControllerBehavior module with a Valkyrie resource.
# Included into .internal_test_app/app/controllers/hyrax/monographs_controller.rb
RSpec.describe Hyrax::MonographsController do
routes { Rails.application.routes }
let(:main_app) { Rails.application.routes.url_helpers }
Expand Down
20 changes: 6 additions & 14 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def ci_build?
SimpleCov.root(File.expand_path('../..', __FILE__))

SimpleCov.start('rails') do
add_filter '/.internal_test_app'
add_filter '/lib/generators'
add_filter '/spec'
add_filter '/tasks'
Expand All @@ -26,19 +25,12 @@ def ci_build?

require 'factory_bot'

if ENV['IN_DOCKER']
require File.expand_path("config/environment", '../hyrax-webapp')
db_config = ActiveRecord::Base.configurations[ENV['RAILS_ENV']]
ActiveRecord::Tasks::DatabaseTasks.create(db_config)

ActiveRecord::Migrator.migrations_paths = [Pathname.new(ENV['RAILS_ROOT']).join('db', 'migrate').to_s]
ActiveRecord::Tasks::DatabaseTasks.migrate
ActiveRecord::Base.descendants.each(&:reset_column_information)
else
require 'engine_cart'
EngineCart.load_application!
end

require File.expand_path("config/environment", '../hyrax-webapp')
db_config = ActiveRecord::Base.configurations[ENV['RAILS_ENV']]
ActiveRecord::Tasks::DatabaseTasks.create(db_config)
ActiveRecord::Migrator.migrations_paths = [Pathname.new(ENV['RAILS_ROOT']).join('db', 'migrate').to_s]
ActiveRecord::Tasks::DatabaseTasks.migrate
ActiveRecord::Base.descendants.each(&:reset_column_information)
ActiveRecord::Migration.maintain_test_schema!

require 'active_fedora/cleaner'
Expand Down
8 changes: 0 additions & 8 deletions spec/test_app_templates/Gemfile.extra

This file was deleted.

This file was deleted.

Loading

0 comments on commit b29f1c6

Please sign in to comment.